To
find the least-squares regression model, use the lm() command. From that
result, we can find the standard error.
We
will use the cholesterol data from Section 14.1, Table 1.
Age <- c(25, 25, 28, 32, 32, 32, 38, 42, 48, 51, 51, 58, 62, 65)
Total_Cholesterol <- c(180, 195, 186, 180, 210, 197, 239, 183, 204, 221, 243, 208, 228, 269)
Now,
find the least-squares regression model and use the summary() command.
lm_object <- lm(Total_Cholesterol ~ Age)
summary(lm_object)
##
## Call:
## lm(formula = Total_Cholesterol ~ Age)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.114 -13.405 -3.117 12.575 34.482
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 151.3537 17.2838 8.757 1.47e-06 ***
## Age 1.3991 0.3917 3.571 0.00384 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.48 on 12 degrees of freedom
## Multiple R-squared: 0.5153, Adjusted R-squared: 0.4749
## F-statistic: 12.76 on 1 and 12 DF, p-value: 0.003842
# NOTE: If you only want the standard error, enter the code
#
# summary(lm_object)$sigma
The
standard error is found under “Residual standard error”. So, the standard error
is 19.48.