Modular Numerical Controls for Mixed Models
mmes_control.RdCreates a strictly validated sommer_mmes_control object for the
numerical methods used by mmes. Model formulas remain separate.
Every module accepts only its documented fields; unknown module or field names
are errors. Constructing controls does not fit a model or establish that
requested methods are eligible for a particular model.
Arguments
- formulation
Equation domain:
"henderson"(default) or"direct". Henderson forms coefficient-space mixed-model equations; direct uses observation-space inversion.- task
Named list with
mode,objective, andpql. Defaults:mode="fit",objective="reml", andpql=list(maxit=20L, tol=1e-5, estimateTheta=FALSE, warmStart=TRUE).modeis"fit"or"solve";objectiveis"reml"or"ml". The nestedpqllist accepts onlymaxit,tol,estimateTheta, andwarmStart, with the defaults shown. These fields own task selection and outer PQL iteration, not inner covariance iterations.- representation
Named list with
compression="off",factorScores="none",equations="normal",sparseFactors="auto", andmatrixFree="auto"by default, unless correspondingsommer.mme.*options override experimental modes.sparseFactors="auto"enables exact sparse innovation kernels for modified-Cholesky factors of dimension at least 64 and maximum innovation lag three. It also enables sparse SAR/CAR kernels when the factor dimension is at least 500 and at most one percent of adjacency weights are nonzero. Other factors retain their existing path. Use"off"to disable or"force"to enable eligible sparse factor kernels regardless of size. Ifsommer.mme.saddlePointresolves to"force", the defaultequationsbecomes"saddle-point".compressionis"off","groups", or"classes";factorScoresis"none","fixed-shape", or"profile";equationsis"normal","saddle-point", or"conditional"(experimental latent FA equations with independently selected AI/EM updates). The remaining fields use experimental mode values"auto","off", or"force"(logical TRUE/FALSE are accepted). This module owns equation, compression, covariance-factor, and factor-score representations.- solve
Named list.
method="auto"selects among"auto","ldlt","cholmod", and"pcg". PCG fields default totol=1e-8,maxIters=0L,preconditioner="diagonal",nystromRank=32L,warmStart=FALSE,recycleRank=0L,recycleMethod="coarse",recycleState=NULL,exportRecycle=FALSE,rhsMethod="independent",blockSize=16L, andresidualRefresh=0L. Also accepts the experimental solve requestsblockSchur="auto",blockBanded="auto",factorSchurMultiFactor="auto", anddFirstML="auto"; globalsommer.mme.*options may override these mode defaults. The method owns checked linear solves, preconditioning, reuse, and eligible elimination. PCG settings apply only when an eligible PCG path uses them.- logdet
Named list with
scaling="none"andlanczosSteps=20Lby default. Scaling is"none"or"diagonal". This module owns determinant approximation and its correction, not linear-solve accuracy.- score
Named list with
traceProbes=8L,estimator="hutchinson",rank=16L,covarianceChecks="auto", andtraceBatch="off"by default. The estimator is"hutchinson"or"control-variate".covarianceChecksandtraceBatchaccept experimental mode values. This module owns covariance derivatives, trace estimation, and covariance checks.- curvature
Named list with
method="exact-ai"andreduced="off"by default. The method is"exact-ai"or"hybrid-ai";reducedaccepts experimental mode values. This module owns the AI metric and reduced-direction assembly.- update
Named list with
method="ai",recovery="em",blendWeight=NULL, andcommonScale="off"by default.recoveryis"em"or"pxem";commonScaleaccepts experimental mode values. This module owns covariance-coordinate updates, EM/PXEM recovery, blending, and common-scale profiling.method="ai"remains the default optimizer. Withrepresentation$equations="conditional", it uses exact REML scores, average-information curvature, safeguarded steps and EM recovery in latent FA coordinates.method="em"selects conditional-moment EM and requires that representation. The earliermethod="conditional-fa"selector continues to select conditional EM, not AI. Conditional equations support one FA relationship term with diagonal or FA residuals, including missing and unbalanced observations, using sparse LDLT posterior solves and selected inverse panels. They require Gaussian identity Henderson REML,solve$method="auto"or"ldlt",output=list(inverse=0, covariance="none", coefficientMatrix=FALSE), and no weights, rotation,vcc, other representation requests, or acceleration. Each source must be entirely free or entirely fixed. Conditional AI bounds its dense derivative-RHS and curvature workspace byexecution$denseMemoryMB;output$panelSizealso bounds projection solve panels. A rank-revealing eigensolve removes numerically null curvature directions. Accepted AI steps satisfy an observed-REML ascent check; failed proposals use an audited EM recovery step, never a silent estimator change. AI convergence requires a small diagonally scaled score usingconvergence$parameterTol; at numerical bounds it uses the projected (KKT) score. Conditional AI bounds free physical specific variances below bymax(1e-8, execution$inverseTol) * var(y), and shared genetic allocations to[max(1e-8, execution$inverseTol), 1-max(1e-8, execution$inverseTol)]. This prevents nearly deterministic latent equations from producing unreliable likelihoods. Starting values must respect these bounds;execution$inverseTolmust be less than 0.5 on this path. The floors and active coordinate indices are reported inconditionalFA$ai. EM retains its existing machine-precision floor and likelihood/parameter stabilization; it is not silently changed to this constrained AI optimizer. See the conditional FA section ofvignette("sommer.mmes.options").- proposal
Named list with
stepWeight=NULLandextrapolation="none"by default. Extrapolation is"none"or"aitken". This module owns proposal scaling and extrapolation. Aitken extrapolation cannot be combined withcurvature$method="hybrid-ai".- convergence
Named list with
maxIters=30L,likelihoodTol=1e-4,parameterTol=1e-4,accuracy="fixed",maxTraceProbes=NULL,maxLanczosSteps=NULL,logDetTol=1e-3, andscoreTol=1e-3. Accuracy is"fixed"or"adaptive"; NULL stochastic limits resolve to the initialtraceProbesandlanczosSteps. This module owns inner iteration convergence and stochastic accuracy requests.- output
Named list with
inverse=0L,covariance="full",coefficientMatrix=TRUE,setup=FALSE,selectedInverse="auto", andpanelSize=64Lby default.inverseis 0 (no final coefficient inverse or fit-time PEV computation), 1 (selected inverse and random-effect PEVs), or 2 (full inverse and random-effect PEVs). Modes 1 and 2 compute PEVs during fitting; mode 1 does not form the complete coefficient-matrix inverse. With mode 0, usepostPEVafter fitting to compute PEVs or the full inverse, providedcoefficientMatrix=TRUE;covarianceis"full"or"none";selectedInverseaccepts experimental mode values. This module owns coefficient uncertainty, covariance-parameter uncertainty, retained coefficient-matrix output, and setup output.- execution
Named list with
denseMemoryMB=1000,memoryPolicy="speed",gpu=FALSE,gpuMinSize=256L,blasThreads=NULL,inverseTol=1e-6, andseed=0Lby default. A non-NULLsommer.mme.denseMemoryMB,sommer.mme.memoryPolicy,sommer.mme.gpu, orsommer.mme.gpuMinSizeoption supplies its corresponding default. This module owns resource policy, hardware, threading, numerical inverse tolerance, and stochastic seed.- diagnostics
Named list with
verbose=TRUE,dateWarning=TRUE, andprofile="off"by default.profileaccepts experimental mode values. This module owns ordinary fit messages, package-age warnings, and phase profiling.
Details
Module ownership describes mathematical responsibility, not a promise that
every cross-module combination is supported. For example, formulation and
solver choices are model-dependent; PCG has REML and output restrictions;
compression, saddle-point equations, factor-score augmentation, common-scale
profiling, and reduced AI each have additional prerequisites. Consult
vignette("sommer.mmes.options", package="sommer") and the internal
.mmes_capabilities() catalog for the current conceptual decision graph
and capability inventory. The catalog is descriptive; fitting validation
remains authoritative. The modular API does not imply a kernel rewrite or
arbitrary method composition.
task$mode="solve" selects a known-covariance path rather than ordinary
variance-component fitting; it requires an eligible Gaussian identity model
and has narrower PCG/output options. task$pql$estimateTheta=TRUE
requires a negative-binomial family. representation$compression needs
eligible matching designs and independent residuals. Saddle-point equations,
factor-score representation, sparse factors, and matrix-free PCG each have
separate model and backend gates. PCG fitting is a Henderson REML path;
selected-inverse output mode 1 is not supported by PCG. The vignette and
capability catalog describe these prerequisites, but the fit-time validator
decides eligibility.
Within PCG, solve$preconditioner="nystrom" uses
solve$nystromRank; solve$recycleState and
solve$exportRecycle require solve$recycleMethod="krylov" and a
positive solve$recycleRank. logdet$scaling and Lanczos depth
apply to stochastic determinant evaluation. score$rank is used by the
control-variate estimator. Adaptive trace and Lanczos budgets apply to
stochastic PCG accuracy. output$panelSize applies to full inverse
panels and conditional FA posterior-moment/projection panels, not ordinary selected-inverse
mode.
Experimental mode fields accept "auto", "off", or
"force"; logical TRUE and FALSE mean force and off. Package options
may supply defaults for these requests. "force" requests a path but
does not bypass mathematical, structural, or memory eligibility checks.
Nested lists reject unknown names and duplicate or empty names.
Defaults retain the established numerical bundle. Aitken belongs to
proposal$extrapolation; hybrid AI belongs to
curvature$method; they are mutually exclusive.
Migration from removed numerical arguments
mmes() now takes numerical settings through control. The old
formals are not compatibility aliases and must not be passed to mmes().
Map former settings to canonical module paths:
hendersonformulation="henderson"orformulation="direct".solver,enginesolve$method; pass the complete control object ascontrol=....nIters,tolParConvLL,tolParConvNorm,tolParInvconvergence$maxIters,convergence$likelihoodTol,convergence$parameterTol, andexecution$inverseTol, respectively.REML,solveOnly,pqlControltask$objective("reml"or"ml"),task$mode("fit"or"solve"), andtask$pql.computeCi,getPEV,returnParamoutput$inverseandoutput$setup. PEV output is controlled byoutput$inverse; the formergetPEVflag has no separate replacement.blend,blendWeight,stepWeightupdate$recovery,update$blendWeight, andproposal$stepWeight.acceleration="aitken"proposal$extrapolation="aitken".acceleration="hybrid-ai"curvature$method="hybrid-ai". Do not combine with Aitken.compression,factorScoreAugmentation,covarianceInformation,retainCoefficientMatrixrepresentation$compression,representation$factorScores,output$covariance, andoutput$coefficientMatrix.- Former
pcgsettings Map solve tolerances, iteration limits, preconditioning, and reuse to
solve; determinant scaling and Lanczos depth tologdet; trace probes, estimator, rank, and covariance checks toscore; stochastic accuracy budgets toconvergence; seed toexecution.- Former
experimentalsettings Map structured representation requests to
representation, elimination requests tosolve, trace batching toscore, reduced AI tocurvature, common-scale profiling toupdate, selected/full inverse requests tooutput, and profiling todiagnostics.denseMemoryMB,memoryPolicy,gpu,gpuMinSize,blasThreadsexecutionfields with the same names.verbose,dateWarningdiagnosticsfields with the same names.recordDiagnostics,verboseDiagnosticsRemoved flags with no direct replacement. Use
diagnostics$verbosefor fit messages anddiagnostics$profilefor implemented phase profiling.
With diagnostics$verbose=TRUE, the existing Henderson MME path
line includes the coefficient solver, active/inactive latent reduced-rank and
Schur variants, and the selected residual engine (including inactive grid and
repeated-Kronecker paths). An inactive automatic Schur path is reported as
“not selected”, not as proof that the model lacks exploitable structure;
disabled controls and unsupported coefficient backends are distinguished.
Compatibility
Settings are checked against one compatibility table when the control is
built and again in mmes. A supplied setting that conflicts with
another, or that would have no effect on the selected path, stops the call with
a message that names every offending setting and how to fix it. A setting counts
as supplied only when it differs from its default, so restating defaults is
always accepted. The main rules are:
formulation="direct"accepts onlytask,update$recovery,update$blendWeight,proposal$stepWeight, convergence iterations and tolerances,output$setup,output$inverse0 or 2, memory and threadingexecutionsettings, anddiagnostics.task$mode="solve"accepts onlysolve$tol,solve$maxIters,solve$warmStart,solve$residualRefresh, a non-Nystromsolve$preconditioner,output$setup, CPUexecutionsettings anddiagnostics.PCG-only settings (solve tolerances, preconditioner, recycling,
logdet,scoreestimators, adaptive accuracy,representation$matrixFree,execution$seed) requiresolve$method="pcg";"auto"never selects PCG.solve$method="pcg"rejects EM/PXEM recovery, blending, common-scale profiling, reduced AI, Aitken, hybrid AI, saddle-point equations, factor scores andtask$objective="ml".Aitken extrapolation, hybrid AI, saddle-point equations, factor scores, blending and
output$coefficientMatrix=FALSEeach reject the modules they cannot combine with.
Rules that depend on the data, family, vcc or rotation are checked by
mmes at fit time; for example a Gaussian identity fit stops when
task$pql is changed.