CG Pettersson
2006-Sep-07 09:35 UTC
[R] Model vs. Observed for a lme() regression fit using two variables
Dear all. R 2.3.1, W2k. I am working with a field trial series where, for the moment, I do regressions using more than one covariate to explain the protein levels in malting barley. To do this I use lme() and a mixed call, structured by both experiment (trial) and repetition in each experiment (block). Everything works fine, resulting in nice working linear models using two covariates. But how do I visualize this in an efficient and clear way? What I want is something like the standard output from all multivariate tools I have worked with (Observed vs. Predicted) with the least square line in the middle. It is naturally possible to plot each covariate separate, and also to use the 3d- sqatterplot in Rcmdr to plot both at the same time, but I want a plain 2d plot. Who has made a plotting method for this and where do I find it? Or am I missing something obvious here, that this plot is easy to achieve without any ready made methods? Cheers /CG -- CG Pettersson, MSci, PhD Stud. Swedish University of Agricultural Sciences (SLU) Dept. of Crop Production Ecology. Box 7043. SE-750 07 UPPSALA, Sweden. +46 18 671428, +46 70 3306685 cg.pettersson at vpe.slu.se
Andrew Robinson
2006-Sep-07 10:03 UTC
[R] Model vs. Observed for a lme() regression fit using two variables
Hi CG, I think that the best pair of summary plots are 1) the fitted values without random effects against the observed response variable, and 2) fitted values with random effects against the observed response variable. The first plot gives a summary of the overall quality of the fixed effects of the model, the second gives a summary of the overall quality of the fixed effects and random effects of the model. eg fm1 <- lme(distance ~ age, data = Orthodont) plot(fitted(fm1, level=0), Orthodont$distance) abline(0, 1, col="red") plot(fitted(fm1, level=1), Orthodont$distance) abline(0, 1, col="red") I hope that this helps. Andrew On Thu, Sep 07, 2006 at 11:35:40AM +0200, CG Pettersson wrote:> Dear all. > > R 2.3.1, W2k. > > I am working with a field trial series where, for the moment, I do > regressions using more than one covariate to explain the protein levels > in malting barley. > > To do this I use lme() and a mixed call, structured by both experiment > (trial) and repetition in each experiment (block). Everything works > fine, resulting in nice working linear models using two covariates. But > how do I visualize this in an efficient and clear way? > > What I want is something like the standard output from all multivariate > tools I have worked with (Observed vs. Predicted) with the least square > line in the middle. It is naturally possible to plot each covariate > separate, and also to use the 3d- sqatterplot in Rcmdr to plot both at > the same time, but I want a plain 2d plot. > > Who has made a plotting method for this and where do I find it? > Or am I missing something obvious here, that this plot is easy to > achieve without any ready made methods? > > Cheers > /CG > > -- > CG Pettersson, MSci, PhD Stud. > Swedish University of Agricultural Sciences (SLU) > Dept. of Crop Production Ecology. Box 7043. > SE-750 07 UPPSALA, Sweden. > +46 18 671428, +46 70 3306685 > cg.pettersson at vpe.slu.se > > ______________________________________________ > R-help at stat.math.ethz.ch 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.-- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 Email: a.robinson at ms.unimelb.edu.au http://www.ms.unimelb.edu.au