[R] lattice and fitted function error

Deepayan Sarkar deepayan at cs.wisc.edu
Fri Feb 28 23:34:02 CET 2003


You need to use llines instead of lines (lines doesn't produce any output with 
grid graphics).

Quoting "Bliese, Paul D MAJ WRAIR-Wash DC" <Paul.Bliese at NA.AMEDD.ARMY.MIL>:

> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list