Considere esses exemplos
Usando a graphics com código reproduzível
m0 <- lm(dist ~ poly(speed, degree = 2), data = cars)
grid <- with(cars,
data.frame(speed = seq(min(speed),
max(speed),
length.out = 31)))
mat <- predict(m0, newdata = grid, interval = "confidence")
grid <- cbind(grid, as.data.frame(mat))
str(grid)
plot(dist ~ speed, data = cars, type = "n")
with(grid, polygon(x = c(speed, rev(speed)),
y = c(lwr, rev(upr)),
col = "gray",
border = NA))
lines(fit ~ speed, data = grid)
points(dist ~ speed, data = cars)
À disposição.
Walmes.