Skip to contents

impute_model() wraps the model for a covariate declared missing with mi() in a gllvmTMB() formula. A bare two-sided formula in the impute argument – for example impute = list(x = x ~ z) – is sugar for a Gaussian predictor model; use impute_model() when an explicit predictor family is wanted.

Usage

impute_model(formula, family = stats::gaussian())

Arguments

formula

Two-sided predictor-model formula. The left-hand side must be the same variable used inside mi().

family

Predictor-model family. Supported values are gaussian(), binomial(link = "logit"), cumulative_logit(), and categorical(). Gaussian predictors support fixed, grouped-intercept, and phylogenetic- intercept covariate models; discrete predictors are fixed-effect only.

Value

A gllvmTMB_impute_model object for the impute argument of gllvmTMB().

Details

The current interface fits one modelled missing predictor at a time. A Gaussian predictor (gaussian(), or a bare formula) is treated as a latent quantity integrated out by the Laplace approximation and may use fixed covariates, one grouped random intercept, or one phylogenetic structured intercept. A Gaussian predictor that lives at a coarser observed level can declare that level with mi_group(group) in the predictor formula. Discrete predictors are fixed-effect only: binomial(link = "logit") uses exact two-state summation, cumulative_logit() uses exact ordered K-state summation, and categorical() uses exact unordered K-state softmax summation. Other predictor families are rejected explicitly.

See also

gllvmTMB() for the impute = argument, cumulative_logit() for an ordered categorical predictor model, and miss_control() for the predictor = "model" switch.

Examples

impute_model(x ~ z)
#> $formula
#> x ~ z
#> <environment: 0x5593d0f2c348>
#> 
#> $family
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> 
#> $family_type
#> [1] "gaussian"
#> 
#> attr(,"class")
#> [1] "gllvmTMB_impute_model"
impute_model(score ~ z, family = cumulative_logit())
#> $formula
#> score ~ z
#> <environment: 0x5593d0f2c348>
#> 
#> $family
#> $name
#> [1] "cumulative_logit"
#> 
#> $family
#> [1] "cumulative_logit"
#> 
#> $link
#> [1] "cumulative_logit"
#> 
#> attr(,"class")
#> [1] "gllvmTMB_impute_family"
#> 
#> $family_type
#> [1] "ordinal"
#> 
#> attr(,"class")
#> [1] "gllvmTMB_impute_model"