The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Package {BayesURTrend}


Type: Package
Title: Bayesian Unit Root Test for Model with Maintained Trend
Version: 0.1.0
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>.
License: GPL (≥ 3)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.3
Depends: R (≥ 3.5.0)
Imports: stats, graphics
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-07-28 03:12:30 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 07:00:02 UTC

Bayesian Unit Root Test for Model with Maintained Trend

Description

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).

Usage

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)

Arguments

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).

Value

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.

References

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

Examples

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)

Simulated Macroeconomic Time Series Data

Description

A simulated univariate time series vector containing 100 observations exhibiting a random walk with drift, suitable for demonstrating unit root testing.

Usage

macro_data

Format

A numeric vector of length 100.

Source

Simulated dataset generated for package documentation and examples.

Examples

data(macro_data)
res <- bayes_ur_test(macro_data, p = 1, k = 1)
print(res)

Plot Method for Bayesian Unit Root Test

Description

Plots the posterior density of the autoregressive parameter rho under H1 along with prior density and unit root probability.

Usage

## S3 method for class 'bayes_ur_test'
plot(x, ...)

Arguments

x

An object of class "bayes_ur_test".

...

Further graphical arguments.

Value

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


Print Method for Bayesian Unit Root Test

Description

Prints a concise summary of the Bayesian unit root test results.

Usage

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

Arguments

x

An object of class "bayes_ur_test".

...

Further arguments passed to or from other methods.

Value

Invisibly returns the input object x.


Summary Method for Bayesian Unit Root Test

Description

Provides detailed summary output for a Bayesian unit root test object.

Usage

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

Arguments

object

An object of class "bayes_ur_test".

...

Further arguments passed to or from other methods.

Value

Invisibly returns the input object object.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.