0
$\begingroup$

I am working with a pretty simple linear regression model, in which I was asked to work with confidence intervals instead of p-values (classic) The thing is I was trying two approaches to get confidence intervals, both of them reported in multiple places.

The confint function calculates confidence intervals for the coefficients of the regression model using the Student's t-distribution.

On the other hand, the get_CI function, a manual function created ad_hoc to calculate confidence intervals by multiplying the standard error of the coefficient by 1.96, which is the critical value corresponding to a 95% confidence level in a standard normal distribution. This provides symmetric and approximate confidence intervals based on the assumption of a normal distribution for the model coefficients.

I mostly understand the origin of the different calculations (std dev or standard error) but I cannot see the reasoning why should I pick one over the other, or if there are big differences between them (in my case, intervals are pretty much the same)

get_CI <- function(model) {
  summary_model <- summary(model)
  df <- summary_model$df[1]
  t_value <- qt(1 - 0.05/2, df)
  coeffs <- summary_model$coefficients[, 1]
  se <- summary_model$coefficients[, 2]
  lower <- coeffs - t_value * se
  upper <- coeffs + t_value * se
  CI <- cbind(lower, upper)
  rownames(CI) <- rownames(summary_model$coefficients)
  return(CI)
}

Edit 1: Sorry about the misleading information about the asymmmetry of the confidence intervals. Appreciate the insight and the math demonstration But still, the question holds around the confidence intervals extraction, whether in a linear regression model with an n around 40-50. Which are the reasons to opt for one option or the other?

$\endgroup$
4
  • 1
    $\begingroup$ can you tell us what you mean when you say that the intervals motivated by the t-distribution are assymetric? $\endgroup$ Apr 11 at 16:01
  • $\begingroup$ If $Y_i = \alpha+\beta x_i + \varepsilon_i$ and $\varepsilon_i$ for $i=1,\ldots,n$ are i.i.d. $\operatorname N(0,\sigma^2)$ and $\widehat\beta$ is the least-squares estimator of $\beta,$ then $\widehat\beta\sim\operatorname N(\beta,\, \sigma^2/\sum_{i=1}^n (x_i-\overline x)^2$ where $\overline x=(x_1+\cdots + x_n)/n.$ Consequently $$ \frac{\widehat\beta-\beta}{\sigma\left/\sqrt{\sum_{i=1}^n (x_i-\overline x)^2} \right.} \sim \operatorname N(0,1). $$ Letting $\widehat \sigma^{\,2}$ be the sum of squares of residuals divided by $n-2,$ we then have$\,\ldots\qquad$ $\endgroup$ Apr 11 at 16:44
  • 1
    $\begingroup$ $$\frac{\widehat\beta-\beta}{ \widehat\sigma\left/\sqrt{\sum_{i=1}^n (x_i-\overline x)^2} \right.} $$ has a Student's t distribution with $n-2$ degrees of freedom. So $$ \widehat\beta \pm {\blacksquare \cdot \frac{\widehat\sigma}{\sqrt{ \sum_{i=1}^n (x_i-\overline x)^2 }}} $$ are the endpoints of a confidence interval for $\beta$, where $\blacksquare$ is the appropriate quantile of Student's distribution with $n-2$ degrees of freedom. That confidence interval is symmetric about $\widehat\beta.$ What do you have in mind when you call it asymmetric? $\endgroup$ Apr 11 at 16:46
  • $\begingroup$ The distinction between SD and SE is fundamental and is not at all related to the two calculations you describe. Except in an idealized situation, both procedures are approximate and both are valid depending on how well those approximations might apply to your situation. $\endgroup$
    – whuber
    Apr 22 at 18:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.