[R] lm question
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Oct 9 12:26:21 CEST 2000
Bill Simpson <wsi at gcal.ac.uk> writes:
> I have not really used lm before and I was hoping for some help on a
> simple problem.
> I want to fit a model that has one y-intercept and three slopes, one for
> each group.
Actually, this is not so simple because it goes somewhat against the
grain of the way the S/R model formulas are designed (they generally
assume that identical intercepts only make sense with identical
lm(formula = y ~ x:(grp - 1) + 1)
(Intercept) x.grpa x.grpb x.grpc
-0.80977 0.01847 0.13124 0.14259
The form grp-1 gives you the "no-intercept" coding of the grp factor
and its interaction (":") with x specifies separate slopes for each
group. Once you've used "-1" the intercept disappears from the model,
so you need to add it back in with "+1".
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help