Learn R Programming

STCCGEV (version 1.0.0)

simulation_generalized: Simulate Multivariate Crop Yield Data Using a Generalized Copula-GEV-BSTS Model

Description

This function simulates multivariate crop yield data using a time-varying copula combined with Generalized Extreme Value (GEV) margins and Bayesian Structural Time Series (BSTS) models.

Usage

simulation_generalized(
  nsim = 100,
  n_train,
  n_test,
  copula,
  init_params,
  fn,
  U_train,
  Z_train,
  X,
  Y_test,
  BSTS_list
)

Value

A list containing:

optim_results

Results from the optimization process.

theta_sim

Simulated copula parameters across replications.

Y_sim

Simulated final BSTS-based forecasts.

MSE

Mean squared error for each simulation run.

Arguments

nsim

Integer, number of simulation replications.

n_train

Integer, number of training observations.

n_test

Integer, number of test observations.

copula

Character, specifying the copula type: "Clayton", "Frank", "Gumbel", "Joe", or "Gaussian".

init_params

Numeric vector, initial parameter values for optimization.

fn

Function, log-likelihood function for parameter estimation.

U_train

Numeric matrix (n_train x D), pseudo-observations for the copula.

Z_train

Numeric array (n_train x D x M), observed data for each margin and sub-feature.

X

Numeric matrix (n_train x M), risk factors for the dynamic copula parameter.

Y_test

Numeric matrix (n_test x D), true future values for MSE calculation.

BSTS_list

List of length D, each element is a BSTS model for a different margin.