fit_base.mcgf {mcgf} | R Documentation |
Parameter estimation for symmetric correlation functions for an mcgf
object.
Description
Parameter estimation for symmetric correlation functions for an mcgf
object.
Usage
## S3 method for class 'mcgf'
fit_base(
x,
lag,
horizon = 1,
model = c("spatial", "temporal", "sep", "fs", "none"),
method = c("wls", "mle"),
optim_fn = c("nlminb", "optim", "other"),
par_fixed = NULL,
par_init,
lower = NULL,
upper = NULL,
other_optim_fn = NULL,
dists_base = NULL,
scale_time = 1,
...
)
Arguments
x |
An |
lag |
Integer time lag. |
horizon |
Integer forecast horizon. |
model |
Base model, one of |
method |
Parameter estimation methods, weighted least square ( |
optim_fn |
Optimization functions, one of |
par_fixed |
Fixed parameters. |
par_init |
Initial values for parameters to be optimized. |
lower |
Optional; lower bounds of parameters. |
upper |
Optional: upper bounds of parameters. |
other_optim_fn |
Optional, 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 |
dists_base |
List of distance matrices. If NULL, |
scale_time |
Scale of time unit, default is 1. |
... |
Additional arguments passed to |
Details
This function fits the separable and fully symmetric models using weighted
least squares and maximum likelihood estimation. Optimization functions such
as nlminb
and optim
are supported. Other functions are also supported by
setting optim_fn = "other"
and supplying other_optim_fn
. lower
and
upper
are lower and upper bounds of parameters in par_init
and default
bounds are used if they are not specified.
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.
Value
A list containing outputs from optimization functions of optim_fn
.
See Also
Other functions on fitting an mcgf:
add_base.mcgf()
,
add_lagr.mcgf()
,
fit_lagr.mcgf()
,
krige.mcgf()
,
krige_new.mcgf()
Examples
data(sim1)
sim1_mcgf <- mcgf(sim1$data, dists = sim1$dists)
sim1_mcgf <- add_acfs(sim1_mcgf, lag_max = 5)
sim1_mcgf <- add_ccfs(sim1_mcgf, lag_max = 5)
# Fit a pure spatial model
fit_spatial <- fit_base(
sim1_mcgf,
model = "spatial",
lag = 5,
par_init = c(c = 0.001, gamma = 0.5),
par_fixed = c(nugget = 0)
)
fit_spatial$fit
# Fit a pure temporal model
fit_temporal <- fit_base(
sim1_mcgf,
model = "temporal",
lag = 5,
par_init = c(a = 0.3, alpha = 0.5)
)
fit_temporal$fit
# Fit a separable model
fit_sep <- fit_base(
sim1_mcgf,
model = "sep",
lag = 5,
par_init = c(
c = 0.001,
gamma = 0.5,
a = 0.3,
alpha = 0.5
),
par_fixed = c(nugget = 0)
)
fit_sep$fit