| Title: | Bayesian Unit Root Test for Model with Maintained Trend |
|---|---|
| Description: | Performs Bayesian unit root testing for time series models with maintained polynomial trend components as proposed by Chaturvedi and Kumar (2005) <doi:10.1016/j.spl.2005.04.044>. The package 'BayesURTrend' computes posterior odds ratios, Bayes factors, and posterior probabilities for unit root hypotheses against stationary alternatives in autoregressive models augmented with polynomial trends. Methodological foundations for Bayesian unit root testing under structural breaks and maintained trends are drawn from Schotman and van Dijk (1991) <doi:10.1016/0304-4076(91)90038-F>, Phillips and Perron (1988) <doi:10.1093/biomet/75.2.335>, and Ouliaris et al. (1988) <doi:10.1007/978-94-009-2953-1_10>. |
| 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:18:35 UTC |
| Source: | https://github.com/cran/BayesURTrend |
Computes the posterior odds ratio, Bayes factor, and posterior probabilities for testing the unit root hypothesis in an autoregressive model with maintained polynomial trend, as proposed by Chaturvedi and Kumar (2005).
bayes_ur_test(y, p = 1, k = 1, a = 0, p0 = 0.5, V = NULL, n_grid = 200) chaturvedi_test(y, p = 1, k = 1, a = 0, p0 = 0.5, V = NULL, n_grid = 200)bayes_ur_test(y, p = 1, k = 1, a = 0, p0 = 0.5, V = NULL, n_grid = 200) chaturvedi_test(y, p = 1, k = 1, a = 0, p0 = 0.5, V = NULL, n_grid = 200)
y |
A numeric vector or univariate time series. |
p |
Non-negative integer specifying the degree of the polynomial trend (default is 1 for linear trend). |
k |
Non-negative integer specifying the order of augmentation / lagged differences (default is 1). |
a |
Lower bound of the prior interval (a, 1) for autoregressive parameter rho under H1 (default is 0). Must satisfy -1 < a < 1. |
p0 |
Prior probability of the unit root hypothesis H0 (default is 0.5). Must satisfy 0 < p0 < 1. |
V |
Optional prior precision matrix for trend coefficients mu (p x p matrix) or scalar scaling parameter (default is 1e-4 * I_p). |
n_grid |
Integer specifying the number of grid points for evaluating posterior density of rho under H1 (default is 200). |
An object of class "bayes_ur_test" and "htest" containing:
statistic |
The posterior odds ratio (b01) in favor of the unit root hypothesis H0. |
p.value |
The posterior probability P(H0|y) of the unit root hypothesis. |
bayes_factor |
The Bayes factor (BF01) in favor of H0 relative to H1. |
posterior_h0 |
Posterior probability of the unit root hypothesis H0. |
posterior_h1 |
Posterior probability of the stationary alternative hypothesis H1. |
rho_summary |
Vector of summary statistics for rho under H1 (mean, sd, median, 2.5%, 97.5% quantiles). |
rho_grid |
Vector of evaluation grid points for rho in (a, 1). |
rho_density |
Vector of normalized posterior density values for rho under H1. |
parameter |
Named vector of test settings (p, k, a, p0). |
method |
Character string describing the test method. |
data.name |
Character string providing the data name. |
estimates |
Named vector of estimated parameter values. |
Chaturvedi, A., & Kumar, J. (2005). Bayesian unit root test for model with maintained trend. Statistics & Probability Letters, 74(1), 109–115. doi:10.1016/j.spl.2005.04.044
Schotman, P., & van Dijk, H. K. (1991). A Bayesian analysis of the unit root in real exchange rates. Journal of Econometrics, 49(1-2), 195–238. doi:10.1016/0304-4076(91)90038-F
Phillips, P. C. B., & Perron, P. (1988). Testing for a unit root in time series regression. Biometrika, 75(2), 335–346. doi:10.1093/biomet/75.2.335
set.seed(123) # Simulated random walk (Unit root process) y_rw <- cumsum(rnorm(60)) res_rw <- bayes_ur_test(y_rw, p = 1, k = 1) print(res_rw) summary(res_rw) # Stationary AR(1) process y_stat <- numeric(60) for (t in 2:60) y_stat[t] <- 0.5 * y_stat[t - 1] + rnorm(1) res_stat <- bayes_ur_test(y_stat, p = 1, k = 1) print(res_stat)set.seed(123) # Simulated random walk (Unit root process) y_rw <- cumsum(rnorm(60)) res_rw <- bayes_ur_test(y_rw, p = 1, k = 1) print(res_rw) summary(res_rw) # Stationary AR(1) process y_stat <- numeric(60) for (t in 2:60) y_stat[t] <- 0.5 * y_stat[t - 1] + rnorm(1) res_stat <- bayes_ur_test(y_stat, p = 1, k = 1) print(res_stat)
A simulated univariate time series vector containing 100 observations exhibiting a random walk with drift, suitable for demonstrating unit root testing.
macro_datamacro_data
A numeric vector of length 100.
Simulated dataset generated for package documentation and examples.
data(macro_data) res <- bayes_ur_test(macro_data, p = 1, k = 1) print(res)data(macro_data) res <- bayes_ur_test(macro_data, p = 1, k = 1) print(res)
Plots the posterior density of the autoregressive parameter rho under H1 along with prior density and unit root probability.
## S3 method for class 'bayes_ur_test' plot(x, ...)## S3 method for class 'bayes_ur_test' plot(x, ...)
x |
An object of class |
... |
Further graphical arguments. |
No return value, called for side effects (plotting).
Prints a concise summary of the Bayesian unit root test results.
## S3 method for class 'bayes_ur_test' print(x, ...)## S3 method for class 'bayes_ur_test' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object x.
Provides detailed summary output for a Bayesian unit root test object.
## S3 method for class 'bayes_ur_test' summary(object, ...)## S3 method for class 'bayes_ur_test' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
Invisibly returns the input object object.