Learn R Programming

bayesianOU (version 0.1.3)

plot_beta_tmg: Plot beta(TMG_t) evolution by sector

Description

Creates a line plot showing the evolution of time-varying beta coefficients for selected sectors.

Usage

plot_beta_tmg(results, sectors = NULL)

Value

A ggplot2 object if ggplot2 is available, otherwise NULL with a base R plot produced as side effect.

Arguments

results

List returned by fit_ou_nonlinear_tmg

sectors

Character or integer vector. Sectors to plot. If NULL, plots all sectors.

Examples

Run this code
# \donttest{
# 1. Create mock data (T x S matrix)
T_obs <- 50
S <- 3
beta_mat <- matrix(rnorm(T_obs * S), nrow = T_obs, ncol = S)
colnames(beta_mat) <- paste0("Sector_", 1:S)

# 2. Wrap in list structure expected by function
results_mock <- list(
  beta_tmg = list(
    beta_point = beta_mat
  )
)

# 3. Plot
plot_beta_tmg(results_mock)
# }

Run the code above in your browser using DataLab