[R] plot with nlme

Francisco J. Zagmutt Vergara fzagmutt at hotmail.com
Wed Apr 30 01:15:53 CEST 2003





>>>From: Hank Stevens <HStevens at muohio.edu>
>>>To: r-help at stat.math.ethz.ch
>>>Subject: [R] plot with nlme
>>>Date: Tue, 29 Apr 2003 10:03:23 -0400
>>>
>>>Using R v. 1.7.0 on Windows 2000
>>>
>>>I would like to plot the fitted values of a model as a function of a 
>>>continuous covariate, augmented with data (e.g., augPred) grouping by 
>>>combinations of fixed effects. I have not been able to use augPred 
>>>effectively, and am wondering if it does not handle unbalanced data (3 
>>>out of 192 missing).
>>>I include below the model and an xyplot that almost does the job. I would 
>>>happily send anyone the data if they would be willing to help.
>>>Many Thanks in advance.
>>>Hank
>>>
>>>The model:
>>>
>>>fm <- lme( log(S,2) ~ Fert*Litter*Seed*Density, data = collimd, random = 
>>>~1|block/plot/Seed )
>>>
>>># The following is close, but fits lines within each panel rather than 
>>>giving me the fitted values generated by the model.
>>>
>>>xyplot( log(S,2)  ~  log10(Nper0.5m)  |  Fert*Seed, data = collimd,
>>>groups=Litter,
>>>        scales = list( alternating =FALSE, tck=c(1,0)), layout = 
>>>c(4,2,1), aspect = 1, as.table = T,
>>>          key = list(space="top", transparent = TRUE,
>>>                    points=list(pch=c(1,3)),
>>>                      #trellis.par.get("superpose.symbol")$pch[1:2],
>>>                    lines=list(lty=1:2),
>>>                    text = list(c("With Litter", "Litter Removed"))   ) ,
>>>
>>>        panel = function(x, y, subscripts,...) {
>>>            panel.grid(h=-1, v= -1)
>>>            panel.superpose(x, y,subscripts, pch=c(1,3),col=1,...)
>>>             panel.superpose(x, y, 
>>>panel.groups="panel.lmline",lty=1:2,subscripts,...)
>>>
>>>            })
>>>
>>>
>>>
>>>Martin Henry H. Stevens, Assistant Professor
>>>338 Pearson Hall
>>>Botany Department
>>>Miami University
>>>Oxford, OH 45056
>>>
>>>Office: (513) 529-4206
>>>Lab: (513) 529-4262
>>>FAX: (513) 529-4243
>>>http://www.cas.muohio.edu/botany/bot/henry.html
>>>http://www.muohio.edu/ecology
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
>>
>>_________________________________________________________________
>>Charla con tus amigos en línea mediante MSN Messenger: 
>>http://messenger.yupimsn.com/
>
>Martin Henry H. Stevens, Assistant Professor
>338 Pearson Hall
>Botany Department
>Miami University
>Oxford, OH 45056
>
>Office: (513) 529-4206
>Lab: (513) 529-4262
>FAX: (513) 529-4243
>http://www.cas.muohio.edu/botany/bot/henry.html
>http://www.muohio.edu/ecology



>At 10:54 AM 4/29/2003, Francisco Zagmutt wrote:
>>Hi there
>>
>>I had that problem before and apparently it has to be with the log 
>>transformation that you used in the formula. R will not recognize the 
>>variable name and hence will just give you a plot with the fitted values 
>>and will give you a warning about the variable name.
>>Try creating a new variable with the log transformed values (i.e. log.y) 
>>of your original predictor and then use this new variable as your 
>>predictor.
>>
>>fm <- lme( log.y ~ Fert*Litter*Seed*Density, data = collimd,
>>>random = ~1|block/plot/Seed )
>>
>>
>>Let me know if this worked
>>
>>Francisco




>From: Hank Stevens <HStevens at muohio.edu>
>To: "Francisco J. Zagmutt Vergara" <fzagmutt at hotmail.com>
>Subject: Re: [R] plot with nlme
>Date: Tue, 29 Apr 2003 11:06:27 -0400
>
>Francisco!
>Thanks!
>
>plot( augPred( fm) )
>
>worked!
>
>Now, however, I would like to group by fixed effects, not random variables 
>(e.g., Subjects). Any thoughts?
>
>
>
>>
>>
>>



More information about the R-help mailing list