Add lagr model outputted from fit_lagr() to a mcgf_rs object.
Add lagr model outputted from fit_lagr() to a mcgf_rs object.
## S3 method for class 'mcgf_rs'add_lagr(x, fit_lagr_ls,...)
Arguments
x: An mcgf_rs object.
fit_lagr_ls: Output from the fit_lagr() function.
...: Additional arguments. Not in use.
Returns
x with newly added attributes of the Lagrangian model.
Details
After fitting the Lagrangian model by fit_lagr(), the results can be added to x by add_base(). To supply the Lagrangian model directly, use lagr<- to add the Lagrangian model; the value must contain the same output as add_lagr.mcgf() or add_lagr.mcgf_rs().
Examples
data(sim3)sim3_mcgf <- mcgf_rs(sim3$data, dists = sim3$dists, label = sim3$label)sim3_mcgf <- add_acfs(sim3_mcgf, lag_max =5)sim3_mcgf <- add_ccfs(sim3_mcgf, lag_max =5)# Fit a fully symmetric model with known variablesfit_fs <- fit_base( sim3_mcgf, lag_ls =5, model_ls ="fs", rs =FALSE, par_init_ls = list(list(beta =0)), par_fixed_ls = list(list( nugget =0, c =0.05, gamma =0.5, a =0.5, alpha =0.2)))# Set beta to 0 to fit a separable model with known variablesfit_fs[[1]]$fit$par <-0# Store the fitted separable model to 'sim3_mcgf'sim3_mcgf <- add_base(sim3_mcgf, fit_base_ls = fit_fs)# Fit a regime-switching Lagrangian model.fit_lagr_rs <- fit_lagr( sim3_mcgf, model_ls = list("lagr_tri"), par_init_ls = list( list(v1 =-50, v2 =50), list(v1 =100, v2 =100)), par_fixed_ls = list(list(lambda =0.2, k =2)))# Store the fitted Lagrangian model to 'sim3_mcgf'sim3_mcgf <- add_lagr(sim3_mcgf, fit_lagr_ls = fit_lagr_rs)model(sim3_mcgf)
See Also
Other functions on fitting an mcgf_rs: add_base.mcgf_rs(), fit_base.mcgf_rs(), fit_lagr.mcgf_rs(), krige.mcgf_rs(), krige_new.mcgf_rs()