Prediction interval - Linear regrission

I use these codes to generate the Prediction interval, which should be 2 numbers:
xp = data.frame(x = 17)
predict(fit, xp, interval, level)
Instead, I get a whole list of prediction ( n predictions!!!!)

Any know what is the problem?

I have some guesses, but it's hard to troubleshoot without your model and an example dataset. Could you include a dataset and your model code so your question is reproducible?

If you've never made a reproducible example (i.e., "reprex") before, you can see an explanation and some suggested reading material here:

Note that one reason for getting predictions for the original dataset instead of the new dataset for lm objects is if you don't have a variable in the new dataset with the same name as the explanatory variable in your model.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.