[R] abline with xyplot does not work

Bert Gunter gunter.berton at gene.com
Thu Mar 29 19:08:34 CEST 2012


?panel.abline

You need grid/lattice functions for xyplot !

-- Bert

On Thu, Mar 29, 2012 at 9:38 AM, John Sorkin
<jsorkin at grecc.umaryland.edu> wrote:
> I am trying to plot the results of a random effects model where each subject is allowed to have his, or her, own intercept. I use xyplot to plot the data, lme to compute the regression and then try to put a summary regression line on the xyplot. As can be seen by the output pasted below, I am getting an error message,
> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
>  (list) object cannot be coerced to type 'double'
> Any ideas what I need to change to make this work?
>
>
>
>
>> # Run random effects regression with subject specific slopes.
>> fitxx<-lme(value~time,random=~1|subject,data=repeatdata,na.action=na.omit)
>> summary(fitxx)
> Linear mixed-effects model fit by REML
>  Data: repeatdata
>       AIC      BIC    logLik
>  303.4246 309.6460 -147.7123
>
> Random effects:
>  Formula: ~1 | subject
>        (Intercept) Residual
> StdDev:    15.17196 9.803319
>
> Fixed effects: value ~ time
>               Value Std.Error DF   t-value p-value
> (Intercept) 52.79943  4.467854 21 11.817625  0.0000
> time        -0.44162  0.231605 21 -1.906793  0.0703
>  Correlation:
>     (Intr)
> time -0.242
>
>
>
> Number of Observations: 37
> Number of Groups: 15
>>
>> # Plot data
>> xyplot(value~time,group=subject,type="b",main="Clot size vs. time.")
>> # Add summary regression line
>> abline(fitxx)
> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
>  (list) object cannot be coerced to type 'double'
>>
>>
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:22}}



More information about the R-help mailing list