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.
The BayesURTrend package implements the Bayesian unit
root test for time series models with maintained polynomial trend
components as proposed by Chaturvedi and Kumar
(2005).
Unlike classical Augmented Dickey-Fuller (ADF) or Phillips-Perron (PP) tests which rely on asymptotic approximations, the Bayesian framework calculates exact finite-sample posterior probabilities and Bayes factors for unit root hypotheses against stationary alternatives.
Consider a time series \(\{y_t, t = 1, 2, \dots, T\}\) governed by: \[y_t = \mu_0 + \sum_{i=1}^p \mu_i t^i + u_t\] where the stochastic error term \(u_t\) follows an augmented \(\text{AR}(1)\) process: \[u_t = \rho u_{t-1} + \sum_{j=1}^k \psi_j \Delta y_{t-j} + \epsilon_t, \quad \epsilon_t \sim \text{iid } N(0, \sigma^2)\]
The unit root hypothesis is \(H_0: \rho = 1\) versus the stationary alternative \(H_1: \rho \in (a, 1)\) where \(-1 < a < 1\). Under \(H_0\), the polynomial trend degree reduces by 1, yielding a maintained trend in first differences.
set.seed(123)
y_rw <- cumsum(rnorm(100))
res_rw <- bayes_ur_test(y_rw, p = 1, k = 1)
print(res_rw)
#>
#> Chaturvedi-Kumar Bayesian Unit Root Test with Maintained Trend
#>
#> data: y_rw
#> Posterior Odds Ratio (B01) = 6.873
#> Bayes Factor (BF01) = 6.873
#> Posterior Prob P(H0|y) = 0.873
#> Posterior Prob P(H1|y) = 0.127
#> parameters: p = 1 , k = 1 , a = 0 , prior P(H0) = 0.5
#> alternative hypothesis: stationary process with maintained trend (rho in (a, 1))
#>
#> Conclusion: Strong evidence in favor of Unit Root (H0: rho = 1).
summary(res_rw)
#> =========================================================
#> BAYESIAN UNIT ROOT TEST WITH MAINTAINED TREND
#> (Chaturvedi & Kumar, 2005)
#> =========================================================
#>
#> Data Series : y_rw
#> Polynomial Trend (p): 1
#> Augmentation Lags(k): 1
#> Prior Interval (a,1): (0, 1)
#> Prior P(H0) : 0.5
#>
#> --- HYPOTHESIS TESTING RESULTS ---
#> Posterior Odds Ratio (B01) : 6.87307
#> Bayes Factor (BF01) : 6.87307
#> Posterior Probability P(H0): 0.87298
#> Posterior Probability P(H1): 0.12702
#>
#> --- POSTERIOR SUMMARY FOR RHO (UNDER H1) ---
#> Mean Std.Dev Median 2.5% 97.5%
#> 0.92868 0.04735 0.92956 0.82406 0.99488
#>
#> --- EVIDENCE INTERPRETATION (Kass & Raftery Scale) ---
#> Substantial evidence for Unit Root (H0).
plot(res_rw)set.seed(456)
y_stat <- numeric(100)
for (t in 2:100) {
y_stat[t] <- 0.6 * y_stat[t - 1] + rnorm(1)
}
res_stat <- bayes_ur_test(y_stat, p = 1, k = 1)
print(res_stat)
#>
#> Chaturvedi-Kumar Bayesian Unit Root Test with Maintained Trend
#>
#> data: y_stat
#> Posterior Odds Ratio (B01) = 0.0149
#> Bayes Factor (BF01) = 0.0149
#> Posterior Prob P(H0|y) = 0.01468
#> Posterior Prob P(H1|y) = 0.9853
#> parameters: p = 1 , k = 1 , a = 0 , prior P(H0) = 0.5
#> alternative hypothesis: stationary process with maintained trend (rho in (a, 1))
#>
#> Conclusion: Strong evidence in favor of Stationarity (H1: rho < 1).
summary(res_stat)
#> =========================================================
#> BAYESIAN UNIT ROOT TEST WITH MAINTAINED TREND
#> (Chaturvedi & Kumar, 2005)
#> =========================================================
#>
#> Data Series : y_stat
#> Polynomial Trend (p): 1
#> Augmentation Lags(k): 1
#> Prior Interval (a,1): (0, 1)
#> Prior P(H0) : 0.5
#>
#> --- HYPOTHESIS TESTING RESULTS ---
#> Posterior Odds Ratio (B01) : 0.01490
#> Bayes Factor (BF01) : 0.01490
#> Posterior Probability P(H0): 0.01468
#> Posterior Probability P(H1): 0.98532
#>
#> --- POSTERIOR SUMMARY FOR RHO (UNDER H1) ---
#> Mean Std.Dev Median 2.5% 97.5%
#> 0.60115 0.10115 0.59797 0.40203 0.80396
#>
#> --- EVIDENCE INTERPRETATION (Kass & Raftery Scale) ---
#> Strong evidence for Stationarity (H1).
plot(res_stat)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.