morie_breusch_pagan tests for heteroskedasticity (Koenker's
studentised form, as lmtest::bptest); morie_durbin_watson gives
the first-order autocorrelation statistic, roughly 2(1 - rho);
morie_vif gives variance inflation factors 1/(1 - R_j^2), where
a value above about 10 means that coefficient's variance is inflated
an order of magnitude by collinearity.
Examples
if (requireNamespace("sandwich", quietly = TRUE)) {
N <- 40
X1 <- sapply(0:(N - 1), function(i) ((i * 7)%%13) + 0.5 * ((i *
3)%%5))
X2 <- sapply(0:(N - 1), function(i) ((i * 5)%%11) - 0.25 * ((i *
2)%%7))
E <- sapply(0:(N - 1), function(i) ((i * 13)%%17)/17 - 0.5)
Y <- 3 + 1.5 * X1 - 0.8 * X2 + E * (1 + 0.05 * X1)
X <- cbind(X1, X2)
FIT <- morie_ols(Y, X)
morie_breusch_pagan(FIT)
}
#> $statistic
#> [1] 0.7927511
#>
#> $df
#> [1] 2
#>
#> $p_value
#> [1] 0.672754
#>
#> $studentised
#> [1] TRUE
#>
