| Title: | Bayesian Unit Root Test for Panel Data Models |
|---|---|
| Description: | Implements the Bayesian unit root test for Panel Autoregressive (PAR) time series models developed by Kumar et al. (2016) <https://hdl.handle.net/10419/179393>. The package evaluates the unit root hypothesis (difference stationarity versus trend stationarity) in panel data using the Posterior Odds Ratio (POR). It accommodates PAR models with linear time trend as well as linear time trend with augmentation terms of arbitrary order. Full posterior probabilities, Bayes factors, and individual panel estimates are computed automatically. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-10-06 10:15:16 UTC |
| Source: | https://github.com/cran/BayesPanelUR |
Implements the Bayesian unit root test for Panel Autoregressive (PAR) time series models developed by Kumar et al. (2016) <https://hdl.handle.net/10419/179393>. The package evaluates the unit root hypothesis (difference stationarity versus trend stationarity) in panel data using the Posterior Odds Ratio (POR). It accommodates PAR models with linear time trend as well as linear time trend with augmentation terms of arbitrary order. Full posterior probabilities, Bayes factors, and individual panel estimates are computed automatically.
The main function of the package is bayes_panel_ur, which performs the Bayesian panel unit root test and computes posterior odds ratios, Bayes factors, and structural parameter estimates.
Shikhar Tyagi, Arvind Pandey, Bhupendra Singh, Vrijesh Tripathi
Maintainer: Shikhar Tyagi <[email protected]>
Kumar, J., Chaturvedi, A., & Afifa, U. (2016). Bayesian unit root test for panel data. EERI Research Paper Series, No. 14/2016, Economics and Econometrics Research Institute (EERI), Brussels. <https://hdl.handle.net/10419/179393>
Levin, A., Lin, C. F., & Chu, C. S. J. (2002). Unit root tests in panel data: asymptotic and finite-sample properties. Journal of Econometrics, 108(1), 1-24.
Im, K. S., Pesaran, M. H., & Shin, Y. (2003). Testing for unit roots in heterogeneous panels. Journal of Econometrics, 115(1), 53-74.
Evaluates the unit root hypothesis for panel data autoregressive (PAR) models using the Bayesian Posterior Odds Ratio (POR) approach of Kumar et al. (2016).
bayes_panel_ur( data, id = NULL, time = NULL, y = NULL, trend = TRUE, p = 0, a = 0.999, vtheta = 1, p0 = 0.5, lower = 0, upper = 0.9999 )bayes_panel_ur( data, id = NULL, time = NULL, y = NULL, trend = TRUE, p = 0, a = 0.999, vtheta = 1, p0 = 0.5, lower = 0, upper = 0.9999 )
data |
A numeric matrix (T x n), wide data.frame, or long data.frame containing panel time series data. |
id |
Character string or column index for cross-sectional unit identifier (if data is in long format). |
time |
Character string or column index for time period identifier (if data is in long format). |
y |
Character string or column index for dependent variable (if data is in long format). |
trend |
Logical. If |
p |
Non-negative integer specifying the order of augmentation terms (lagged differences). Default is 0. |
a |
Numeric bound parameter specifying the alternative hypothesis domain |
vtheta |
Numeric prior hyperparameter |
p0 |
Numeric prior probability of the null hypothesis |
lower |
Numeric lower integration limit for |
upper |
Numeric upper integration limit for |
The function computes the Posterior Odds Ratio (POR) for testing the panel unit root hypothesis:
under a Panel Autoregressive PAR(1) process with cross-sectional heterogeneity in drift and trend,
as well as optional augmentation terms of order p.
The posterior odds ratio is calculated via exact 1D numerical integration of the marginal posterior integrand.
The posterior probability of the null hypothesis serves as the Bayesian p-value.
An S3 object of class "bayes_panel_ur" containing:
statistic |
The test statistic value (Posterior Odds Ratio |
p.value |
The posterior probability of the null hypothesis |
bayes_factor |
Bayes factor |
bf10 |
Bayes factor |
prob_H0 |
Posterior probability of difference stationarity |
prob_H1 |
Posterior probability of trend stationarity |
rho_hat |
Estimated AR coefficient |
se_rho |
Standard error of |
method |
Character string describing the test method. |
data.name |
Character string giving the name of the dataset. |
estimates |
Data frame containing unit-specific structural parameter estimates. |
grid |
Data frame containing |
parameter |
List of input hyperparameter settings. |
Kumar, J., Chaturvedi, A., & Afifa, U. (2016). Bayesian unit root test for panel data. EERI Research Paper Series, No. 14/2016, Economics and Econometrics Research Institute (EERI), Brussels. <https://hdl.handle.net/10419/179393>
set.seed(123) # Generate stationary panel data (T = 30, n = 3) T_len <- 30 n <- 3 y_mat <- matrix(0, nrow = T_len, ncol = n) for (i in 1:n) { y_mat[, i] <- 2 + 0.05 * (1:T_len) + stats::arima.sim(list(ar = 0.7), n = T_len) } colnames(y_mat) <- paste0("Unit_", 1:n) # Run Bayesian panel unit root test res <- bayes_panel_ur(y_mat, p = 0) print(res) summary(res)set.seed(123) # Generate stationary panel data (T = 30, n = 3) T_len <- 30 n <- 3 y_mat <- matrix(0, nrow = T_len, ncol = n) for (i in 1:n) { y_mat[, i] <- 2 + 0.05 * (1:T_len) + stats::arima.sim(list(ar = 0.7), n = T_len) } colnames(y_mat) <- paste0("Unit_", 1:n) # Run Bayesian panel unit root test res <- bayes_panel_ur(y_mat, p = 0) print(res) summary(res)
Visualizes the posterior density of the AR coefficient or panel data series.
## S3 method for class 'bayes_panel_ur' plot(x, type = c("posterior", "series"), ...)## S3 method for class 'bayes_panel_ur' plot(x, type = c("posterior", "series"), ...)
x |
An object of class |
type |
Character string indicating plot type: |
... |
Further graphical parameters passed to |
No return value, called for side effects (plotting).
set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) plot(fit, type = "posterior")set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) plot(fit, type = "posterior")
Print Method for bayes_panel_ur
## S3 method for class 'bayes_panel_ur' print(x, ...)## S3 method for class 'bayes_panel_ur' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object x.
set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) print(fit)set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) print(fit)
Summary Method for bayes_panel_ur
## S3 method for class 'bayes_panel_ur' summary(object, ...)## S3 method for class 'bayes_panel_ur' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object object.
set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) summary(fit)set.seed(123) data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4) fit <- bayes_panel_ur(data_mat) summary(fit)