LOvcov: Variance-covariance estimator that is robust to...

Description Usage Arguments Value References Examples

View source: R/LOvcov.R

Description

Computes a variance-covariance estimate for a set of linear contrasts in the regression model y = Xβ + ε using the leave-out estimator from Kline, Saggio, and Sølvsten (2019). The leave-out estimator provides a variance estimator which is asymptotically valid under many regressors and unrestricted heteroskedasticity.

Usage

1
LOvcov(linmod, V)

Arguments

linmod

an object of class "lm" that stems from fitting the regression model y = Xβ + ε.

V

a matrix specifying the linearly independent restrictions on the parameters. The number of rows in V is equal to the number of contrasts and the number of columns in V must be equal to the dimension of β.

Value

LOvcov returns a variance-covariance matrix for the linear contrasts , using the variance estimator proposed in Kline, Saggio, and Sølvsten (2019).

References

Kline, Saggio, and Sølvsten (2019). Leave-out estimation of variance components. https://arxiv.org/abs/1806.01494

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## An example of a regression with 640 observations and 512 regressors
## where the last three coefficients are of interest.
set.seed(1)
X <- cbind(1, (0.5+runif(640))*matrix(exp(rnorm(640*511)), 640,511))
y <- X %*% c( -.5, rep(0.002,511) ) + rnorm(640)*.3*rowMeans(X)^2
V <- cbind( matrix(0, 3, 509), diag(3))
linmod <- lm(y ~ X-1)

vcov <- LOvcov(linmod, V)

## Coefficients and standard errors of interest
coeff <- V %*% linmod$coefficients
cbind(coeff,sqrt(diag(vcov)))

## P-value for joint significance test
1-pchisq( t(coeff) %*% solve(vcov) %*% coeff, df=3)

mikkelsoelvsten/manyRegressors documentation built on Dec. 6, 2020, 6:23 a.m.