title: Finding the 95% confidence interval using the confint function in R
body: <p>I'm analysing the <code>Boston</code> dataset from the <a href="https://cran.r-project.org/web/packages/MASS/MASS.pdf" rel="nofollow noreferrer">MASS package</a> in R. I begin by carrying out a linear regression with <code>medv</code> as the response and <code>ptratio</code> as the only predictor:</p>
  <pre><code>lm.Boston &lt;- lm(formula = medv ~ ptratio, data = Boston.df)
  </code></pre>
  <p>I then want to find a 95% confidence interval for the estimate of <code>ptratio</code>. My understanding is that I can do this using the <a href="https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/confint" rel="nofollow noreferrer"><code>confint</code> function</a>:</p>
  <pre><code>confint(lm.Boston, level = 0.95)
  
                  2.5 %    97.5 %
  (Intercept) 56.393267 68.295988
  ptratio     -2.477454 -1.836897
  </code></pre>
  <p>But notice that, despite the fact that I have explicitly specified <code>level = 0.95</code>, the output gives 2.5% and 97.5%.</p>
  <p>Furthermore, when I attempt to explicitly pass the variable as a parameter, I get the following error:</p>
  <pre><code>confint(lm.Boston, parm = ptratio, level = 0.95)
  
  Error in confint.lm(lm.Boston, parm = ptratio, level = 0.95) : object 'ptratio' not found
  </code></pre>
  <p>So what's wrong in these two cases?</p>
  <hr />
  <h2>EDIT</h2>
  <pre><code>confint(lm.Boston, parm = 'ptratio', level = 0.95)
  </code></pre>
  <p>works:</p>
  <pre><code>            2.5 %    97.5 %
  ptratio -2.477454 -1.836897
  </code></pre>