Skip to contents

For a gllvmTMB() fit with a modelled missing predictor (mi(x) plus missing = miss_control(predictor = "model")), imputed() returns a fitted summary of each missing predictor value. For a continuous Gaussian predictor (impute_model(x ~ z)), the estimate is the conditional mode with a local Gaussian/Laplace conditional standard error from the joint Hessian. For a binary predictor (impute_model(x ~ z, family = binomial())), the estimate is the conditional probability P(x = 1 | y, z) from the exact two-state marginalisation, std_error is NA (the discrete route reports a fitted distribution, not a single mode with a Hessian SE), and uncertainty_status is "discrete_no_se".

Usage

imputed(object, ...)

# S3 method for class 'gllvmTMB'
imputed(object, variable = NULL, rows = c("missing", "all"), se = TRUE, ...)

Arguments

object

A gllvmTMB fit.

...

Reserved for future extractor options.

variable

Optional missing-predictor name. The default uses the only modelled missing predictor in the fit.

rows

Which units to return. "missing" (default) returns only the units whose predictor value was missing; "all" returns every unit, with observed predictor values labelled as observed.

se

Logical; include conditional standard errors when the fit contains a successful TMB::sdreport() result.

Value

A data frame with variable, level, level_id, original_row, model_row, observed, estimate, std_error, source, and uncertainty_status. level_id is character so the same column can hold unit, group, or phylogenetic-tip labels.

Details

The missing predictor lives at a declared unit or coarser grouping level, so imputed() returns one row per missing level value (not one per long-format model row). The Gaussian estimates are conditional modes, not conditional means, multiple- imputation draws, or posterior summaries.

Join keys and row identifiers. level names the unit or coarser group at which the missing predictor lives, and level_id gives its value. Join results back to the data using that pair. The original_row and model_row columns are latent-level ordinals (the 1-based index of the missing unit / group in the covariate model's latent level), not indices into the rows of the data frame you passed to gllvmTMB(). They coincide with original data rows only in the narrow wide-traits() case where each unit is a single row; off the wide path (long data, or a coarser mi_group() level) they index the latent level, not the data. This differs from predict_missing(), whose original_row maps to the supplied long- or wide-data row.