Alex van der Spek
2012-Oct-30 11:53 UTC
[R] Is there an lm() equivalent of panel.lmline()?
panel.lmline returns intercept and slope of y ~ x subsetted to the combination of conditioning factors given to xyplot in lattice. for instance: xyplot(Xvalues ~ log(Qvalues)|Tfac, data = df7, panel = panel.lmline) I am looking to find the equivalent formulation for lm() proper. If I do this: lmcal <- lm(Xvalues ~ log(Qvalues):Tfac, data = df7) Only one value of the intercept is returned. It appears as all the 'individual' intercepts are summed to form one overall intercept. Any help much appreciated! Regards, Alex van der Spek
You can use the lmList function in the nlme package to do several seperate regressions, or use a model that allows for multiple intercepts. Possibly Xvalues ~ 0 + log(Qvalues)*Tfac or Xvalues ~ 0 + Tfac + log(Qvalues):Tfac (assuming Tfac is a factor). On Tue, Oct 30, 2012 at 5:53 AM, Alex van der Spek <doorz at xs4all.nl> wrote:> panel.lmline returns intercept and slope of y ~ x subsetted to the > combination of conditioning factors given to xyplot in lattice. > > for instance: > > xyplot(Xvalues ~ log(Qvalues)|Tfac, data = df7, panel = panel.lmline) > > > I am looking to find the equivalent formulation for lm() proper. If I do > this: > > lmcal <- lm(Xvalues ~ log(Qvalues):Tfac, data = df7) > > Only one value of the intercept is returned. It appears as all the > 'individual' intercepts are summed to form one overall intercept. > > Any help much appreciated! > > Regards, > Alex van der Spek > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com