These multiple probabilities need to add up to be less than 1.
Arguments
- ...
numeric probabilities to convert to log-scale numbers. These probabilities must add to a number less than 1 and are used in the mix() estimation algorithm.
- maxiter
maximal number of iterations allowed.
- rtol
relative error tolerance, either a scalar or a vector, one value for each element in the unknown x.
- atol
absolute error tolerance, either a scalar or a vector, one value for each element in x.
- ctol
a scalar. If between two iterations, the maximal change in the variable values is less than this amount, then it is assumed that the root is found.
- returnRoot
logical; If TRUE, return the root object, otherwise return the root itself.
Value
A numeric vector of the log-scale numbers for use in regressions where the sum of a set of probabilities must add to be one.
Details
Once converted to log-scale numbers, they can be used in the
in the mexpit()
to get the probabilities back with the following equation
$$p_i = \frac{e^{x_i}}{1+\sum_{j=1}^{N-1} e^{x_j}}$$
This ensures one remaining probability will add to one, that is
$$p_N = \frac{1}{1+\sum_{j=1}^{N-1} e^{x_j}}$$
Unfortunately, the log-scale inverse cannot be solved analytically,
so it is solved with the rootSolve::multiroot()
function.
You may adjust some of the root finding options when using this function.
When running nlmixr2
with mixture models (ie. mix()
models),
the mlogit()
function is called in the probabilities and the
log-based values are used in the optimization problem. The
probabilities are determined by the mexpit()
function.