Streaming Koenker studentized Breusch\–Pagan test¶
Source: R/performance.R · Help: ?performKoenkerTestStreaming
Evaluates Koenker's studentized variant of the Breusch\–Pagan test (the \(n R^2\) statistic from regressing the squared residuals on the regressors) using streamed cross-products so that large datasets can be processed without allocating the full auxiliary regression matrix.
Usage¶
Arguments¶
model- A fitted stats::lm object supplying residuals and fitted values for the diagnostic.
data- A base::data.frame containing the variables referenced in
model. The data must align with the observations used to fit the model. 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). chunk_size- Positive integer giving the number of observations processed per streaming chunk.
progress- Logical flag indicating whether a textual progress bar should be shown
while processing the chunks. Defaults to
interactive().
Value¶
A htest object equivalent to performKoenkerTest with metadata
recording the streaming configuration.
Details¶
Chunks of the data contribute to the cross-product matrices for the regression of squared residuals on the model regressors. Aggregating these matrices yields the exact Koenker statistic while bounding memory usage. Sparse cross-products from Matrix are used automatically when available for large chunks.
See also¶
performKoenkerTest for the standard implementation.