How does predict.lm() compute confidence interval and prediction interval?
<p>I ran a regression:</p>

<pre><code>CopierDataRegression &lt;- lm(V1~V2, data=CopierData1)
</code></pre>

<p>and my task was to obtain a</p>

<ul>
<li>90% <strong>confidence interval</strong> for the mean response given <code>V2=6</code> and  </li>
<li>90% <strong>prediction interval</strong> when <code>V2=6</code>.</li>
</ul>

<p>I used the following code: </p>

<pre><code>X6 &lt;- data.frame(V2=6)
predict(CopierDataRegression, X6, se.fit=TRUE, interval="confidence", level=0.90)
predict(CopierDataRegression, X6, se.fit=TRUE, interval="prediction", level=0.90)
</code></pre>

<p>and I got <code>(87.3, 91.9)</code> and <code>(74.5, 104.8)</code> which seems to be correct since the PI should be wider.</p>

<p>The output for both also included <code>se.fit = 1.39</code> which was the same. <strong>I don't understand what this standard error is. Shouldn't the standard error be larger for the PI vs. the CI? How do I find these two different standard errors in R?</strong>
<a href="https://i.stack.imgur.com/mdupt.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mdupt.jpg" alt="enter image description here"></a></p>

<hr>

<p>Data:</p>

<pre><code>CopierData1 &lt;- structure(list(V1 = c(20L, 60L, 46L, 41L, 12L, 137L, 68L, 89L, 
          4L, 32L, 144L, 156L, 93L, 36L, 72L, 100L, 105L, 131L, 127L, 57L, 
          66L, 101L, 109L, 74L, 134L, 112L, 18L, 73L, 111L, 96L, 123L, 
          90L, 20L, 28L, 3L, 57L, 86L, 132L, 112L, 27L, 131L, 34L, 27L, 
          61L, 77L), V2 = c(2L, 4L, 3L, 2L, 1L, 10L, 5L, 5L, 1L, 2L, 9L, 
          10L, 6L, 3L, 4L, 8L, 7L, 8L, 10L, 4L, 5L, 7L, 7L, 5L, 9L, 7L, 
          2L, 5L, 7L, 6L, 8L, 5L, 2L, 2L, 1L, 4L, 5L, 9L, 7L, 1L, 9L, 2L, 
          2L, 4L, 5L)), .Names = c("V1", "V2"),
          class = "data.frame", row.names = c(NA, -45L))
</code></pre>