Learn R Programming

switchSelection (version 2.0.0)

boot: 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)

Value

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

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab