*! version 1.0.0 March 3, 2013 @ 14:32:43
help genstest (SJ13-4: st0320)

Title

genstest -- Perform generalized S tests for models in the
generalized method of moments framework

Syntax

genstest [(residual)] [if] [weight]
[, instruments(varlist [, noconstant])
derivative(/name = [<]dexp[>])
twostep
igmm
init(numlist)
null(numlist|last)
test(namelist)
sb
stab
winitial(iwtype)
wmatrix(wmtype)
center
small
trim(#)
nuisS
varS
ci(ci_options)]

Description

genstest implements four types of generalized S tests: the average
(ave-) S test, the exponential (exp-) S test, the supremum (sup-) S test, and
the quasi local level (qLL-) S test. The first three tests are here referred
to collectively as the "single-break" tests because each is derived under the
assumption that there is a single-break date in the data-generating process
for the endogenous variables. The fourth test, the qLL-S test, is derived by
assuming that the instability of the moments is described as a difference
martingale sequence.

genstest may be invoked both as a stand-alone command or as
a postestimation command for gmm. When used as a postestimation
command, it will use all the gmm options that genstest
supports.

Options

Testing options

instruments(varlist[, noconstant])
specifies the vector of instruments. The optional noconstant
indicates removal of a constant from the matrix of instruments.

derivative(/name = [<]dexp[>])
specifies the derivative of a residual function with respect to the
parameter name. The functionality of this option requires entering all
untested parameter derivatives; otherwise, derivatives in the optimization
algorithm will be computed numerically. The use of this option is recommended
when estimating confidence intervals and sets because it improves the
performance of the optimization algorithm and the computational speed (see
ci() option). This option is specified as in gmm with the
addition that the <>'s indicate the value of a parameter tested under
the null hypothesis. If one is using genstest as a postestimation
command, the derivatives passed to gmm will be used by genstest.

twostep requires the two-step general method of moments estimator be
used (this is the default).

igmm requires the iterated general method of moments estimator be used.

init(numlist) sets the initial values in the optimization routine for
estimating the nuisance parameters. The default choice is a vector of zeros.
One should include this option if the algorithm for estimating untested
parameters does not converge, if it converges to a local minimum, or if the
residual expression is undefined at the zero vector.

null(numlist|last) specifies the null hypothesis
vector for tested parameters (a zero vector by default). It must be specified
in the order the parameters appear in the residual. The special value
last indicates using the parameter estimates from gmm.

test(namelist) lists the names of the gmm parameters in the
residual expression to be tested. This option is only applicable if
genstest is being used as a postestimation command.

sb reports the ave-, exp-, and sup-S tests (the single-break
tests). These are computationally more intensive than the qLL-S test and
therefore not computed by default.

stab reports the stability tests (the S-tilde tests).

winitial(iwtype) specifies the initial weighting matrix for
estimating the untested parameters. There are two options for this
matrix: identity, which uses the identity matrix or (Z'Z), and
unadjusted, which sets (Z'Z) as the initial weight matrix. The
default is winitial(unadjusted).

wmatrix(wmtype) allows the choice of the covariance matrix. The choices
are the following:

unadjusted for the homoskedastic case.

robust, hc1, hc2, hc3, and hc4
specify a weight matrix robust to heteroskedasticity with four
possible adjustments. The default is wmatrix(hc1).

cluster clustvar for a cluster-robust covariance
matrix having the cluster variable defined in clustvar.

hac kernel [lags] specifies a weight matrix
robust to autocorrelation and heteroskedasticity. The possible choices for
kernel are bartlett, nwest, parzen, gallant,
quadraticspectral, or andrews. lags may be optimal to
use the optimal lag selection algorithm of Newey and West (1994),
automatic to set the number of lags to the starting value of the optimal
lag selection algorithm, or number, which is any positive integer.

center indicates recentering the moment function when
computing the heteroskedastic and autocorrelated estimate of the
variance.

small indicates using a small-sample adjustment when
computing the heteroskedastic and autocorrelated weight matrix.

Single-break options

trim(#) specifies the value of the trimming parameter, s.
The sample will be initially split at (sT), where T is the number of
observations. The possible values are 0.05, 0.10, 0.15, and 0.20. The
default is trim(0.15).

nuisS uses the full-sample estimate of the nuisance parameters for the
split-sample tests.

varS uses the full-sample weight matrix when estimating the nuisance
parameters.

Confidence interval

ci(ci_options) indicates that a confidence interval or set be estimated.

The following are ci_options:

numlist specifies the range over which to test the parameters for
up to two tested parameters.

points(numlist) determines the number of equally spaced points for the
grid search. The default is points(20) for confidence intervals and
points(20 20) for confidence sets.

alpha(#) determines the 1 - alpha coverage probability of the interval
or set. The default is alpha(0.05).

allpv tells genstest to return p-values for all points
tested in the selected range. Therefore, if one wishes to examine the
confidence interval (set) for a different significance level, there is
no need to execute the command a second time.

autograph tells genstest to automatically graph the
confidence region if two parameters are being tested. Whether or not
this option is specified, the points necessary to plot the confidence
region are stored in matrices.

Example as a stand-alone command

Examine confidence set for rho and theta, the
price-indexation parameter and the price-stickiness parameter in the new
Keynesian Phillips curve

. use nkpc_gmm

. generate time = _n

. tsset time

. generate dinf = inf - L.inf

. genstest (dinf - - (1/(1 + ))*(F.inf - L.inf) -(((1 - <th>)^2)/(<th> * (1 + )))*ls) if time >= 50, inst(L.dinf L.ls L2.ls L3.ls L2.dinf) wmat(hac nwest optimal) center null(0.7) ci(0.3 1.0, points(20))

Example as a postestimation command for gmm

Below is the same example using genstest as a postestimation
command

. gmm (dinf - - (1/(1 + ))*(F.inf - L.inf) -(((1 - )^2)/( * (1 + )))*ls) if time >= 50, inst(L.dinf L.ls L2.ls L3.ls L2.dinf) wmat(hac nwest optimal) center

. genstest, null(last) test(th) ci(0.3 1.0, points(20))

Stored results

genstest stores the following in r():

Scalars

r(S) S statistic

r(aveS) ave-S statistic

r(expS) exp-S statistic

r(supS) sup-S statistic

r(qllS) qLL-S statistic

r(avestabS) ave-stab-S statistic

r(expstabS) exp-stab-S statistic

r(supstabS) sup-stab-S statistic

r(qllstabS) qLL-stab-S statistic

r(pS) S statistic p-value

r(paveS) ave-S p-value

r(pexpS) exp-S p-value

r(psupS) sup-S p-value

r(pqllS) qLL-S p-value

r(pavestabS) ave-stab-S p-value

r(pexpstabS) exp-stab-S p-value

r(psupstabS) sup-stab-S p-value

r(pqllstabS) qLL-stab-S p-value

Matrices

r(Sci)
grid search points not rejected by the S test or search points and their associated p-values (if allpv is specified)

r(aveSci)
grid search points not rejected by the ave-S test or search points and their associated p-values

r(expSci)
grid search points not rejected by the exp-S test or search points and their associated p-values

r(supSci)
grid search points not rejected by the sup-S test or search points and their associated p-values

r(qllSci)
grid search points not rejected by the qLL-S test or search points and their associated p-values

r(avestabSci)
grid search points not rejected by the ave-stab-S test or search points and their associated p-values

r(expstabSci)
grid search points not rejected by the exp-stab-S test or search points and their associated p-values

r(supstabSci)
grid search points not rejected by the sup-stab-S test or search points and their associated p-values

r(qllstabSci)
grid search points not rejected by the qLL-stab-S test or search points and their associated p-values

Reference

Newey, W. K., and K. D. West. 1994. Automatic lag selection in
covariance matrix estimation. Review of Economic Studies 61: 631-653.

Authors

Zachary L. Flynn

University of Wisconsin-Madison

Madison, WI

zflynn@wisc.edu

Leandro M. Magnusson

University of Western Australia

Crawley, Australia

leandro.magnusson@uwa.edu.au

Also see

Article: Stata Journal, volume 13, number 4: st0320