Questions tagged [piecewise-linear]
62 questions
15
votes
4 answers
Estimating the break point in a broken stick / piecewise linear model with random effects in R [code and output included]
Can someone please tell me how to have R estimate the break point in a piecewise linear model (as a fixed or random parameter), when I also need to estimate other random effects?
I've included a toy example below that fits a hockey stick / broken…

lockedoff
- 1,795
- 2
- 12
- 19
10
votes
4 answers
Piecewise linear regression with knots as parameters
I would like to fit a piecewise linear regression with knots as parameters. I would like to know what's the best solution.
Should I run a set of regressions with all the possible knots and choosing the knots which could minimize an information…

PAC
- 814
- 1
- 8
- 19
10
votes
2 answers
Standard error of slopes in piecewise linear regression with known breakpoints
The situation
I have a dataset with one dependent $y$ and one independent variable $x$. I want to fit a continuous piecewise linear regression with $k$ known/fixed breakpoints occurring at $(a_{1}, a_{2}, \ldots, a_{k})$. The breakpoins are known…

COOLSerdash
- 25,317
- 8
- 73
- 123
7
votes
1 answer
How to use segmented package to fit a piecewise linear regression with one breakpoint?
I have problems using the package segmented.
My linear regression is very simple, between offer and demand:
linearModel <- lm(demand~offer)
And so should be my model using "segmented":
piecewiseModel <- segmented(lm(demand~offer), seg.Z = ~…

Antonin
- 409
- 2
- 5
- 10
6
votes
2 answers
Correct way to compare two (very) different regression models?
I'm working with some piecewise linear regression models, and I'd like to compare their predictions with those produced by multiple (weighted) linear regression models. Both models describe the same physical system, but have very different…

BenDundee
- 609
- 3
- 8
- 17
6
votes
1 answer
Position of knots in piecewise linear regression as 'random effects'
TL;DR: Is there some way I can do 'random knots' (where the position of the knot varies according to some group, not the number)?
Full question: After obtaining experimental data, I find that one of the covariates has an interesting relationship…

WavesWashSands
- 599
- 4
- 16
6
votes
1 answer
Test for the significance of the effect of an intervention in a time series
I am looking for the best approach to test for the significance of the effect of an intervention that occurred at a known time on a time series data.
Using a toy dataset as an example, I have come up with two approaches.
Data
y <- c(rnorm(10, 10,…

Mihael
- 513
- 3
- 14
6
votes
3 answers
"Branching Stick" Regression
With piecewise, or so-called broken-stick regression it is possible to fit two lines to data,
But what if I wanted to fit data to two lines, one main and one branch which connects to a primary line not necessarily on end points. This would a…

BBSysDyn
- 1,002
- 1
- 9
- 17
6
votes
2 answers
R - how to get standard error for a breakpoint/parameter in a piecewise regression
I'm new to asking questions here, so I hope this is a reasonable place for this.
I am trying to fit a piece-wise regression. I expect my response (y) to increase from x0 to somewhere along x, then to plateau after a breakpoint; thereafter, slope =0.…

Sarah
- 81
- 6
5
votes
3 answers
Piecewise regression with constraints
I want to make a piecewise linear regression in R. I have a large dataset with 3 segments where I want the first and third segment to be without slope, i.e. parallel to x-axis and I also want the regression to be continuous. I have a small example…

Mats_B
- 51
- 1
- 3
5
votes
2 answers
Generate random number from a piecewise exponential distribution
I would like to generate a random number from a piecewise exponential distribution.
I consider that the time-scale is divided in $J$ intervals with bounds $(s_{j-1},s_j]$, for $j=1,...,J$, and corresponding rates $\lambda_j$.
Considering the…

Alessandro Beretta
- 81
- 1
- 6
4
votes
1 answer
Piecewise regression
I have a time series where I want to fit a piecewise regression equation. Now the problem occurs when I try to fit equations of different degree in different segments of the series. Please provide me with citations to examples dealing with the…

user43722
- 41
- 1
- 2
4
votes
0 answers
Parametric segmented or piecewise regression with heteroscedastic errors
I am fitting longitudinal data with an increase in variance over time. The standard physiological model is a bi- or tri-linear model with variable breakpoints. The estimated parameters are used to describe rate of growth and time to maturity.
Is…

KAM
- 41
- 1
4
votes
1 answer
Is there a formal test for model comparison between polynomial regression and piecewise/segmented regression? (i.e., are these models nested?)
I am interested in comparing three models
a linear regression model: mod_linear <- lm (dv ~ iv)
a polynomial regression model: mod_polynomial <- lm (dv ~ iv + I(iv^2))
a one-breakpoint piecewise/segmented linear model: mod_segmented <-…

Annalise
- 87
- 8
4
votes
3 answers
Piecewise linear with constraints with the segmented function on R
I want to make a piecewise linear regression in R. I have a large dataset with 3 segments where I want the first and third segment to be without slope, i.e. parallel to x-axis and I also want the regression to be continuous.
I have a small example…

Cyrielle
- 41
- 1
- 2