search for: piiecewise

Displaying 1 result from an estimated 1 matches for "piiecewise".

Did you mean: piecewise
2009 Sep 08
2
Fitting a linear model with a break point
...unction (i.e. y1 up until x_th and then y2 where x_th is the threshold). The threshold x_th is unknown and the x values can only take discrete values (0,1,2,3,4). An example would be: data<- data.frame(x=1:20,y=c(rnorm(10),rnorm(10,10))) I was thinking along the lines of fitting some sort of piiecewise linear model which has the gradient constrained to zero trying out all possible different threshold and taking the one with the least residuals. I am not sure how to implement this in R. Anyone got any ideas? Also is there a way of including the threshold in the actual model, so that could be es...