Validating OLS
Validate data
Confirm the vectors are present, run the model using lm, extract
the residuals using residual...
Normality of the Residuals: Visual Verification

The residuals can be extracted as follows:

And the following plot is gen...
Upcoming SlideShare
Loading in...5
×

How to-run-ols-diagnostics-02

234

Published on

This document shows given two vectors Y,X and a linear regression model, how to validate three basic assumptions, all within R.

Published in: Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
234
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How to-run-ols-diagnostics-02

  1. 1. Validating OLS Validate data Confirm the vectors are present, run the model using lm, extract the residuals using residuals function. Confirming the residuals are normally distributed Since the p-value is more than 0.05, we cannot reject the null hypothesis. The null hypothesis for this test is the residuals are normally distributed. This is same as Anderson-Darling test. Confirming constant variance. The statistical “speak” for this is heteroskedascticity (which means variance is not constant). We run bptest, for which the null hypothesis is that the variance is constant (homoskedastic). Note that I have used bptest from lmtest package. Here again we will reject the null if p less than 0.05 The residuals do not exhibit constant variance. Confirming that there is no Serial or Auto Correlation Here again the p-value is less than 0.05 and therefore we reject the null hypothesis. The null hypothesis for this test is that there is no auto-correlation. To learn more about these tests, kindly visit wiki or bing it. Loading libraries as needed try require as shown. if require is not successful, then load the lmtest as follows and then re-run require command as above. Use Packages menu at the top to install a package.
  2. 2. Normality of the Residuals: Visual Verification The residuals can be extracted as follows: And the following plot is generated. If the points deviate from the line, then the points are not from Normal Distribution.

×