[R] abline with xyplot does not work
John Sorkin
jsorkin at grecc.umaryland.edu
Thu Mar 29 18:38:59 CEST 2012
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 th...{{dropped:6}}
More information about the R-help
mailing list