[R] lattice and fitted function error
    Bliese, Paul D MAJ WRAIR-Wash DC 
    Paul.Bliese at NA.AMEDD.ARMY.MIL
       
    Fri Feb 28 22:10:03 CET 2003
    
    
  
Platform:  WIN2000
Version of R:  1.6.2
I'm interested in plotting fitted values in a trellis xyplot.  I believe the
following should work; however, I only get the points (not the fitted
lines).
library(lattice)
trellis.device(bg="white")
 xyplot(MULTDV~TIME|SUBNUM,data=TEMP,
 panel=function(x,y){
 panel.xyplot(x,y)
 lines(x,fitted(lm(y~poly(x,1),na.action=na.omit)))
 lines(x,fitted(lm(y~poly(x,2),na.action=na.omit)),lty=3)},
 xlab="Time",
 ylab="Average Reaction Time")
Happy to send the very small TEMP file for the curious...
Any suggestions?
Paul
MAJ Paul Bliese, Ph.D.
Walter Reed Army Institute of Research
Phone: (301) 319-9873
Fax: (301) 319-9484
paul.bliese at na.amedd.army.mil
    
    
More information about the R-help
mailing list