bootlm {skedastic} | R Documentation |
Nonparametric Bootstrapping of Heteroskedastic Linear Regression Models
Description
Generates B
nonparametric bootstrap replications of a linear
regression model that may have heteroskedasticity.
Usage
bootlm(
object,
sampmethod = c("pairs", "wild"),
B = 1000L,
resfunc = c("identity", "hccme"),
fastfit = TRUE,
...
)
Arguments
object |
Either an object of class |
sampmethod |
A character, either |
B |
An integer representing the number of bootstrapped linear
regression models to generate; defaults to |
resfunc |
Either a character naming a function to call to apply a
transformation to the Ordinary Least Squares residuals, or a function
to apply for the same purpose. This argument is ignored if
|
fastfit |
A logical indicating whether the |
... |
Other arguments to pass to |
Details
Each replication of the pairs bootstrap entails drawing a sample
of size n
(the number of observations) with replacement from the
indices i=1,2,\ldots,n
. The pair or case (y_i, X_i)
is
included as an observation in the bootstrapped data set for each sampled
index. An Ordinary Least Squares fit to the bootstrapped data set is then
computed.
Under the wild bootstrap, each replication of the linear regression model
is generated by first independently drawing n
random values
r_i
, i=1,2,\ldots,n
, from a distribution with zero mean and
unit variance. The i
th bootstrap response is then computed as
X_i'\hat{\beta} + f_i(e_i) r_i
, where X_i
is the i
th
design observation, \hat{\beta}
is the Ordinary Least Squares
estimate of the coefficient vector \beta
, e_i
is the
i
th Ordinary Least Squares residual, and f_i(\cdot)
is a
function performing some transformation on the residual. An Ordinary
Least Squares fit is then computed on the original design matrix and the
bootstrap response vector.
Value
A list object of class "bootlm"
, containing B
objects,
each of which is a bootstrapped linear regression model fit by Ordinary
Least Squares. If fastfit
was set to TRUE
, each of these
objects will be a list containing named objects y
(the bootstrap
response vector), X
(the bootstrap design matrix, which is just
the original design matrix under the wild bootstrap), e
(the
residual vector from the Ordinary Least Squares fit to this bootstrap
data set), beta.hat
(the vector of coefficient estimates from the
Ordinary Least Squares fit to this bootstrap data set),
sampmethod
, and ind
(a vector of the indices from the
original data set used in this bootstrap sample; ignored under the
wild bootstrap)
of the kind returned by
lm.fit
; otherwise, each will be an object of class
"lm"
.
References
Davidson R, Flachaire E (2008).
“The Wild Bootstrap, Tamed at Last.”
Journal of Econometrics, 146, 162–169.
Efron B, Tibshirani RJ (1993).
An Introduction to the Bootstrap.
Springer Science+Business Media, Dordrecht.
See Also
paired.boot
and
wild.boot
for the pairs bootstrap and wild
bootstrap, respectively. The latter function does not appear to allow
transformations of the residuals in the wild bootstrap.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
mybootlm <- bootlm(mtcars_lm)