Hi everyone,

I'm trying to make a prediction on the following model for the values V1 =
18, V4 = 35, V6 = 7.

modelo4 = lm(Y ~ V1 + V4 + V6, data = datos)

and I want to plot the confidence bands for that prediction, I've found many
examples for simple regression, but I haven't been able to find any examples
for a multiple regression and I can't make it happend. Would anybody please
help me?

This is what I've got so far:

newdata = data.frame(V1=c(18),V4=c(35),V6=c(7))
limc = predict(modelo4,newdata,interval=c("confidence"),level=0.95)
limp = predict(modelo4,newdata,interval=c("prediction"),level=0.95)

limites = cbind(newdata,limc[,2:3],limp[,2:3])
plot.new()
plot(limites[,4],limites[,5],xlab="V1",ylab="Y",type="l")
title("Bandas de confianza")
points(limites[,1],limites[,2],limites[,3],limites[,4],type="l",col=2)
points(limites[,1],limites[,2],limites[,3],limites[,5],type="l",col=4)
bandas=expression("Intervalos de la media", "Intervalo de prediccion")
legend(-3,1,bandas,col=c(2,4),cex=0.7)
abline(modelo4)

but it is not working at all... Also tried this approach with points:
points(limites[,1],limites[,4],type="l",col=2)
points(limites[,1],limites[,5],type="l",col=4)
points(limites[,2],limites[,4],type="l",col=2)
points(limites[,2],limites[,5],type="l",col=4)
points(limites[,3],limites[,4],type="l",col=2)
points(limites[,3],limites[,5],type="l",col=4)

Please... Help?

Thanks a lot in advance!

Hector Guilarte

	[[alternative HTML version deleted]]

