Download introduction to the R Project for Statistical Computing

Transcript
8.2311 9.9974 10.8010 16.3186 18.3800 ...
> residuals(model)
1
2
3
4
5 ...
2.068855 0.302589 -0.600998 0.081368 0.420047 ...
> formula(model)
Volume ~ Height * Girth
The results are best reviewed with the summary generic function, which
for linear models is specialized into summary.lm:
> summary(model)
Call:
lm(formula = Volume ~ Height * Girth, data = trees)
Residuals:
Min
1Q Median
-6.582 -1.067 0.303
3Q
1.564
Max
4.665
Coefficients:
(Intercept)
Height
Girth
Height:Girth
Estimate Std. Error t value Pr(>|t|)
69.3963
23.8358
2.91 0.00713
-1.2971
0.3098
-4.19 0.00027
-5.8558
1.9213
-3.05 0.00511
0.1347
0.0244
5.52 7.5e-06
Residual standard error: 2.71 on 27 degrees of freedom
Multiple R-Squared: 0.976,Adjusted R-squared: 0.973
F-statistic: 359 on 3 and 27 DF, p-value: <2e-16
This provides the most important information about the model; for more
insight consult textbooks which explain linear modelling, e.g. Venables &
Ripley [57], Fox [18], Christensen [4] or Draper & Smith [14]:
• The model formula with which lm was called;
• A summary of the residuals; by definition the mean is zero so is not
reported;
• The model coefficients (first column);
• The standard error associated with each coefficient (second column);
these can be used to construct confidence intervals;
• The significance level of each coefficient (third column); this is the
probability that rejecting the null hypothesis for the listed coefficient
would be a mistake;
• The residual standard error, which is defined as the square root of
P
the estimated variance of the random error: σ 2 = (1/(n−p))∗ (ri 2 )
where ri is one of the n residuals and p is the number of coefficients.
• The coefficient of determination R 2 , both the unadjusted fraction of
variance explained by the model R 2 = 1 − (Residual SS/Total SS) and
58