[R] lattice and fitted function error

Stephen C. Upton upton at mitre.org
Fri Feb 28 22:39:02 CET 2003


Paul,

I don't think you can use lines with trellis graphics. Check out ?panel.lmline
(and other associated panel. functions).

HTH
steve

"Bliese, Paul D MAJ WRAIR-Wash DC" wrote:

> 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