Re: [R] How to specify a fixed intercept for linear model

2010-12-03 Thread Michael Bedward
The offset arg is your friend... x <- 1:10 y <- 42 + 2*x + rnorm(length(x), 0, 0.5) # we suspect the intercept might be 42 ! lm( y ~ 0 + x, offset=rep(42, length(x))) Michael On 4 December 2010 13:42, cborley87 wrote: > > Hi, > > Im fitting some simple linear models to data from the olympic r

[R] How to specify a fixed intercept for linear model

2010-12-03 Thread cborley87
Hi, Im fitting some simple linear models to data from the olympic running events with lm(Logtime~Logdistance), the models contain an intercept and one slope parameter. I have fitted a separate model for each years data and as the intercept changes very little between years i am trying to simpli