This is what I have done so far. I am not sure how to create the 95% confidence band:
x=rnorm(100,0,1)
e=rnorm(100,0,4)
for (i in 1:100){y[i]=2+3*x[i]+e[i]}
plot(x,y,lty=3)
estimation_lm=lm(y~x)
(summary(estimation_lm))
(cc=coef(estimation_lm))
abline(estimation_lm)
abline(a=2, b=3,col="red")
I know I have to use this code but I am not exactly sure what I should use in the new data or for interval(I guess I should use prediction
) for this question:
predict(object, newdata, interval = "none"/"confidence"/"prediction",level = 0.95)
A more zoomed-in version of the part I am stuck in: