Description Usage Arguments Value References Examples
Computes a variance-covariance estimate for a set of linear contrasts Vβ 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.
1 | LOvcov(linmod, V)
|
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 |
LOvcov
returns a variance-covariance matrix for the linear contrasts Vβ, using
the variance estimator proposed in Kline, Saggio, and Sølvsten (2019).
Kline, Saggio, and Sølvsten (2019). Leave-out estimation of variance components. https://arxiv.org/abs/1806.01494
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.