Robust Breusch–Pagan test with bootstrap and effect sizes¶
Source: R/robust_implementations.R · Help: ?performBPTestRobust
Enhances performBPTest() by optionally studentising residuals, resampling the
test statistic via bootstrap, and reporting effect sizes together with power
diagnostics.
Usage¶
performBPTestRobust(
model,
data = NULL,
studentize = TRUE,
bootstrap = FALSE,
B = 999,
ci_level = 0.95,
parallel = FALSE,
studentized
)
Arguments¶
model- A fitted stats::lm object describing the mean structure whose residual variance is to be assessed.
data- A base::data.frame (or compatible object) containing the
variables referenced in
model. The data must include all observations used to fitmodeland should not contain unresolved missing values. WhenNULL, the default, the model frame ofmodelis used. It holds the terms of the model rather than its variables (log(x)rather thanx), so a model that transforms a variable needsdata, as does a model with anoffset()term, and so may a fit whoseweightsoroffsetargument is a column of the data, which the model frame holds as(weights)or(offset). studentize- Logical, use studentized residuals for the auxiliary
regression (Koenker variant)? Defaults to
TRUE. The name matcheslmtest::bptest()andperformHarveyTest(). bootstrap- Logical, compute bootstrap diagnostics for the
statistic and p-value? The bootstrap is
bootstrapTestStatistic(), so on a fit returned byfitWLS()each replicate estimates the weights again, its default since 0.15.0. There is no argument to hold them fixed here;bootstrapTestStatistic()withreestimate_weights = FALSEdoes that. B- Number of bootstrap replications when
bootstrap = TRUE. Defaults to 999, at which a bootstrap p-value of the form(1 + #) / (B + 1)gives an exact test at the 5% and 1% levels; it was 1000 before 0.15.0. The value is recorded inrobust_details$bootstrap$Bwhether or not the bootstrap runs. ci_level- Confidence level for reported intervals.
parallel- Logical, allow parallel bootstrap evaluation when the
parallelpackage is available. A seeded call gives the same result each time; see Parallel replicates inbootstrapTestStatistic(). studentized- Deprecated since 0.15.0: use
studentize. It is still accepted, with a warning, and does whatstudentizedoes; it stops working in 1.0.0.
Value¶
An augmented htest object containing a
robust_details element describing the additional diagnostics. Its
studentized field records the value of studentize.
Details¶
Offers expanded reporting for the Breusch–Pagan family of tests including
bootstrap p-values and asymptotic confidence intervals. The optional
studentize argument toggles between the classic and Koenker versions.
References¶
Breusch, T. S., & Pagan, A. R. (1979). A simple test for heteroscedasticity and random coefficient variation. Econometrica, 47(5), 1287–1294.
Koenker, R. (1981). A note on studentizing a test for heteroscedasticity. Journal of Econometrics, 17(1), 107–112.
See also¶
performBPTest() for the baseline test and performKoenkerTest() for the
standalone studentised variant.