LOFtest: Test a hypothesis that imposes many restrictions in a linear...

Description Usage Arguments Value References Examples

View source: R/LOFtest.R

Description

Computes the leave-out F-test from Anatolyev and Sølvsten (2020) which performs a test of the null hypothesis Rβ = q in the linear regression model y = Xβ + ε. The test provides an adjustment to the usual critical value used with the F-test, and this adjustment makes the test robust to many restrictions and heteroskedasticity in the error terms. The test retains asymptotic validity even when the number of regressors and restrictions are proportional to sample size.

Usage

1
LOFtest(linmod, R, q, nCores = 1, size = 0.05)

Arguments

linmod

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

R

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

q

a vector of the hypothesized values for the linear combinations of the parameters .

nCores

an optional argument for users who want to use parallel processing to speed up computations.

size

the desired nominal size of the test. The standard is 5%.

Value

LOFtest returns the realized value of the usual F-statistic, the p-value corresponding to this realization when using the critical value function proposed in Anatolyev and Sølvsten (2020), and the critical value for the specificed size.

References

Anatolyev and Sølvsten (2020). Testing Many Restrictions Under Heteroskedasticity. https://arxiv.org/abs/2003.07320

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, 512 regressors,
## and a null hypothesis that imposes 384 restrictions on the model.

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
R <- cbind( matrix(0, 384, 128), diag(384))
q <- rep(0.002, 384)
linmod <- lm(y~X-1)

LOFtest(linmod, R, q)

## The null is not rejected at the 5\% level since the value of the
## F statistic is below the critical value returned by LOFtest.
## Relying on the usual critical value qf(.95,384,640-512)=1.279
## would incorrectly lead to a rejection of the null.

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