x: An mcgf_rs object containing attributes dists, acfs, ccfs, and sds.
lag_ls: List of integer time lags.
horizon: Integer forecast horizon.
model_ls: List of base models, each element must be one of spatial, temporal, sep, fs. Only sep and fs are supported when mle is used in model_ls.
method_ls: List of parameter estimation methods, weighted least square (wls) or maximum likelihood estimation (mle).
optim_fn_ls: List of optimization functions, each element must be one of nlminb, optim, other. When use other, supply other_optim_fn_ls.
par_fixed_ls: List of fixed parameters.
par_init_ls: List of initial values for parameters to be optimized.
lower_ls: Optional; list of lower bounds of parameters.
upper_ls: Optional: list of upper bounds of parameters.
other_optim_fn_ls: Optional, list of other optimization functions. The first two arguments must be initial values for the parameters and a function to be minimized respectively (same as that of optim and nlminb).
dists_base_ls: List of lists of distance matrices. If NULL, dists(x)
is used. Each element must be a matrix or an array of distance matrices.
scale_time: Scale of time unit, default is 1. lag is divided by scale_time for parameter estimation.
rs: Logical; if TRUE x is treated as a regime-switching, FALSE if the parameters need to be estimated in a non-regime-switching setting.
...: Additional arguments passed to all optim_fn_ls.
Returns
A list containing outputs from optimization functions of optim_fn
for each regime.
Details
This functions is the regime-switching variant of fit_base.mcgf(). Arguments are in lists. The length of arguments that end in _ls must be 1 or the same as the number of regimes in x. If the length of an argument is 1, then it is set the same for all regimes. Refer to fit_base.mcgf() for more details of the arguments.
Note that both wls and mle are heuristic approaches when x contains observations from a subset of the discrete spatial domain, though estimation results are close to that using the full spatial domain for large sample sizes.
Examples
data(sim2)sim2_mcgf <- mcgf_rs(sim2$data, dists = sim2$dists, label = sim2$label)sim2_mcgf <- add_acfs(sim2_mcgf, lag_max =5)sim2_mcgf <- add_ccfs(sim2_mcgf, lag_max =5)# Fit a regime-switching pure spatial modelfit_spatial <- fit_base( sim2_mcgf, lag_ls =5, model_ls ="spatial", par_init_ls = list(c(c =0.00005, gamma =0.5)), par_fixed_ls = list(c(nugget =0)))lapply(fit_spatial[1:2],function(x) x$fit)# Fit a regime-switching pure temporal modelfit_temporal <- fit_base( sim2_mcgf, lag_ls =5, model_ls ="temporal", par_init_ls = list( list(a =0.8, alpha =0.8), list(a =0.1, alpha =0.1)))lapply(fit_temporal[1:2],function(x) x$fit)# Fit a regime-switching separable modelfit_sep <- fit_base( sim2_mcgf, lag_ls =5, model_ls ="sep", par_init_ls = list(list( c =0.00005, gamma =0.5, a =0.5, alpha =0.5)), par_fixed_ls = list(c(nugget =0)))lapply(fit_sep[1:2],function(x) x$fit)
See Also
Other functions on fitting an mcgf_rs: add_base.mcgf_rs(), add_lagr.mcgf_rs(), fit_lagr.mcgf_rs(), krige.mcgf_rs(), krige_new.mcgf_rs()