Unit root test is performed on a set of quantitative variables. A single group factor may be taken into account.
unirootTest(x = NULL, group = NULL, time = NULL, data, test = NULL, log = FALSE)
A vector including the name of the quantitative variables to be tested.
If NULL
(the default), all the quantitative variables contained in data
will be tested.
The name of the group factor (optional). If NULL
, no groups are considered.
The name of the time factor (optional). This variable must be either a numeric identificative or a date in format '%Y/%m/%d','%d/%m/%Y', or '%Y-%m-%d'. If time
is NULL
and group
is not NULL
, data are assumed to be temporally ordered within each group.
If both time
and group
are NULL
, data are assumed to be temporally ordered.
An object of class data.frame
containing the variables to be tested,
the group factor if group
is not NULL
, and the time factor if time
is not NULL
.
The test to apply, that may be either "kpss"
(Kwiatkowski, 1992) or "adf"
(Dickey \& Fuller, 1981).
If NULL
(the default), the choice is for the KPSS test if the number of periods is less than 100, otherwise the ADF test is used.
Logical. If TRUE
, logarithmic transformation is applied to all strictly positive quantitative variables. Default is FALSE
.
An object of class unirootTest
, consisting of a list with one component for each variable tested. Each list contains the following components:
The value of the test statistic.
The lag order at which the test statistic is computed. It is automatically selected according to the precedure by Ng \& Perron (2001).
The total number of observations if group
is NULL
, otherwise the number of observations per group.
The z-value of the test.
The p-value of the test.
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.
S. Ng, and W. P. Perron (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 60: 1519-1554. DOI: 10.1111/1468-0262.00256.
# NOT RUN {
data(industry)
indus.urt <- unirootTest(c("Job","Consum","Population","GDP"),
group="Region",time="Year",data=industry,log=TRUE)
indus.urt ## p-values
indus.urt$Job ## details for variable 'Job'
# }
Run the code above in your browser using DataLab