0
$\begingroup$

Lets say I fit a linear model (in R), of y ~ x:

x <- runif(100,0,5)
y <- x*0.5 + rnorm(length(x))
summary(lm(y~x))

The summary output returned is:

Call:
lm(formula = y ~ x)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.4815 -0.6413  0.1720  0.6167  3.1338 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.27168    0.20488  -1.326    0.188    
x            0.61228    0.07341   8.341 4.73e-13 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.037 on 98 degrees of freedom
Multiple R-squared:  0.4152,    Adjusted R-squared:  0.4092 
F-statistic: 69.57 on 1 and 98 DF,  p-value: 4.725e-13

The output reports standard errors of regression parameters. However, I am looking to make predictions using this model, and would like to propagate parameter uncertainty as I do so, sampling from the parameter distributions. While in general I can convert SE to SD by multiplying the SE by the square root of the sample size, (sd = se * sqrt(n)), its not clear what the sample size I should use here is. The number of observations? The number of degrees of freedom?

$\endgroup$
  • $\begingroup$ If you are trying to get a prediction interval out of it there is an argument for that in lm. $\endgroup$ – user2974951 Jan 24 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.