Releases: IsadoreNabi/bayesianOU
bayesianOU Package
Extended Description for bayesianOU Package
1. Overview
bayesianOU is an R package that solves a fundamental problem in economic dynamics: formally testing whether observed market prices exhibit mean-reversion toward theoretical equilibrium values through nonlinear stochastic processes with full Bayesian uncertainty quantification.
At its core, the package addresses situations where you need to determine if disaggregated economic variables (e.g., sectoral market prices) exhibit systematic attraction toward theoretical benchmarks (e.g., production prices)—a question central to classical and Marxian economics but notoriously difficult to answer with standard econometric tools. The solution combines nonlinear Ornstein-Uhlenbeck dynamics, stochastic volatility modeling, heavy-tailed innovations, and hierarchical Bayesian inference to deliver rigorous convergence tests with transparent uncertainty propagation.
2. The Problem
Economic convergence questions arise across many domains:
-
Variable
$Y$ : A set of observed market outcomes (e.g., market prices, CPI by sector) -
Variable
$X$ : A set of theoretical or fundamental values (e.g., production prices, labor-value prices) - Aggregate Dynamics: Economy-wide factors (e.g., aggregate profitability, TMG) that modulate convergence speeds
- Structural Heterogeneity: Sector-specific characteristics (e.g., capital composition) affecting adjustment patterns
The challenge: How do you determine whether
- Both are high-dimensional and exhibit sector-specific dynamics
- The convergence process may be nonlinear (stronger reversion for large deviations)
- Volatility varies over time (stochastic volatility)
- Shocks exhibit fat tails (non-Gaussian innovations)
- Aggregate economic conditions modulate the relationship
Traditional approaches fail because:
- Linear OU models assume constant mean-reversion speed regardless of deviation size
- Homoskedastic models ignore time-varying volatility, yielding inefficient inference
- Gaussian innovations underestimate extreme events, biasing tail risk
- Pooled estimators ignore sector-specific heterogeneity
- Frequentist methods provide only point estimates without full uncertainty quantification
- Single-equation approaches cannot capture how aggregate conditions modulate convergence
3. The Solution
bayesianOU implements a principled econometric framework that:
- Specifies nonlinear OU dynamics with cubic drift, allowing mean-reversion speed to increase with deviation magnitude
- Incorporates stochastic volatility via AR(1) log-variance processes, capturing volatility clustering
- Models heavy tails through Student-t distributed innovations with estimated degrees of freedom
- Estimates hierarchical priors for sector-specific parameters, sharing information across sectors
-
Includes time-varying coupling between
$Y$ and$X$ modulated by aggregate profitability (TMG) - Performs full Bayesian inference via Stan's Hamiltonian Monte Carlo with NUTS
- Validates through PSIS-LOO cross-validation and out-of-sample forecasting
- Provides interpretable outputs including half-lives, convergence probabilities, and posterior summaries
4. Key Innovation
This package represents a methodological contribution to econometrics, providing the first integrated framework for testing price convergence through nonlinear stochastic processes with stochastic volatility, heavy-tailed innovations, and hierarchical Bayesian inference.
The package's breakthrough lies in recognizing that:
-
Cubic drift
$\kappa(\theta - Y + a_3(Y - \theta)^3)$ nests linear OU as special case ($a_3 = 0$ ) while allowing stronger reversion for large deviations -
Time-varying beta
$\beta_s(t) = \beta_{0,s} + \beta_1 \cdot \text{TMG}_t$ captures how aggregate profitability modulates price adjustment - Stochastic volatility with AR(1) log-variance accounts for volatility persistence common in economic data
-
Student-t innovations with estimated
$\nu$ accommodate fat tails without arbitrary distributional assumptions - Hierarchical structure enables efficient estimation even with moderate time series length per sector
This enables:
-
Formal hypothesis testing for mean-reversion (
$\kappa_s > 0$ ) with exact posterior probabilities -
Interpretable parameters: Half-lives
$\tau_s = \ln(2)/\kappa_s$ in periods, coupling strengths -
Nonlinearity detection: Testing whether
$a_3 < 0$ (strengthening reversion at extremes) - Robust inference: Full posterior distributions for all parameters
- Model comparison: PSIS-LOO for comparing specifications
4.1. Mathematical Framework
4.1.1. The Nonlinear Ornstein-Uhlenbeck Model
The continuous-time specification for sector
where:
-
$Y_{s,t}$ is the (standardized) market price for sector$s$ at time$t$ -
$\kappa_s > 0$ is the mean-reversion speed -
$\theta_s$ is the long-run equilibrium level -
$a_{3,s}$ is the cubic nonlinearity coefficient -
$\sigma_{s,t}$ is the time-varying volatility -
$W_{s,t}$ is a standard Wiener process
Interpretation of cubic term: When
4.1.2. Discrete-Time Formulation with X-Coupling
Discretizing with
where the conditional mean is:
The time-varying coupling coefficient is:
where:
-
$\beta_{0,s}$ is the sector-specific baseline coupling -
$\beta_1$ is the global effect of aggregate profitability (TMG = Tasa Media de Ganancia) -
$\text{TMG}_t$ is the economy-wide profit rate at time$t$ -
$\gamma$ is the effect of capital composition on price dynamics -
$\text{COM}_{s,t}$ is the organic composition of capital for sector$s$
4.1.3. Stochastic Volatility Specification
The log-variance follows an AR(1) process:
where:
-
$\alpha_s$ is the long-run log-variance level -
$\rho_s \in (-1, 1)$ is the persistence parameter -
$\sigma_{\eta,s}$ is the volatility of log-volatility
4.1.4. Heavy-Tailed Innovations
The standardized innovations follow a Student-t distribution:
where
4.1.5. Hierarchical Prior Structure
Sector-specific parameters are drawn from population distributions:
The hyperpriors follow standard recommendations (Gelman, 2006):
4.2. Convergence Evidence
Strong Bayesian evidence for convergence requires:
-
Mean-reversion:
$\mathbb{P}(\kappa_s > 0 \mid \text{data}) \approx 1$ for all sectors. -
Stationarity:
$\mathbb{P}(\kappa_s < 1 \mid \text{data}) \approx 1$ for all sectors (ensures finite half-lives). -
95% credible intervals:
$[\kappa_{s, 0.025}, \kappa_{s, 0.975}] \subset (0, 1)$
Half-life interpretation: The time for a deviation to decay to half its initial value is:
For annual data,
4.3. Positioning Relative to Existing Methods
We did not find a prior methodology that combines: (i) Nonlinear OU with cubic drift, (ii) Stochastic volatility, (iii) Student-t innovations, (iv) Time-varying X-coupling via aggregate profitability, and (v) Full hierarchical Bayesian inference via MCMC. Adjacent traditions each miss at least one piece:
| Method | Limitation |
|---|---|
| Linear OU (Uhlenbeck & Ornstein, 1930) | Constant mean-reversion regardless of deviation size |
| GARCH models (Bollerslev, 1986) | Observation-driven volatility; no continuous-time interpretation |
| Standard SV (Kim, Shephard & Chib, 1998) | Linear dynamics; Gaussian innovations |
| Threshold models (Tong, 1990) | Regime-switching rather than smooth nonlinearity |
| Frequentist OU (Phillips & Yu, 2009) | Point estimates only; limited uncertainty quantification |
| Beta-convergence (Barro & Sala-i-Martin, 1992) | Cross-sectional; ignores time-series dynamics |
Novelty claim: We phrase this as "to our knowledge, we did not find…" given the vast adjacent literature.
5. Economic Applications
5.1. Testing the Labor Theory of Value
The primary appl...