In many fields of the natural sciences it is common practice to report the results of linear regression analysis as y = (a1 +- u(a1)) + (a2 +- u(a2)) * x
, including R2 and p, but not the original data. u(a1) and u(a2) are the uncertainties (standard error) of a1 and a2. How could I calculate with this information the confidence and prediction intervals, or have a “reasonable” estimation?
Let me clarify with an example. This is a dummy dataset, with a line of slope 1 and gaussian noise 10:
set.seed(1961)
npoints <- 1e2
(x <- 1:npoints)
(y <-1:npoints + rnorm(npoints, 0, npoints/10))
Now I perform the linear regression:
par(mar = c(4, 4, 1, 1))
xy.model <- lm(y ~ x)
plot(x, y, pch = 16)
abline(xy.model, col = "orange", lwd = 2)
(xy.sum <- summary(xy.model))
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) -1.28106 1.94918 -0.657 0.513
# x 1.00484 0.03351 29.987 <2e-16 ***
# Residual standard error: 9.673 on 98 degrees of freedom
# Multiple R-squared: 0.9017, Adjusted R-squared: 0.9007
# F-statistic: 899.2 on 1 and 98 DF, p-value: < 2.2e-16
I calculate the confidence and prediction intervals:
x.new <- data.frame(x = 1:npoints)
xy.conf <- predict.lm(xy.model, se.fit = TRUE, interval = "confidence", newdata = x.new)
xy.pred <- predict.lm(xy.model, se.fit = TRUE, interval = "prediction", newdata = x.new)
For example, the confidence and prediction intervals of the first point are:
xy.conf$fit[1, ]
# fit lwr upr
# -0.2762127 -4.0867009 3.5342755
xy.pred$fit[1, ]
# fit lwr upr
# -0.2762127 -19.8462821 19.2938568
If the regression equation is reported as y = (-1.28106 +- 1.94918) + (1.00484 +- 0.03351) * x, R2 = 0.9017, p < 0.05, but the original data are not provided, how can I reproduce (at least approximately) the values, of the confidence and prediction intervals?