GLMM predictions are computed on the R side from the stored fixed effects
(population, re.form = NA) or fixed effects plus conditional modes
(re.form = NULL), then mapped through the family link. This mirrors
lme4::predict.merMod for generalized models: type = "link" returns the
linear predictor and type = "response" the mean.
Arguments
- object
A fitted
mm_glmmobject.- newdata
Optional new data. Must be a
data.framecontaining every variable referenced by the model's formula. Categorical levels must either match the training factor levels or trigger theallow.new.levelspolicy.- re.form
Random-effects conditioning, following lme4's basic convention.
NULLreturns conditional predictions;NA(or~0) returns population-level (fixed-effect) predictions. Conditioning on a subset of grouping factors via a one-sided formula is not supported by the current Rust contract and raisesmm_inference_unavailable.- allow.new.levels
When
FALSE(default), unseen grouping levels innewdataraisemm_inference_unavailablethrough the RustNewReLevels::Errorpolicy. WhenTRUE, unseen levels are replaced by the population mean (zero random effect), matchinglme4::predict(allow.new.levels = TRUE).- type
Prediction scale. Gaussian LMMs use the same values for
"response"and"link".- se.fit
Logical; when
TRUE, returns a list withfitandse.fit. For population predictions (re.form = NA) the standard error is the Wald SE of the fixed-effect linear predictor,sqrt(diag(X V X')). For conditional predictions (re.form = NULL) the SE comes from the engine prediction-variance payload, which adds the random-effect contribution (BLUP variance and the fixed/random covariance). Rows the engine cannot certify — e.g. unseen grouping levels underallow.new.levels = TRUE— returnNAwith the engine's reason in themm_reasonattribute. (lme4::predict.merModoffers no conditional SE at all.)- interval
Interval type:
"confidence"for the fitted mean or"prediction"for a new observation (adds the residual variance). Population (re.form = NA) intervals arefit +/- z*secomputed R-side; conditional (re.form = NULL) bounds come from the engine prediction-variance payload. Returns a matrix withfit/lwr/upr.- level
Confidence level for
interval/se.fitintervals.- ...
Reserved for generic compatibility.
Details
In-sample response predictions reuse the engine's certified fitted values.
Standard errors and confidence intervals: population (re.form = NA)
SEs are the fixed-effect Wald SE mapped through the link by the delta
method; conditional (re.form = NULL) SEs and confidence bounds come from
the engine prediction-variance payload. The engine certifies these rows
for method = "joint_laplace" fits and for default pirls_profiled fits
whose post-fit profiled-optimum certificate is issued (per-row status
"available"). Uncertified fits (e.g. singular fits, or fits whose
certificate fails) keep status "degraded", and their conditional SEs and
bounds are withheld as NA with the engine's reason in the mm_reason
attribute — consistent with the package's "no fake certainty" contract.
Prediction (future-observation) intervals (interval = "prediction") are
available for conditional, response-scale predictions: the engine returns
quantiles of the plug-in predictive distribution (the family conditional
distribution mixed over link-scale fitted-mean uncertainty), so bounds are
integers for count families and support points for Bernoulli. They are
refused with a typed condition on the link scale (future observations are
response-scale objects), for population-level requests, and for grouped
binomial fits (the future trial count is not representable in newdata).