Skip to content

Releases: IsadoreNabi/bayesianOU

bayesianOU Package

20 Dec 16:46

Choose a tag to compare

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 $Y$ systematically reverts toward $X$ when:

  • 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:

  1. Linear OU models assume constant mean-reversion speed regardless of deviation size
  2. Homoskedastic models ignore time-varying volatility, yielding inefficient inference
  3. Gaussian innovations underestimate extreme events, biasing tail risk
  4. Pooled estimators ignore sector-specific heterogeneity
  5. Frequentist methods provide only point estimates without full uncertainty quantification
  6. Single-equation approaches cannot capture how aggregate conditions modulate convergence

3. The Solution

bayesianOU implements a principled econometric framework that:

  1. Specifies nonlinear OU dynamics with cubic drift, allowing mean-reversion speed to increase with deviation magnitude
  2. Incorporates stochastic volatility via AR(1) log-variance processes, capturing volatility clustering
  3. Models heavy tails through Student-t distributed innovations with estimated degrees of freedom
  4. Estimates hierarchical priors for sector-specific parameters, sharing information across sectors
  5. Includes time-varying coupling between $Y$ and $X$ modulated by aggregate profitability (TMG)
  6. Performs full Bayesian inference via Stan's Hamiltonian Monte Carlo with NUTS
  7. Validates through PSIS-LOO cross-validation and out-of-sample forecasting
  8. 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 $s$ is:

$$ dY_{s,t} = \kappa_s \left( \theta_s - Y_{s,t} + a_{3,s} (Y_{s,t} - \theta_s)^3 \right) dt + \sigma_{s,t} , dW_{s,t} $$

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 $a_{3,s} < 0$, the restoring force $\kappa_s(-z + a_{3,s} z^3)$ where $z = Y - \theta$ is stronger for large deviations than for small ones, creating a "basin of attraction" effect that accelerates convergence from extreme values.

4.1.2. Discrete-Time Formulation with X-Coupling

Discretizing with $\Delta t = 1$ and adding the coupling to theoretical prices $X$:

$$ \Delta Y_{s,t} = Y_{s,t} - Y_{s,t-1} = \mu_{s,t} + \sigma_{s,t} \cdot \varepsilon_{s,t} $$

where the conditional mean is:

$$ \mu_{s,t} = \underbrace{\kappa_s \left( \theta_s - Y_{s,t-1} + a_{3,s} (Y_{s,t-1} - \theta_s)^3 \right)}_{\text{Nonlinear mean-reversion}} + \underbrace{\beta_s(t) \cdot (X_{s,t-1} - \mu_{X,s})}_{\text{Price of production effect}} + \underbrace{\gamma \cdot \text{COM}_{s,t-1}}_{\text{Capital composition effect}} $$

The time-varying coupling coefficient is:

$$ \beta_s(t) = \beta_{0,s} + \beta_1 \cdot \text{TMG}_t $$

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:

$$ h_{s,t} = \alpha_s + \rho_s (h_{s,t-1} - \alpha_s) + \sigma_{\eta,s} \cdot \eta_{s,t}, \quad \eta_{s,t} \sim \mathcal{N}(0, 1) $$

$$ \sigma_{s,t} = \exp(h_{s,t} / 2) $$

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:

$$ \varepsilon_{s,t} \sim t_\nu(0, 1) $$

where $\nu > 2$ degrees of freedom are estimated from the data. This accommodates fat tails while nesting the Gaussian case as $\nu \to \infty$.

4.1.5. Hierarchical Prior Structure

Sector-specific parameters are drawn from population distributions:

$$ \theta_s \sim \mathcal{N}(\theta_0 + \theta_{\text{COM}} \cdot \text{COM}_s, \sigma_\theta) $$

$$ \log(\kappa_s) \sim \mathcal{N}(-1, 0.5) $$

$$ \log(-a_{3,s}) \sim \mathcal{N}(\log(0.05), 0.4) $$

$$ \beta_{0,s} \sim \mathcal{N}(0, 0.5) $$

The hyperpriors follow standard recommendations (Gelman, 2006):

$$ \sigma_\theta, \sigma_\kappa, \sigma_{a_3}, \sigma_{\beta_0} \sim \text{Half-Normal}(0, 1) $$

$$ \beta_1 \sim \mathcal{N}(0.5, 0.25) $$

$$ \nu - 2 \sim \text{Exponential}(3) $$

4.2. Convergence Evidence

Strong Bayesian evidence for convergence requires:

  1. Mean-reversion: $\mathbb{P}(\kappa_s > 0 \mid \text{data}) \approx 1$ for all sectors.

  2. Stationarity: $\mathbb{P}(\kappa_s < 1 \mid \text{data}) \approx 1$ for all sectors (ensures finite half-lives).

  3. 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:

$$ \tau_s = \frac{\ln(2)}{\kappa_s} $$

For annual data, $\tau_s = 5$ means a 50% adjustment occurs in 5 years.

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

Read more