Skip to contents

categorical() declares the predictor-model family for an unordered categorical missing predictor used inside mi() with impute_model(family = categorical()). The missing unordered predictor is marginalised EXACTLY by a finite-state baseline-category softmax sum over its K categories (K >= 3); there is no latent variable. The predictor link is a baseline-category softmax with the FIRST level as baseline (eta_state(1) = 0); for state k = 2, ..., K, eta_state(k) = X_x beta_x[block (k-1)], and Pr(x = k | z) = exp(eta_state(k)) / sum_j exp(eta_state(j)). The coefficient vector beta_x is packed as K - 1 blocks of the covariate design width. The missing predictor must be an unordered factor, character, or integer category scores with at least three levels, and every category must appear among the observed values; a two-level predictor uses binomial() (the binary route) and an ordered predictor uses cumulative_logit().

Usage

categorical()

Value

A gllvmTMB_impute_family object for the family argument of impute_model().

Details

This is a predictor-model family tag consumed by impute_model(family = ), NOT a response family for gllvmTMB().

See also

impute_model(), cumulative_logit() for an ordered missing predictor, and binomial() for a binary missing predictor.

Examples

impute_model(habitat ~ z, family = categorical())
#> $formula
#> habitat ~ z
#> <environment: 0x5593d0e4f010>
#> 
#> $family
#> $name
#> [1] "categorical"
#> 
#> $family
#> [1] "categorical"
#> 
#> $link
#> [1] "baseline_softmax"
#> 
#> attr(,"class")
#> [1] "gllvmTMB_impute_family"
#> 
#> $family_type
#> [1] "categorical"
#> 
#> attr(,"class")
#> [1] "gllvmTMB_impute_model"