Learn R Programming

olsrr (version 0.4.0)

ols_score_test: Score Test for heteroskedasticity

Description

Test for heteroskedasticity under the assumption that the errors are independent and identically distributed (i.i.d.).

Usage

ols_score_test(model, fitted_values = TRUE, rhs = FALSE, vars = NULL)

Arguments

model

an object of class lm

fitted_values

logical; if TRUE, use fitted values of regression model

rhs

logical; if TRUE, specifies that tests for heteroskedasticity be performed for the right-hand-side (explanatory) variables of the fitted regression model

vars

variables to be used for for heteroskedasticity test

Value

ols_score_test returns an object of class "ols_score_test". An object of class "ols_score_test" is a list containing the following components:

score

f statistic

p

p value of score

df

degrees of freedom

fv

fitted values of the regression model

rhs

names of explanatory variables of fitted regression model

resp

response variable

preds

predictors

References

Breusch, T. S. and Pagan, A. R. (1979) A simple test for heteroscedasticity and random coefficient variation. Econometrica 47, 1287<U+2013>1294.

Cook, R. D. and Weisberg, S. (1983) Diagnostics for heteroscedasticity in regression. Biometrika 70, 1<U+2013>10.

Koenker, R. 1981. A note on studentizing a test for heteroskedasticity. Journal of Econometrics 17: 107<U+2013>112.

Examples

Run this code
# NOT RUN {
# model
model <- lm(mpg ~ disp + hp + wt, data = mtcars)

# using fitted values of the model
ols_score_test(model)

# using predictors from the model
ols_score_test(model, rhs = TRUE)

# specify predictors from the model
ols_score_test(model, vars = c('disp', 'wt'))
# }

Run the code above in your browser using DataLab