{smcl}
{* 19oct2004}{...}
{hline}
help for {hi:kpss}         (SSC distribution 25 June 2006)
{hline}

{title:Kwiatkowski-Phillips-Schmidt-Shin test for stationarity}

{p 8 17}{cmd:kpss}
{it:varname}
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}] 
[{cmd:,} {cmdab:maxlag(}#{cmd:)} {cmdab:not:rend} {cmd:qs} {cmd:auto}]

{p 4 4}{cmd:kpss} is for use with time-series data. varname may contain time-series operators; {cmd:help varlist}.
You must {cmd:tsset} your data before using {cmd:kpss}; see help {cmd:tsset}. 
{cmd:kpss} supports the {cmd:by} prefix, which may be used to operate on each 
time series in a panel. Alternatively, the {cmd:if} qualifier may be used to specify 
a single time series in a panel.


{title:Description}

{p 4 4}{cmd:kpss} performs the Kwiatkowski, Phillips, Schmidt, Shin (KPSS, 1992) 
test for stationarity of a time series. This test differs from those "unit root" tests in
common use (such as {cmd:dfuller}, {cmd:pperron} and {cmd:dfgls}) by having a null hypothesis
of stationarity. The test may be conducted under the null of either trend
stationarity (the default) or level stationarity. Inference from this test
is complementary to that derived from those based on the Dickey-Fuller
distribution (such as {cmd:dfuller}, {cmd:pperron} and {cmd:dfgls}). The KPSS test
is often used in conjunction with those tests to investigate the possibility
that a series is fractionally integrated (that is, neither I(1) nor I(0)):
see Lee and Schmidt (1996). As such, it is complementary to {cmd:gphudak}, {cmd:modlpr}
and {cmd:roblpr}.{p_end}

{p 4 4}
The test's denominator--an estimate of the long-run variance of the 
timeseries, computed from the empirical autocorrelation function--may 
be calculated using either the Bartlett kernel, as employed
by KPSS, or the Quadratic Spectral kernel. Andrews (1991) and Newey
and West (1994) indicate that the latter kernel yields more accurate 
estimates of sigma-squared than other kernels in finite samples." 
(Hobijn et al., 1998, p.6){p_end}

{p 4 4}
The maximum lag order for the test is by default calculated from the sample
size using a rule provided by Schwert (1989) using {it:c}=12 and {it:d}=4 in his
terminology. The maximum lag order may also be provided with the {cmd:maxlag}
option, and may be zero. If the maximum lag order is at least one, the test 
is performed for each lag, with the sample size held constant over lags 
at the maximum available sample. {p_end}

{p 4 4}
Alternatively, the maximum lag order (bandwidth) may be derived from an
automatic bandwidth selection routine, rendering it unnecessary to evaluate 
a range of test statistics for various lags. Hobijn et al. (1998) found
that the combination of the automatic bandwidth selection option and the 
Quadratic Spectral kernel yielded the best small sample test performance
in Monte Carlo simulations.{p_end}

{p 4 4}
Approximate critical values for the KPSS test are taken from KPSS, 1992.{p_end}

{p 4 4}
The KPSS test statistic for each lag is placed in the return array.{p_end}

{title:Options}

{cmdab:maxlag(}#{cmd:)} specifies the maximum lag order to be used in calculating the 
test. If omitted, the maximum lag order is calculated as described above.

{cmdab:not:rend} indicates that level stationarity, rather than trend stationarity,
is the null hypothesis.

{cmd:qs} specifies that the autocovariance function is to be weighted by the 
Quadratic Spectral kernel, rather than the Bartlett kernel.

{cmd:auto} specifies that the automatic bandwidth selection procedure proposed by
Newey and West (1994) as described by Hobijn et al. (1998, p.7) is used to
determine {cmd:maxlag}. In that case, a single value of the test statistic is
produced, at the optimal bandwidth.

{title:Examples}

{p 4 8}{stata "use http://fmwww.bc.edu/ec-p/data/macro/nelsonplosser.dta":. use http://fmwww.bc.edu/ec-p/data/macro/nelsonplosser.dta}{p_end}
	
{p 4 8}{stata "kpss lrgnp":. kpss lrgnp}{p_end}

{p 4 8}{stata "kpss D.lrgnp, maxlag(8) notrend":. kpss D.lrgnp, maxlag(8) notrend}{p_end}
	
{p 4 8}{stata "kpss lrgnp if tin(1910,1970)":. kpss lrgnp if tin(1910,1970)}{p_end}
	
{p 4 8}{stata "kpss lrgnp, qs auto":. kpss lrgnp, qs auto}{p_end}


{title:Author}

{p 4 4}Christopher F. Baum, Boston College, USA{break} 
       baum@bc.edu
       
{title:References}
      
{p}Andrews, D.W.K.  Heteroskedasticity and Autocorrelation Consistent
Covariance Matrix Estimation. Econometrica, 59, 1991, 817-858.{p_end}

{p}Hobijn, Bart, Franses, Philip Hans, and Marius Ooms. 1998. Generalizations
of the KPSS-test for Stationarity. Econometric Institute Report 9802/A, 
Econometric Institute, Erasmus University Rotterdam. {p_end}
http://www.eur.nl/few/ei/papers

{p}Kwiatkowski, D., Phillips, P.C.B., Schmidt, P. and Y. Shin. Testing the
null hypothesis of stationarity against the alternative of a unit root:
How sure are we that economic time series have a unit root? Journal of
Econometrics, 54, 1992, 159-178.{p_end}

{p}Lee, D. and P. Schmidt. On the power of the KPSS test of stationarity 
against fractionally-integrated alternatives. Journal of Econometrics,
73, 1996, 285-302.{p_end}

{p}Newey, W.K. and K.D. West. Automatic Lag Selection in Covariance
Matrix Estimation. Review of Economic Studies, 61, 1994, 631-653.{p_end}

{p}Schwert, G.W. Tests for Unit Roots: A Monte Carlo Investigation. Journal of
Business and Economic Statistics, 7, 1989, 147-160.{p_end}


{title:Acknowledgements}

A version of this code written in the RATS programming language by
John Barkoulas served as a guide for the development of the Stata code.
Thanks to Richard Sperling for suggesting its validation against the 
Nelson-Plosser data (KPSS, 1992, Table 5).


{title:Also see}

{p 4 13}On-line: {help dfuller}, {help pperron}, {help time}, {help tsset}, 
{help dfgls}, {help gphudak} (if installed), {help modlpr} (if 
installed), {help roblpr} (if installed){p_end}
