learning R.... anyway:
In a simple regression just x and y, I entered:
predict(data1.lm, interval="prediction")
and
predict(data1.lm, interval="confidence")
I am confused on what the difference is.
The prediction interval predicts in what range a future individual observation will fall, while a confidence interval shows the likely range of values associated with some statistical parameter of the data, such as the population mean.
The predict() function in R is used to predict the values based on the input data. All the modeling aspects in the R program will make use of the predict() function in their own way, but note that the functionality of the predict() function remains the same irrespective of the case.
To find the confidence interval in R, create a new data. frame with the desired value to predict. The prediction is made with the predict() function. The interval argument is set to 'confidence' to output the mean interval.
A confidence interval of the prediction is a range that likely contains the mean value of the dependent variable given specific values of the independent variables. Like regular confidence intervals, these intervals provide a range for the population average.
I don't see any parameter named "interval" in the description of confint
on its help page, nor in the code for either confint.default
or confint.lm
. I believe this may be the root of your problem.
Responding to the edit: The prediction interval is the range in which future observation can be thought most likely to occur, whereas the confidence interval is where the mean of future observation is most likely to reside. The confidence interval is generally much more narrow than the prediction interval and its "narrowness" will increase with increasing numbers of observations, whereas the prediction interval will not decrease in width. Think 'std-error-of-the-mean' (which has a 1/N term) versus 'standard-deviation' (which only has 1/sqrt(N)). In the general case, the confidence interval and the prediction intervals will be functions of the covariates rather than just individual univariate interval pairs.
interval
is an argument of predict
, not confint
.
The intervals can include the uncertainty on the estimated coefficients
(confidence
), the variance ("noise") in the observations,
or both (prediction
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With