mlogis {fmx}R Documentation

Multinomial Probabilities & Logits

Description

Performs transformation between vectors of multinomial probabilities and multinomial logits.

This transformation is a generalization of plogis which converts scalar logit into probability and qlogis which converts probability into scalar logit.

Usage

qmlogis_first(p)

qmlogis_last(p)

pmlogis_first(q)

pmlogis_last(q)

Arguments

p

numeric vector, multinomial probabilities, adding up to 1

q

numeric vector, multinomial logits

Details

Functions pmlogis_first and pmlogis_last take a length k-1 numeric vector of multinomial logits q and convert them into length k multinomial probabilities p, regarding the first or last category as reference, respectively.

Functions qmlogis_first and qmlogis_last take a length k numeric vector of multinomial probabilities p and convert them into length k-1 multinomial logits q, regarding the first or last category as reference, respectively.

Value

Functions pmlogis_first and pmlogis_last return a vector of multinomial probabilities p.

Functions qmlogis_first and qmlogis_last return a vector of multinomial logits q.

See Also

plogis qlogis

Examples

(a = qmlogis_last(c(2,5,3)))
(b = qmlogis_first(c(2,5,3)))
pmlogis_last(a)
pmlogis_first(b)

q0 = .8300964
(p1 = pmlogis_last(q0))
(q1 = qmlogis_last(p1))

# various exceptions
pmlogis_first(qmlogis_first(c(1, 0)))
pmlogis_first(qmlogis_first(c(0, 1)))
pmlogis_first(qmlogis_first(c(0, 0, 1)))
pmlogis_first(qmlogis_first(c(0, 1, 0, 0)))
pmlogis_first(qmlogis_first(c(1, 0, 0, 0)))
pmlogis_last(qmlogis_last(c(1, 0)))
pmlogis_last(qmlogis_last(c(0, 1)))
pmlogis_last(qmlogis_last(c(0, 0, 1)))
pmlogis_last(qmlogis_last(c(0, 1, 0, 0)))
pmlogis_last(qmlogis_last(c(1, 0, 0, 0)))


[Package fmx version 0.1.2 Index]