order_integration {bootUR}R Documentation

Determine Order of Integration


Determines the order of integration for each time series in a dataset via a sequence of unit root tests, and differences the data accordingly to eliminate stochastic trends.


order_integration(y, max_order = 2, test = NULL, plot_orders = FALSE, ...)



A (TxN)-matrix of N time series with T observations. Data may also be in a time series format (e.g. ts, zoo or xts) or data frame.


The maximum order of integration of the time series. Default is 2.


The unit root tests to be used in the procedure. For multiple time series the options are "iADFtest", "BSQTtest" and "bFDRtest", with "iADFtest" the default. For single time series the options are "boot_df" and "boot_union", with the latter the default.


Logical indicator whether the resulting orders of integration should be plotted. Default is FALSE.


Optional arguments passed to the chosen unit root test function.


The function follows the approach laid out in Smeekes and Wijler (2020), where all series is differenced d-1 times, where d is the specified maximum order, and these differenced series are tested for unit roots. The series foe which the unit root null is not rejected, are classified as I(d) and removed from consideration. The remaining series are integrated, and tested for unit roots again, leading to a classification of I(d-1) series if the null is not rejected. This is continued until a non-rejection is observed for all time series, or the series are integrated back to their original level. The series for which the null hypothesis is rejected in the final stage are classified as I(0).

Care must be taken when using BSQTtest when the argument q is given as a sequence of integers. As at each step series are removed, one may end up with fewer series to test than indicated in q. While integers larger than the number of series will automatically be removed - along with a warning - by the test, it is recommend to set q in the form of quantiles.

Plotting the orders of integration requires the ggplot2 package to be installed; plot will be skipped and a warning is given if not. For plots the function plot_order_integration is called. The user may prefer to set plot_orders = FALSE and call this function directly using the returned value of order_int in order to have more control over plot settings and save the plot object.


A list with the following components


A vector with the found orders of integration of each time series.


The appropriately differenced data according to order_int in the same format as the original data.


Smeekes, S. and Wijler, E. (2020). Unit roots and cointegration. In P. Fuleky (Ed.) Macroeconomic Forecasting in the Era of Big Data, Chapter 17, pp. 541-584. Advanced Studies in Theoretical and Applied Econometrics, vol. 52. Springer.


# Use iADFtest to determine the order of GDP_BE and GDP_DE
orders_iADFtest <- order_integration(MacroTS[, 1:2], test = "iADFtest", B = 199)

[Package bootUR version 0.2.0 Index]