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 "lm" (generated by lm), an object of class "alvm.fit" (generated by alvm.fit), or an object of class "anlvm.fit" (generated by anlvm.fit)

sampmethod

A character, either "pairs" or "wild", indicating the method to be used to generate the resampled models: bootstrapping pairs (Efron and Tibshirani 1993) or the wild bootstrap (Davidson and Flachaire 2008). Defaults to "pairs".

B

An integer representing the number of bootstrapped linear regression models to generate; defaults to 1000L

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 sampmethod is "pairs". The only two character values accepted are "identity", in which case no transformation is applied to the residuals, and "hccme", in which case the transformation corresponds to a heteroskedasticity-consistent covariance matrix estimator calculated from hccme. If resfunc is a function, it is assumed that its first argument is the numeric vector of residuals.

fastfit

A logical indicating whether the lm.fit function should be used to fit the bootstrapped regression models for greater computational speed; defaults to TRUE. This affects the class of the returned value (see below). If FALSE, lm is used to fit the bootstrapped regression models.

...

Other arguments to pass to hccme

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 ith bootstrap response is then computed as

X_i'\hat{\beta} + f_i(e_i) r_i

, where X_i is the ith design observation, \hat{\beta} is the Ordinary Least Squares estimate of the coefficient vector \beta, e_i is the ith 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)


[Package skedastic version 2.0.2 Index]