I have uploaded a dataset and fit a linear model to it where y
is the predictor, x
is the response, and d
is the dataset.
Asked
Active
Viewed 1,056 times
-3

uytt
- 1
- 3
-
2Unclear. Confidence interval on the mean value of Y across the data set? What does "predictive interval for just y" mean? By definition, the expected mean value of Y will be occur at E(x), so you might try: `predict(linmod, newdata=data.frame(x=mean(d$x)), ...)` – Ben Bolker Dec 01 '17 at 00:36
-
I apologize for the confusion. I am trying to find the confidence interval for the expected value of y and the predictive interval for y (not the predictive interval for the expected value of y). Thank you for your help. – uytt Dec 01 '17 at 00:39
1 Answers
1
You can generate a confidence interval for the point estimate like this:
CI <- confint(linmod, 'x', level=0.95)
You can generate a prediction interval for each of the observed points in d like this:
PI<-predict(linmod, interval="prediction", newdata = list(d$x), level=0.95)

jalind
- 491
- 1
- 5
- 11