# test_base: The test statistic for the RE test with survey weights In RationalExp: Rationalizing Rational Expectations. Tests and Deviations

## Description

This is an internal function used in the function test to compute the test statistic with survey weights.

## Usage

 ```1 2``` ```test_base(Y_tilde, X, D, data_test, epsilon, B, N3, c, kappa, p, N, weights) ```

## Arguments

 `Y_tilde` the vector stacking the realisations y then the anticipated values psi of respective sizes n_y and n_p. `X` the matrix of covariates. Set to a vector of 1 by default (in which case the test without covariates is performed). `D` the vector stacking the dummies for the dataset of realisation : n_y ones then n_p zeros `data_test` the matrix of sample moments `epsilon` the parameter epsilonon inSection 3 `B` the number of bootstrap samples `N3` a parameter equal to 1 if no covariates, to N otherwise `c` the parameter c in Section 3 `kappa` the parameter kappapa in Section 3 `p` the parameter p in Section 3. Equals 0.0 if generalized RE test. `N` total number of observations `weights` the vector of survey weights. Uniform by default.

## Details

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 <c2><ab> generalized <c2><bb> 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.

## Value

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

## References

D<e2><80><99>Haultfoeuille X, Gaillac C, Maurel A (2018). <e2><80><9c>Rationalizing Rational Expectations? Tests and Deviations.<e2><80><9d> CREST Working paper

Andrews D, Shi X (2017). <e2><80><9c>Inference Based on Many Conditional Moment Inequalities.<e2><80><9d> Journal of Econometrics, 196(2), 275<e2><80><93>287.

Andrews DW, Kim W, Shi X (2017). <e2><80><9c>Commands for testing conditional moment inequalities and equalities.<e2><80><9d> The Stata journal, 17(1).

RationalExp documentation built on May 2, 2019, 2:07 a.m.