Perform unit root test on one quantitative variable. A single group factor can be taken into account.
unirootTest(x, group = NULL, time = NULL, data, test = "adf", combine = "choi",
k = 0, lshort = TRUE)The name of the quantitative variable to be tested.
The name of a group factor (optional). If NULL, no groups are considered.
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 temporally ordered.
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.
The test to use, that can be either "adf" (Augmented Dickey-Fuller, see Dickey and Fuller, 1981)
or "kpss" (KPSS, see Kwiatkowski et al., 1992). Default is "adf".
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".
The lag order to calculate the statistic of the Augmented Dickey-Fuller test. Ignored if test="kpss". Default is 0.
Logical. If TRUE, the short version of the truncation lag parameter is used in the KPSS test. Ignored if test="adf". Default is TRUE.
A list containing the following components:
The value of the test statistic.
The alternative hypothesis.
The z-value of the test.
The p-value of the test.
The test used.
The method used to combine p-values of different groups. NULL if group is NULL.
The number of observations per group.
I. Choi (2001). Unit Root Tests for Panel Data. Journal of International Money and Finance, 20, 249-272. DOI: 10.1016/S0261-5606(00)00048-6
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. DOI: 10.1111/j.1468-0084.2006.00181.x
D. A. Dickey, and W. A. Fuller (1981). Likelihood Ratio Statistics for Autoregressive Time Series with a Unit Root. Econometrica, 49: 1057-1072. DOI: 10.2307/1912517
D. Kwiatkowski, P. C. B. Phillips, P. Schmidt, and Y. Shin (1992). Testing the Null Hypothesis of Stationarity against the Alternative of a Unit Root. Journal of Econometrics, 54 (1-3): 159-178. DOI: 10.1016/0304-4076(92)90104-Y
# NOT RUN {
data(industry)
unirootTest("Job",group="Region",data=industry,k=1)
# }
Run the code above in your browser using DataLab