50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

dlsem (version 1.0)

unirootTest: Unit root test

Description

Perform unit root test on a numerical variable. A single group factor may be taken into account.

Usage

unirootTest(x, group = NULL, time = NULL, data, test = "adf", combine = "choi", k = 0)

Arguments

x
The name of the numerical variable to be tested.
group
The name of a group factor (optional). If NULL, no groups are considered.
time
The name of a time factor (optional). If NULL and group is not NULL, data are assumed temporally ordered within each group. If both group and time are NULL, data are assumed
data
An object of class data.frame containing the variables to be differenced, the group factor if group is not NULL, and the time factor if time is not NULL.
test
The test to use, that can be either "adf" (Augmented Dickey-Fuller, see Said and Dickey, 1984; Banerjee et al., 1993) or "kpss" (KPSS, see Kwiatkowski et al., 1992). Default is "adf".
combine
The method to combine p-values of different groups, that can be either "choi" (Choi, 2001) or "demetrescu" (Demetrescu, 2006). Ignored if group is NULL. Default is "choi".
k
The lag order to calculate the test statistic. Ignored if test="kpss". Default is 0.

Value

  • An object of class htest, containing the following components:
  • statisticThe value of the test statistic.
  • lag.orderThe lag order.
  • alternativeThe alternative hypothesis.
  • z.valueThe z-value of the test.
  • p.valueThe p-value of the test.
  • testThe test used.
  • combineThe method used to combine p-values of different groups. NULL if group is NULL.
  • nThe number of observations per group.

References

A. Banerjee, J. J. Dolado, J. W. Galbraith, and D. F. Hendry (1993). Cointegration, Error Correction, and the Econometric Analysis of Non-Stationary Data. Oxford University Press, Oxford, UK. I. Choi (2001). Unit Root Tests for Panel Data. Journal of International Money and Finance, 20, 249-272. M. Demetrescu, U. Hassler, and A. Tarcolea (2006). Combining Significance of Correlated Statistics with Application to Panel Data. Oxford Bulletin of Economics and Statistics, 68(5), 647-663. D. Kwiatkowski, P. C. B. Phillips, P. Schmidt, Y. Shin (1992). Testing the Null Hypothesis of Stationarity against the Alternative of a Unit Root. Journal of Econometrics, 54 (1-3): 159-178. S. E. Said, and D. A. Dickey (1984). Testing for Unit Roots in Autoregressive-Moving Average Models of Unknown Order. Biometrika, 71, 599-607.

See Also

applyDiff

Examples

Run this code
data(agres)
unirootTest("NPATENT",group="COUNTRY",data=agres,k=1)

Run the code above in your browser using DataLab