[R] linear model with interaction / segments

2009-08-29 Thread Markus Gesmann
Dear R-help, Suppose I have the following data: df=data.frame(x=1:10, y=c(1,2,3,4,5,12,14,16,18,20)) plot(y~x, df, t=b) How can I fit a model which estimates the slopes between x = 1-5, 5-6, and 6-10? Adding the factor f: df$f - gl(2,5) Allows me to fit a linear model with interaction

Re: [R] linear model with interaction / segments

2009-08-29 Thread David Winsemius
On Aug 29, 2009, at 7:56 AM, Markus Gesmann wrote: Dear R-help, Suppose I have the following data: df=data.frame(x=1:10, y=c(1,2,3,4,5,12,14,16,18,20)) plot(y~x, df, t=b) How can I fit a model which estimates the slopes between x = 1-5, 5-6, and 6-10? Adding the factor f: df$f -

Re: [R] linear model with interaction / segments

2009-08-29 Thread Gavin Simpson
On Sat, 2009-08-29 at 12:56 +0100, Markus Gesmann wrote: Dear R-help, Suppose I have the following data: df=data.frame(x=1:10, y=c(1,2,3,4,5,12,14,16,18,20)) plot(y~x, df, t=b) How can I fit a model which estimates the slopes between x = 1-5, 5-6, and 6-10? Does the segmented