# Example with simulated conditional forecast data
# Create sample forecast data matrix
set.seed(123)
n_sims <- 500
horizons <- 3
variables <- c("GDP", "CPI", "FFR")
# Create column names in the expected format (variable.horizon)
col_names <- outer(variables, 1:horizons, paste, sep = ".")
# Generate random forecast data
forecast_data <- matrix(rnorm(n_sims * length(col_names)),
nrow = n_sims, ncol = length(col_names))
colnames(forecast_data) <- as.vector(col_names)
# Plot histogram for GDP at horizon 2
p <- plot_cond_histo(data = t(forecast_data),
variable = "GDP",
horizon = 2,
threshold = 0.5,
above = TRUE)
Run the code above in your browser using DataLab