Re: [R] Model vs. Observed for a lme() regression fit using two variables

From: CG Pettersson <cg.pettersson_at_evp.slu.se>
Date: Thu 07 Sep 2006 - 19:49:18 GMT

Hi Andrew,

Thanks a lot, That would give me what I want. But using my own data and models resulted in this:

> plot(fitted(tcos31.c.cp, level=1), FCR.c$g.cp)
Error in xy.coords(x, y, xlabel, ylabel, log) :

        'x' and 'y' lengths differ

This is quite correct, as there are some missing values in the covariate and I made the model using the 'na.action=na.omit' option.

I know there is a way of using the model to fix this, but havenīt been able to get the code right during the afternoon.

How do I code this and where should I have looked?

Cheers
/CG

On Thu, September 7, 2006 12:03 pm, Andrew Robinson said:
> 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@vpe.slu.se
>>
>> ______________________________________________
>> R-help@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
>

-- 
CG Pettersson, MSci, PhD Stud.
Swedish University of Agricultural Sciences (SLU)
Dep. of Crop Production Ekology. Box 7043.
SE-750 07 Uppsala, Sweden
cg.pettersson@vpe.slu.se

______________________________________________
R-help@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.
Received on Fri Sep 08 06:03:53 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 21:48:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.