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 segmen

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 <- gl(

[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

[R] Linear model with interaction

2009-04-17 Thread Marian Thieme
Hi all, I have a question about linear model with interaction: I created a data frame df like this: >df V1 V2 V3 V4 V5 1 6.414094 c t a g 2 6.117286 t a g t 3 5.756922 a g t g 4 6.090402 g t g t ... which holds the response in the first column and letters (a,c,g,t) in th