Home   >   User Resources   >   Online Help   >   apaMultinomialLogit.Estimate
 

 

Function index Version 3.0.0

apaMultinomialLogit.Estimate(X, Y)

Excel=apaMultinomialLogit.Estimate(X, Y)

Result

Estimates a multinomial logistic regression model by maximum likelihood and returns diagnostics, coefficients and in-sample predictions. The function is non-volatile.

Syntax

X: n x p matrix of predictors (an intercept is added automatically)

Y: n x 1 vector of the dependent variable with integer classes 1..K

Algorithm

Class K is the reference category. For the classes k = 1..K - 1 the probabilities are

P(yi=k)=exp(xi⊤βk)1+∑l=1K−1exp⁡(xi⊤βl),P(yi=K)=11+∑l=1K−1exp⁡(xi⊤βl)P(y_{i} = k) = \frac{exp(x_{i}^{\top}\beta_{k})}{1 + \sum_{l = 1}^{K - 1}\exp(x_{i}^{\top}\beta_{l})},\quad\quad P(y_{i} = K) = \frac{1}{1 + \sum_{l = 1}^{K - 1}\exp(x_{i}^{\top}\beta_{l})}

where the vector x(i) of observation i includes a 1 for the intercept. The log-likelihood is concave in the coefficients and is maximized with Newton's method, using the exact gradient and Hessian, a backtracking line search and a Cholesky decomposition of the Hessian. The predictors are standardized internally, and the coefficients are transformed back to the units of X, so the result does not depend on the scaling of the predictors. The iteration stops when the Newton decrement falls below 1E-15 relative to the log-likelihood, typically after 4 to 10 iterations.

Remarks

The result consists of three blocks. The diagnostics block contains the log-likelihood, the negative log-likelihood, AIC, BIC, the numbers of observations, predictors, classes and parameters, the termination reason (Converged or IterationLimit), the number of Newton iterations (FunctionEvaluations), RestartCount (always 0) and the largest absolute element of the gradient at the solution with respect to the standardized coefficients (ErrorValue). The coefficient block contains one row per class 1..K - 1 with the intercept and the predictor coefficients. The last block contains, for each observation, the actual class, the predicted class (highest probability) and the K class probabilities.

If some classes can be predicted perfectly or almost perfectly from the predictors (separation), the maximum likelihood coefficients are infinite, and the function returns an error message. The function also returns an error message if a predictor is constant (the intercept is already included) or if the predictors are collinear.

Predictors are standardized internally with population moments (denominator n); the coefficients are reported on the original scale.