I am trying to use the Lattice package to produce the same result as I
can with the base graphics.
With base graphics I can type:
x - 1:100
y - x+rnorm(length(x))
g - lm( y ~ x )
model.y - g$coef[1]+g$coef[2]*x
plot(x,y) # a plot of the data
lines( x, model.y ) # a plot of the model,
How about this?
library(lattice)
xyplot(y ~ x, panel = function(x, y, ...){
panel.xyplot(x, y, ...)
panel.lmline(x, y, type=l)
})
Matthew Walker wrote:
I am trying to use the Lattice package to produce the
On Thursday 29 July 2004 06:37, Chuck Cleland wrote:
How about this?
library(lattice)
xyplot(y ~ x, panel = function(x, y, ...){
panel.xyplot(x, y, ...)
panel.lmline(x, y, type=l)
})
That should