Creates the validated object passed to the control argument of
mmes. It collects every numerical choice of a fit:
the equation formulation, the linear solvers, covariance updates,
convergence, output, memory/threads and diagnostics. Statistical choices
(REML vs ML, exact vs Laplace vs PQL integration, fit vs solve) do not belong
here; they are declared in mmes_method. Starting values for
nonlinear parameters are given in mmes(start=) and family nuisance
parameters in mmes(familyParameters=).
Each argument is a module and is given as a named list; only the fields you
supply are changed and all others keep their defaults. For example,
mmes_control(solve=list(method="pcg", tol=1e-6), execution=list(seed=1)).
Unknown modules or fields, invalid values, and combinations that are not
mathematically admissible (for example PCG fields without
solve$method="pcg") stop with an informative error that names the
offending fields. A request can also be valid on its own but ineligible for
the model being fitted; mmes then stops rather than silently changing
the algorithm. The defaults reproduce the established sommer algorithm, so
mmes_control() is the right choice for most analyses.
mmes_control(formulation = "henderson", optimizer = list(), mode = list(),
working = list(), likelihood = list(), population = list(),
inference = list(), representation = list(), solve = list(),
logdet = list(), score = list(), curvature = list(), update = list(),
proposal = list(), convergence = list(), output = list(),
execution = list(), diagnostics = list())
A list of class sommer_mmes_control with one element per module.
It is validated again by mmes() and stored in the fitted object as
fit$control. mmes() accepts only objects created by this
function.
A single string selecting the equation domain.
"henderson" (default): coefficient-space mixed model
equations (fixed and random effects together). Sparse and fast when the
number of coefficients is moderate or the design is sparse. Required by
most advanced options (PCG, Schur/banded elimination, compression,
factor scores, selected inverse, PQL and Laplace GLMMs).
"direct": observation-space direct inversion of the
marginal covariance. Can be preferable when there are many more random
coefficients than observations. Only models that support it accept it.
The factorization backend is chosen separately in solve$method.
Outer optimizer for nonlinear-parameter and native Laplace likelihood fits (Gaussian covariance engines use the AI/update modules below instead). Fields:
maxit: NULL (default, engine default) or a positive
integer limiting outer iterations. Do not also set a different
convergence$maxIters; the limit must be specified once.
gradient: "auto" (default) uses native analytic
gradients where available and reported numerical derivatives for
reference expressions; "analytic" requires analytic scores and
errors if unavailable; "central" uses central differences.
algorithm: only "nlminb" is currently available.
scoreTol: NULL (default, 0.001) or a positive number,
the outer-score certificate for nonlinear specification fits. Not allowed
for non-nonlinear models.
Conditional random-effect mode search used by Laplace and nonlinear fits (not by Gaussian or PQL working fits). Fields:
maxit: maximum Newton iterations per mode (default
100).
tol: score tolerance for mode convergence (default
1e-8).
stepTol: step tolerance that detects stalled refinement
(default 1e-8); a non-default value is supported only by
nonlinear modes, native GLMM modes use tol.
warmStart: "auto" (default; reuse successful modes
for native GLMMs, deterministic cold starts for nonlinear models),
"off" or "on" (errors for nonlinear models).
starts: "deterministic" (only choice).
Outer iterations of the penalized quasi-likelihood (PQL)
working fit used for non-Gaussian mixed models by default. Fields:
maxit (default 20), tol (default 1e-5),
estimateTheta (default FALSE; TRUE estimates the
negative binomial theta conditionally on the random effects and requires
MASS::negative.binomial), and warmStart (default TRUE,
start each outer iteration from the previous solution). The inner Gaussian
fits are controlled by convergence.
Algebra used by the native Laplace likelihood (see
mmes_method(integration="laplace")); it does not choose the Gaussian
solver. Fields:
backend: "auto" (default), "random" (algebra
in random-effect space) or "observation" (in observation space).
All compute the same approximation; only "auto" is accepted for
non-Laplace fits.
trace: "panels" (default; bounded dense solve panels
sized by execution$denseMemoryMB) or "selected".
blocks: "off" (default) or "on" to use
block-structured post-fit operations.
Gauss quadrature for response-scale population
predictions of nonlinear models. Fields: order (initial order,
default 20), maxOrder (maximum order, default 160,
at most 512 and at least twice order) and tol (accuracy,
default 1e-7). If the accuracy is not met at maxOrder or the
workspace limit is hit, an error is raised.
Post-fit numerical uncertainty for nonlinear models.
Fields: step (relative central-difference step, default
1e-4, must be below 0.1), derivativeTol (derivative
acceptance tolerance, default 5e-3, below 1), curvatureTol
(curvature tolerance, default 1e-8, below 1) and
maxCondition (largest condition number accepted for the Hessian,
default 1e10, above 1). Standard errors are reported as NA
when these safeguards fail.
How equations and covariance operators are represented. Fields:
compression: "off" (default), "groups"
(collapse exactly identical observation groups) or "classes"
(also cache cross-products and derivative operands). Exact reductions
for Gaussian Henderson fits with independent residuals and fixed
diagonal weights.
factorScores: "none" (default), "fixed-shape"
or "profile" for equivalent latent representations of eligible
low-rank-plus-diagonal (factor analytic/reduced rank) models; shape
standard errors are unavailable with "profile".
fixedRank: "error" (default; stop if the fixed design
is rank deficient) or "drop" (fit a full-rank subset using sparse
QR; omitted coefficients are returned as zeros, flagged in
summary(fit)$betas, and are identification constraints, not
estimates).
equations: "normal" (default), "saddle-point"
(augmented system; avoids forming the compatibility coefficient matrix
when output$coefficientMatrix=FALSE) or the experimental
"conditional" (reusable sparse latent equations).
sparseFactors: "auto", "off" or "force"
(TRUE/FALSE accepted). Uses exact sparse precision
operands for autoregressive, antedependence, SAR and CAR factors. Auto
also keeps complete-grid separable residuals banded.
gridAugment: "auto", "off" or "force".
Adds one zero-response row and dummy fixed effect per missing cell of a
separable gridded residual so blocks are complete banded Kronecker
precisions. Likelihood, variances and BLUEs/BLUPs are unchanged; outputs
are mapped back to the observed design.
matrixFree: "auto" (default), "off" or
"force"; avoids assembling full Kronecker priors during PCG.
Linear solves and exact eliminations. Fields:
method: "auto" (default; the model decides),
"ldlt" (sparse LDLT), "cholmod" (supernodal sparse Cholesky)
or "pcg" (preconditioned conjugate gradients with stochastic
traces; for very large sparse systems).
PCG fields (only valid with method="pcg" or known-covariance
solving where noted): tol (relative tolerance, default
1e-8); maxIters (CG limit, 0 = automatic);
preconditioner ("diagonal" default, "nystrom",
"block-jacobi"; solving permits diagonal and block-jacobi only);
nystromRank (default 32); warmStart (reuse accepted
solutions, default FALSE); recycleRank (accepted points
reused, 0 disables, default 0); recycleMethod
("coarse" default or "krylov", which needs positive
recycleRank); recycleState and exportRecycle (import
or export a serializable Krylov basis across compatible fits; default
NULL/FALSE); rhsMethod ("independent" default
or "block"); blockSize (block width, default 16);
residualRefresh (periodic residual replacement, 0
disables).
Exact elimination switches, each "auto" (default),
"off" or "force": blockSchur (dense Schur, chain,
banded or latent elimination), blockBanded (block-banded
elimination, bandwidth at most 4), factorSchurMultiFactor
(multi-factor Woodbury/Schur for latent low-rank layouts) and
dFirstML (eliminate the random block before the fixed-effect Schur
complement in ML). A forced request still obeys structural and memory
checks.
Log-determinant approximation used by PCG. Fields:
scaling ("none" default or "diagonal", a symmetric
scaling with exact determinant correction) and lanczosSteps
(stochastic Lanczos quadrature depth, integer \(\ge 2\), default
20).
Covariance-parameter derivatives and trace estimation.
Fields: traceProbes (probe budget for stochastic traces, default
8), estimator ("hutchinson" default or
"control-variate", which uses a low-rank correction of dimension
rank, default 16); the previous three apply only to PCG.
Also covarianceChecks ("auto" default, "off",
"force"; skips redundant positive-definiteness checks when
certified), traceBatch ("off" default, "auto",
"force"; batch exact LDLT traces) and denseCrossproduct
("auto" default; uses an exact weighted sparse Gram product for
dense designs).
Information matrix used by the optimizer. method:
"exact-ai" (default; exact average information) or
"hybrid-ai" (damped BFGS between exact refreshes).
assembly: "sensitivity" (default) or
"augmented-working" (exact coefficient-space working-variate
absorption for Gaussian Henderson fits). reduced: "off"
(default), "auto" or "force"; exact independent-direction
AI assembly when vcc reduces the parameters.
How covariance parameters are updated. method:
"ai" (default average-information Newton steps), "em"
(conditional EM for eligible factor analytic models) or
"conditional-fa" (legacy EM selector). recovery: "em"
(default) or "pxem", the EM-type direction used for recovery.
blendWeight: NULL (default), a non-negative scalar or vector
weighting the recovery direction (an integer larger than 1 requests a
decaying schedule). commonScale: "off" (default),
"auto" or "force"; analytic common variance scale plus
profiled-shape AI for Gaussian fits where all product scales are free.
Scaling of proposed steps. stepWeight: NULL
(default) or positive scalar/vector multiplying the step; likelihood
safeguards stay active. extrapolation: "none" (default) or
"aitken" (safeguarded Aitken extrapolation).
Inner iterations and stopping rules. Fields:
maxIters (maximum covariance iterations, default 30; reaching
it is not proof of convergence), likelihoodTol and
parameterTol (default 1e-4; relative change in log-likelihood
and in parameters), and, for PCG: accuracy ("fixed" default
or "adaptive", which grows probe budgets up to maxTraceProbes
and maxLanczosSteps, defaulting to score$traceProbes and
logdet$lanczosSteps and never smaller than them), logDetTol
and scoreTol (empirical accuracy targets, default 0.001).
What is computed after the fit. Fields:
inverse: 0 (default; no coefficient inverse or PEVs),
1 (random-effect PEVs from the selected inverse, without full
Ci) or 2 (full Ci and PEVs; only advisable for small
systems). Defer this work with 0 and call
postPEV later. Native Laplace fits require 0.
covariance: "full" (default; standard errors of
covariance parameters) or "none" (skip final covariance
uncertainty; point estimates remain available).
coefficientMatrix: TRUE (default) or FALSE
(skip assembling the compatibility matrix C; needs saddle-point
equations and inverse=0; C-based methods then need a refit).
setup: FALSE (default) or TRUE to return the
prepared design, covariance descriptors and vcParams table without
fitting (useful for building vcc constraints).
selectedInverse: "auto" (default), "off" or
"force"; exact selected inverse from CHOLMOD with
inverse=1.
panelSize: width of inverse-solve batches (default
64), also used by postPEV and Laplace predictions.
Resources and reproducibility. Fields:
denseMemoryMB (admission budget for dense workspaces, default
1000; not a process memory cap), memoryPolicy
("speed" default or "limit" to enforce the budget),
gpu (FALSE default; TRUE uses eligible dense kernels on
CUDA builds with usable NVIDIA libraries), gpuMinSize (minimum
kernel size for the GPU, default 256), blasThreads
(NULL default, a positive integer or "auto"; BLAS only,
OpenMP is configured separately), inverseTol (numerical
stabilization and variance floor, default 1e-6; not the PCG
tolerance) and seed (non-negative integer identifying the stochastic
probe stream, default 0).
Messages and profiling. Fields: verbose
(TRUE default; print the iteration table and fit messages),
dateWarning (TRUE default; package-age warning) and
profile ("off" default, "auto" or "force";
phase timings stored in engineDiagnostics$profile, and see
profile_nonlinear for nonlinear fits).
Switch-like fields. Fields documented as "auto", "off",
"force" also accept TRUE (force) and FALSE (off).
"auto" lets sommer use the option when the model is eligible, while
"force" requests it and errors if it is not admissible. A forced
request never bypasses mathematical, structural or memory checks.
Global options. Experimental-mode defaults, the memory budget and
GPU settings can be set through R options, e.g.
options(sommer.mme.denseMemoryMB=2000). Values given explicitly in
mmes_control() always override option-derived defaults, so use them
for reproducible analyses.
Common recipes.
Quiet fit: mmes_control(diagnostics=list(verbose=FALSE)).
More iterations: mmes_control(convergence=list(maxIters=100)).
Random-effect PEVs at fit time: mmes_control(output=list(inverse=1));
or leave inverse=0 and call postPEV.
Skip standard errors of variance components for speed:
mmes_control(output=list(covariance="none")).
Very large sparse system:
mmes_control(solve=list(method="pcg"), execution=list(seed=1)).
Rank-deficient fixed design:
mmes_control(representation=list(fixedRank="drop")).
Inspect the model without fitting:
mmes_control(output=list(setup=TRUE)).
Limit threads and memory:
mmes_control(execution=list(blasThreads=2, denseMemoryMB=500)).
Migration. Numerical arguments removed from mmes() are now
fields of the modules above, e.g. henderson is
formulation, solver is solve$method, nIters is
convergence$maxIters, tolParConvLL and tolParConvNorm
are convergence$likelihoodTol and convergence$parameterTol,
tolParInv is execution$inverseTol, computeCi is
output$inverse, returnParam is output$setup,
pqlControl is working, and verbose/dateWarning
are diagnostics fields. REML and solveOnly moved to
mmes_method. The complete table is in the
sommer.mmes.options vignette.
Covarrubias-Pazaran G. Genome assisted prediction of quantitative traits using the R package sommer. PLoS ONE 2016, 11(6): doi:10.1371/journal.pone.0156744
Gilmour et al. 1995. Average Information REML: An efficient algorithm for variance parameter estimation in linear mixed models. Biometrics 51(4):1440-1450.
mmes, mmes_method, postPEV,
vcc, profile_nonlinear; the vignette
vignette("sommer.mmes.options") for the full field reference, defaults,
eligibility rules and decision graph, and vignette("sommer.machinery")
for the engine.
dat <- data.frame(x=seq_len(12), y=1+seq_len(12)/2+sin(seq_len(12))/10)
## defaults, silenced
ctl <- mmes_control(diagnostics=list(verbose=FALSE, dateWarning=FALSE))
fit <- mmes(y~x, data=dat, control=ctl)
coef(fit)
## modules only override the fields supplied
ctl2 <- mmes_control(convergence=list(maxIters=50),
output=list(covariance="none"),
diagnostics=list(verbose=FALSE, dateWarning=FALSE))
ctl2$convergence$maxIters
ctl2$convergence$likelihoodTol
## invalid choices are rejected
try(mmes_control(solve=list(method="gauss")))
Run the code above in your browser using DataLab