10 - APM 1205 Linear Model
10 - APM 1205 Linear Model
𝜀^ =𝑦 − 𝑋 ^𝛽= y − ^
𝑦
Residual Analysis
Things to look into:
1. Normality of the Residuals
2. Homogeneity of the Residual Variance
3. Independency of the Residual Error Terms
Residual Analysis
Normality
Test:
Residual vs. Fitted Plot [plot function
plot(model,1)].
• For the normality assumption to
hold, the residuals should spread
randomly around 0 and form a
horizontal band.
• If the red trend line is approximately
flat and close to zero, then one can
assume that the residuals are
normally distributed
Residual Analysis
Normality
Test:
Q-Q Plot [plot function
plot(model,2)].
Homoscedasticity is the
situation in which the variance
of the residuals of a regression
model the same across all
values of the predicted variable
Residual Analysis
Heteroscedasticity
Test:
Q-Q Plot and Scale Location Plot
[plot function: plot(model,2) and
plot(model,3)].
If the test statistic (BP) is small and the p-value is not significant (i.e.,
>0.05), we do not reject the null hypothesis. Therefore, we assume
that the residuals are homoscedastic.
Residual Analysis
Independency of Error Term
Test:
White Test to Check Heteroscedasticity
This test checks whether the variance of the residuals depends on the value of the
independent variable
skedastic::white_lm(model)
If the Because the p-value is not significant (i.e., >0.05) we do not reject the null
hypothesis. Hence, we assume that the residuals are homoscedastic.
Residual Analysis
Autocorrelation of Error Terms
Recall
lm.influence(model)$hat)
X <- model$fitted.values
Manual construction
H <- X %*% solve(t(X) %*% X) %*% t(X)H
Detection
Cooks Distance
If are n – dimensional vectors and if there exists constants not all zero
such that then the vectors are linearly independent
Formally, the partial correlation between and given a set of n controlling variables ,
written , is the correlation between the residuals and resulting from the linear
regression of with and of with
Presence of multicollinearity
Multicollinearity
Primary Source of the Issue