[R] [R]Intercept in model formulae
sadok walid
sadok at ensam.inra.fr
Wed Jan 22 18:25:03 CET 2003
Hi,
I'm a new user of R and I'm trying to make a linear model from this kind of
dataset
x
[1] 16.87 19.93 25.85 20.94 17.06 19.49 19.93 25.45 27.74 20.15 25.81
21.06 17.17 20.03 25.50 27.79 20.44 16.88 19.93 25.79
z<-x-10
y
[1] 0.80 1.27 2.22 1.32 0.90 1.18 1.84 2.41 2.97 1.25 2.07 1.41 1.14 1.66
2.59 3.51 1.53 0.81 1.26 2.30
plot(x,y)
I want to be able to force the line of the model(mymodel<-lm(y~z)) to pass
through the origin (zero) and the line of the model(mymodel<-lm(y~x)) to
pass through 10 as an x-intercept.
For the first case i have used the (y~x-1) syntax, but the linear model
returned a regresssion that didn't pass trough the points (with a higher
Rsq than expected).
For the second case, i did not find a solution yet..
Could somone help me please?
Thanks in avance
Walid SADOK
More information about the R-help
mailing list