This is an internal function used in the function test to compute the test statistic with survey weights.
test_base(Y_tilde, X, D, data_test, epsilon, B, N3, c, kappa, p, N,
weights)
the vector stacking the realisations y then the anticipated values psi of respective sizes n_y and n_p.
the matrix of covariates. Set to a vector of 1 by default (in which case the test without covariates is performed).
the vector stacking the dummies for the dataset of realisation : n_y ones then n_p zeros
the matrix of sample moments
the parameter epsilonon inSection 3
the number of bootstrap samples
a parameter equal to 1 if no covariates, to N otherwise
the parameter c in Section 3
the parameter kappapa in Section 3
the parameter p in Section 3. Equals 0.0 if generalized RE test.
total number of observations
the vector of survey weights. Uniform by default.
a list containing, in order:
- T_n : the test statistic
- phi_n: the vector of coresponding GMS functions
- M_bar : the matrix of M_bar in Section 3
By default, the test is implemented without covariates. To perform the test with covariates, one has to indicate in X a non-constant vector or matrix. Also, one can perform the <U+00AB> generalized <U+00BB> tests allowing for aggregate shocks by using the dummy variable generalized. Survey weights can be added. The user can modify the number of cores used by R to reduce the computational time. Tuning parameters used in the test can also be modified.
D<U+2019>Haultfoeuille X, Gaillac C, Maurel A (2018). <U+201C>Rationalizing Rational Expectations? Tests and Deviations.<U+201D> CREST Working paper
Andrews D, Shi X (2017). <U+201C>Inference Based on Many Conditional Moment Inequalities.<U+201D> Journal of Econometrics, 196(2), 275<U+2013>287.
Andrews DW, Kim W, Shi X (2017). <U+201C>Commands for testing conditional moment inequalities and equalities.<U+201D> The Stata journal, 17(1).