boot {switchSelection}R Documentation

Bootstrap covariance matrix for least squares estimates of linear regression

Description

This function calculates bootstrapped covariance matrix for least squares estimates of linear regression. The estimates should be obtained via lm function.

Usage

boot(model, iter = 100)

Arguments

model

object of class lm.

iter

positive integer representing the number of bootstrap iterations.

Details

Calculations may take long time for high iter value.

Value

This function returns a bootstrapped covariance matrix of the least squares estimator.

Examples

set.seed(123)
# Generate data according to linear regression
n <- 20
eps <- rnorm(n)
x <- runif(n)
y <- x + eps
# Estimate the model
model <- lm(y ~ x)
# Calculate bootstrap covariance matrix
boot(model, iter = 50)

[Package switchSelection version 1.1.2 Index]