# [R] How to read prediction intervals given by predict()?

Rolf Turner r.turner at auckland.ac.nz
Sat Oct 15 22:46:43 CEST 2016

```On 16/10/16 04:24, mviljamaa wrote:
> My conception of prediction intervals is the following:
>
> "a prediction interval gives an interval within which we expect next y_i
> to lie with a specified probability"
>
> So when using predict() for my model:
>
> predict(fit4, interval="prediction")[1:20,]
>
> I get:
>
>         fit      lwr      upr
> 1  491.1783 381.3486 601.0081
> 2  515.4883 405.7128 625.2638
> 3  581.5957 447.9569 715.2344
> 4  522.4979 412.5086 632.4872
> 5  604.6008 492.2796 716.9221
> 6  520.2881 410.3108 630.2655
> 7  620.7379 507.9045 733.5713
> 8  621.0925 505.8731 736.3119
> 9  527.1810 417.2760 637.0859
> 10 519.4651 406.1622 632.7680
> 11 622.0051 512.0082 732.0021
> 12 536.6924 424.3415 649.0434
> 13 504.8618 394.9034 614.8202
> 14 545.5920 433.6530 657.5309
> 15 475.6153 362.4383 588.7923
> 16 462.5341 350.6090 574.4593
> 17 559.0888 448.1212 670.0564
> 18 544.0051 432.0583 655.9519
> 19 471.1450 355.2377 587.0523
> 20 604.3028 470.6925 737.9130
>
> Now since the prediction interval gives the interval within which the
> _next_ y_i will fall, then how to read the above results? Does the
> previous row's "lwr" and "upr" refer to the next row's "fit"'s interval?

(a) This is really off-topic since it's more of a statistics question
than an R question.

(b) Your understanding of prediction intervals is incorrect and
confused.  A 95% (for example)  prediction interval will contain a *new*
independent observation of y, at the same predictor value(s) with
probability 0.95.  Get your hands on an elementary statistics textbook

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

```