test_stat | R Documentation |
Under user-specified null hypotheses (multivariate or univariate) on the
endogeneous and exogeneous variables' coefficients, compute the test
statistic and p-value associated with a specified alpha
-level under
homoskedasticity or heteroskedasticity.
test_stat( beta_D_null, beta_X_null, alpha = 0.1, Y, X, D, Z, Phi = linear_projection(D, X, Z), tau, B = NULL, orthogonalize_statistic = FALSE, homoskedasticity = FALSE, a_hat = NULL, residuals = NULL, kernel = "Powell", show_progress = TRUE, print_results = TRUE, ... )
beta_D_null |
Vector of coefficients on the endogeneous variable under the null hypothesis; if a coefficient is not specified under the null, let the corresponding entry be NA (vector of length p_D with |J| non-zero entries) |
beta_X_null |
Vector of coefficients on the covariates under the null hypothesis; if a coefficient is not specified under the null, let the corresponding entry be NA (vector of length p_X with |K| non-zero entries) |
alpha |
Alpha level of the test; defaults to 0.1; only used when
|
Y |
Dependent variable (vector of length n) |
X |
Exogenous variable (including constant vector) (n by p_X matrix) |
D |
Endogenous variable (n by p_D matrix) |
Z |
Instrumental variable (n by p_Z matrix) |
Phi |
Transformation of X and Z to be used in the program; defaults to the linear projection of D on X and Z (matrix with n rows) |
tau |
Quantile (number between 0 and 1) |
B |
Matrix that enters numerator of test statistic (n by |J| + |K| matrix); If NULL (default), this matrix is (Phi_J, X_K), where Phi_J and X_K are the columns of Phi and X with indices J and K; |
orthogonalize_statistic |
If TRUE, \tilde{B} will be used in numerator of test statistic; defaults to FALSE; for advanced users only |
homoskedasticity |
If TRUE, assume density of error at 0 is constant; defaults to FALSE (boolean) |
a_hat |
Vector (n by 1) of dual variables; if NULL (default), use dual-variables from short-iqr regression |
residuals |
Residuals from IQR MILP program; if NULL (default), use residuals from short-iqr regression |
kernel |
Only active if |
show_progress |
If TRUE (default), sends progress messages during
execution (boolean); also passed to |
print_results |
If TRUE (default), print the test-statistic, p-value, and alpha level (boolean) |
... |
Arguments passed to |
For example, if beta_D_null = c(NA, 0, NA)
and beta_X_null =
c(1, NA)
, then β_{D,2} = 0 and β_{X,1} = 1 is the null
hypothesis.
Note that in this example, p_D is 3 and p_X is 2, which corresponds to the
lengths of the coefficient vectors.
Based on beta_D_null
, we find the vector J, which contains the
indices of the coefficients specified under the null.
We can then define D_J and Phi_J as the columns of D and Phi whose indices
are in J. Similarly, we can define D_J_minus and Phi_J_minus as the columns
of D and Phi whose indices are not in J. If J is the empty set, then D_J
and Phi_J should be thought of as being empty matrices without any
dimensions. If J specified all indices from 1 to p_D, then D_J_minus and
Phi_J_minus should be thought of as being empty. These conventions apply to
the vector K, which contains the indices of the coefficients on the
endogeneous variable specified uner the null.
If the test is univariate (i.e., |J| + |K| = 1), then the test statistic has a linear form. Otherwise, the test statistic has a quadratic form.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.