Multinomial Logit Family

Description

The MN() family implements a multinomial logit model for categorical responses with \(k \ge 2\) unordered categories.

Usage

MN(k)

Arguments

k An integer specifying the number of response categories.

Details

The response must be a factor with exactly k levels. The first level is treated as the reference category.

For categories \(j = 2, \ldots, k\), each predictor models the log-odds relative to the reference category.

The family provides analytical first and second derivatives of the log-likelihood with respect to the predictors and a probabilities() method for fitted category probabilities.

Value

A “gamlss2.family” object to be used with gamlss2.

See Also

gamlss2, gamlss2.family

Examples

library("gamlss2")


m <- gamlss2(mstatus ~ s(age) | . | ., data = marital.nz, family = MN(4))

plot(m)

par <- predict(m)
probs <- family(m)$probabilities(par)
names(probs) <- levels(marital.nz$mstatus)

i <- order(marital.nz$age)
matplot(marital.nz$age[i], probs[i, ], type = "l", lty = 1, lwd = 2,
  xlab = "Age", ylab = "Probabilities")
legend("center", names(probs), lty = 1, lwd = 2, col = 1:4)