test_stat: Compute the test statistic and p-value under strong...

View source: R/test_stat.R

test_statR Documentation

Compute the test statistic and p-value under strong identification

Description

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.

Usage

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,
  ...
)

Arguments

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 homoskedasticity is FALSE (numeric between 0 and 1)

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 homoskedasticity is FALSE; either "Powell" (default) to use the Powell estimator or "Gaussian" to use a Gaussian kernel; only used when homoskedasticity is FALSE

show_progress

If TRUE (default), sends progress messages during execution (boolean); also passed to preprocess_iqr_milp

print_results

If TRUE (default), print the test-statistic, p-value, and alpha level (boolean)

...

Arguments passed to preprocess_iqr_milp

Details

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.


omkarakatta/ivqr documentation built on Aug. 20, 2022, 11:04 p.m.