Fit a multi-map disaggregation model (via AGHQ, TMB, or MCMC)
Source:R/fitting.R
disag_model_mmap.RdTop-level fitting wrapper with engine dispatch and engine-specific argument
handling. Engine-specific controls should be supplied via engine.args.
Usage
disag_model_mmap(
data,
priors = NULL,
family = "poisson",
link = "log",
engine = c("AGHQ", "TMB", "MCMC"),
time_varying_betas = FALSE,
fixed_effect_betas = TRUE,
engine.args = NULL,
aghq_k = 2,
field = TRUE,
iid = TRUE,
silent = TRUE,
starting_values = NULL,
optimizer = NULL,
verbose = FALSE,
...
)Arguments
- data
A
disag_data_mmapobject.- priors
Optional named list of prior overrides.
- family
One of
"gaussian","binomial","poisson", or"negbinomial".- link
One of
"identity","logit", or"log".- engine
Character; one of
"AGHQ","TMB", or"MCMC". The MCMC engine uses tmbstan.- time_varying_betas
Logical; if TRUE, each time point has its own fixed-effect.
- fixed_effect_betas
Logical; if TRUE (default), beta coefficients are treated as fixed effects in the AGHQ outer parameter block (current behavior). If FALSE and
engine = "AGHQ", beta coefficients are moved to TMB random effects so they are integrated in the inner Laplace step.- engine.args
Optional named list of engine-specific options. Supported AGHQ keys are
aghq_k,optimizer, andouter_derivative_method. Supported TMB keys areiterations,hess_control_parscale,hess_control_ndeps, andouter_derivative_method.outer_derivative_methodmay be"tmb"(default) or"finite_difference". The finite-difference option affects only the outer fixed/hyperparameter optimization and Hessian; TMB still handles the inner Laplace approximation. Supported MCMC keys arechains,iter,warmup,thin,cores,seed,refresh,laplace,lower,upper, andcontrol. Additional named MCMC keys are passed through totmbstan::tmbstan()andrstan::sampling().iteris the total number of Stan iterations, including warmup.- aghq_k
Deprecated at wrapper level; use
engine.args = list(aghq_k = ...). Retained for backward compatibility.- field
Logical; include spatial field?
- iid
Logical; include IID polygon effects?
- silent
Logical; pass through to engine fit function.
- starting_values
Optional named list of starting values.
- optimizer
Deprecated at wrapper level; use
engine.args = list(optimizer = ...). Retained for backward compatibility.- verbose
Logical; print runtime diagnostics.
- ...
Additional arguments. Engine-specific arguments passed via
...are deprecated in this wrapper and should be moved toengine.args.