Learn R Programming

bayesianOU (version 0.1.3)

plot_drift_curves: Plot cubic OU drift curves

Description

Displays the drift function for selected sectors showing mean reversion with cubic nonlinearity.

Usage

plot_drift_curves(results, sectors = NULL)

Value

NULL invisibly. Produces a base R plot as side effect.

Arguments

results

List returned by fit_ou_nonlinear_tmg

sectors

Integer vector. Sector indices to plot. If NULL, plots all sectors.

Examples

Run this code
# \donttest{
# 1. Create mock data
# z: vector of state deviations
z_seq <- seq(-3, 3, length.out = 100)
# drift: matrix (rows=z, cols=sectors)
drift_mat <- cbind(
  -0.5 * z_seq - 0.1 * z_seq^3, # Sector 1
  -0.8 * z_seq - 0.05 * z_seq^3 # Sector 2
)

# 2. Wrap in list structure
results_mock <- list(
  nonlinear = list(
    drift_decomp = list(
      z = z_seq,
      drift = drift_mat
    )
  )
)

# 3. Plot
plot_drift_curves(results_mock)
# }

Run the code above in your browser using DataLab