Source: the reference implementation AR.test in the CRAN package ivmodel
(file R/AR.r), implementing Anderson, T. W. and Rubin, H. (1949), Annals of
Mathematical Statistics 20, 46-63. With temp = Y - beta0 D after the exogenous
covariates have been partialled out of Y, D and Z, Fstat = ||P_Z temp||^2 /
||M_Z temp||^2 * (n - k - L)/L and p = 1 - pf(Fstat, L, n - k - L).
Usage
Ivartest(y, X, Z, beta0 = 0, X_exog = NULL, add_intercept = TRUE)
Arguments
- y
Numeric outcome of length n.
- X
Numeric endogenous regressor of length n.
- Z
Numeric n x L matrix of instruments.
- beta0
Null value of the structural coefficient. Default 0.
- X_exog
Optional n x q matrix of included exogenous covariates.
- add_intercept
Include an intercept. Default TRUE.
Value
list: statistic, p_value, df1, df2, beta0, n, n_instruments,
method.