Regression - Diagnostic - Test Residual Heteroscedasticity extension
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 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 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
var __webpack_modules__ = ({});
// The module cache
var __webpack_module_cache__ = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
// Return the exports of the module
return module.exports;
}
// webpack/runtime/rspack_version
(() => {
__webpack_require__.rv = () => ("1.7.2")
})();
// webpack/runtime/rspack_unique_id
(() => {
__webpack_require__.ruid = "bundler=rspack@1.7.2";
})();
includeWeb("QScript R Output Functions");
const menu_location = "Regression > Diagnostic > Test Residual Heteroscedasticity";
errorIfExtensionsUnavailableInQVersion(menu_location);
createDiagnosticROutputFromSelection(menu_location);