Regression - Diagnostic - Test Residual Heteroscedasticity extension

From Q
Jump to: navigation, search


Conduct a heteroscedasticity test on the residuals

Test for heteroscedasticity (non-constant variance) in the residuals of linear regression models. Also known as the Breusch-Pagan test. The null hypothesis of the test is homoscedasticity. You must select an output from Regression - Linear Regressionlinear regression to use this feature. See this blog post for an introduction to heteroscedasticity.

Example

The following table shows the output from running this QScript on an output from Regression - Linear Regressionlinear regression.

Acknowledgements

Uses the ncvTest function from the car package.

References

Breusch, T. S. and Pagan, A. R. (1979) A simple test for heteroscedasticity and random coefficient variation. Econometrica 47, 1287--1294.

Bock, T. (2018, August 9). What is heteroscedasticity? [Blog post]. Retrieved from https://www.displayr.com/what-is-heteroscedasticity/.

Code

includeWeb("QScript R Output Functions");

const menu_location = "Regression > Diagnostic > Test Residual Heteroscedasticity";
errorIfExtensionsUnavailableInQVersion(menu_location);
createDiagnosticROutputFromSelection(menu_location);