Package {BayesPanelUR}


Type: Package
Title: Bayesian Unit Root Test for Panel Data Models
Version: 0.1.0
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.
License: GPL (≥ 3)
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.0.0)
Imports: stats, graphics
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
VignetteBuilder: knitr
RoxygenNote: 7.3.1
NeedsCompilation: no
Packaged: 2026-07-29 02:15:59 UTC; shikhar tyagi
Author: Shikhar Tyagi ORCID iD [aut, cre], Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut]
Maintainer: Shikhar Tyagi <shikhar1093tyagi@gmail.com>
Repository: CRAN
Date/Publication: 2026-08-06 13:30:07 UTC

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.

Details

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.

Author(s)

Shikhar Tyagi, Arvind Pandey, Bhupendra Singh, Vrijesh Tripathi

Maintainer: Shikhar Tyagi <shikhar1093tyagi@gmail.com>

References

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.


Bayesian Unit Root Test for Panel Data Models

Description

Evaluates the unit root hypothesis for panel data autoregressive (PAR) models using the Bayesian Posterior Odds Ratio (POR) approach of Kumar et al. (2016).

Usage

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
)

Arguments

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 TRUE (default), includes a linear time trend in the model.

p

Non-negative integer specifying the order of augmentation terms (lagged differences). Default is 0.

a

Numeric bound parameter specifying the alternative hypothesis domain S = (-a, 1). Default is 0.999.

vtheta

Numeric prior hyperparameter \vartheta. Default is 1.0.

p0

Numeric prior probability of the null hypothesis H_0: \rho = 1. Default is 0.5.

lower

Numeric lower integration limit for \rho. Default is 0.0.

upper

Numeric upper integration limit for \rho. Default is 0.9999.

Details

The function computes the Posterior Odds Ratio (POR) for testing the panel unit root hypothesis:

H_0: \rho = 1 \quad \text{vs} \quad H_1: \rho \in (-a, 1)

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 \beta_{01} is calculated via exact 1D numerical integration of the marginal posterior integrand. The posterior probability of the null hypothesis P(H_0 | \text{data}) = \beta_{01} / (1 + \beta_{01}) serves as the Bayesian p-value.

Value

An S3 object of class "bayes_panel_ur" containing:

statistic

The test statistic value (Posterior Odds Ratio \beta_{01}).

p.value

The posterior probability of the null hypothesis P(H_0 | \text{data}).

bayes_factor

Bayes factor BF_{01} in favor of unit root H_0.

bf10

Bayes factor BF_{10} in favor of trend stationarity H_1.

prob_H0

Posterior probability of difference stationarity H_0.

prob_H1

Posterior probability of trend stationarity H_1.

rho_hat

Estimated AR coefficient \hat{\rho} under the alternative hypothesis.

se_rho

Standard error of \hat{\rho}.

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 \rho grid values and posterior densities.

parameter

List of input hyperparameter settings.

References

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>

Examples

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)

Net Asset Value (NAV) Data of Indian National Pension Scheme (NPS)

Description

Panel dataset containing daily and monthly Net Asset Value (NAV) time series data for various pension fund managers across Tier-I and Tier-II schemes in India.

Usage

data(nps_nav)

Format

A data frame with 71 rows and 5 variables:

Date

Date of observation (monthly average).

ICICI

Monthly average NAV of ICICI Pension Fund.

KM

Monthly average NAV of Kotak Mahindra (KM) Pension Fund.

SBI

Monthly average NAV of State Bank of India (SBI) Pension Fund.

UTI

Monthly average NAV of UTI Retirement Solutions.

Source

Economics and Econometrics Research Institute (EERI) Research Paper Series No. 14/2016. <https://hdl.handle.net/10419/179393>

References

Kumar, J., Chaturvedi, A., & Afifa, U. (2016). Bayesian unit root test for panel data. EERI Research Paper Series, No. 14/2016.


Plot Method for bayes_panel_ur

Description

Visualizes the posterior density of the AR coefficient \rho or panel data series.

Usage

## S3 method for class 'bayes_panel_ur'
plot(x, type = c("posterior", "series"), ...)

Arguments

x

An object of class "bayes_panel_ur".

type

Character string indicating plot type: "posterior" for the posterior density of \rho, or "series" for panel time series.

...

Further graphical parameters passed to plot.

Value

No return value, called for side effects (plotting).

Examples

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

Description

Print Method for bayes_panel_ur

Usage

## S3 method for class 'bayes_panel_ur'
print(x, ...)

Arguments

x

An object of class "bayes_panel_ur".

...

Further arguments passed to or from other methods.

Value

Invisibly returns the input object x.

Examples

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

Description

Summary Method for bayes_panel_ur

Usage

## S3 method for class 'bayes_panel_ur'
summary(object, ...)

Arguments

object

An object of class "bayes_panel_ur".

...

Further arguments passed to or from other methods.

Value

Invisibly returns the input object object.

Examples

set.seed(123)
data_mat <- matrix(rnorm(100), nrow = 25, ncol = 4)
fit <- bayes_panel_ur(data_mat)
summary(fit)