Multiclass Logistic Regression is a variant of the standard Logistic Regression model that is used to model the relationship between a categorical response variable with more than two categories and one or more predictor variables. In the context of a scientific journal paper, Multiclass Logistic Regression may be used to investigate the association between multiple exposures and a disease outcome with multiple categories or to identify predictors of a certain behavior or event with multiple outcomes.
The basic idea of Multiclass Logistic Regression is to model the probability of the response variable (Y) taking on a certain category as a function of one or more predictor variables (X). Specifically, the model assumes that the log-odds of the response variable being in a certain category can be modeled as a linear function of the predictor variables:
log(p(Y=k)p(Y=K))=β0k+β1kX1+⋯+βpkXp,k=1,2,…,K−1\log \left(\frac{p(Y=k)}{p(Y=K)}\right) = \beta_{0k} + \beta_{1k} X_1 + \dots + \beta_{pk} X_p, \quad k = 1,2,\dots,K-1log(p(Y=K)p(Y=k))=β0k+β1kX1+⋯+βpkXp,k=1,2,…,K−1where p(Y=k) is the probability of the response variable taking on the kth category, and p(Y=K) = 1 - ∑_{k=1}^{K-1} p(Y=k) is the probability of it taking on the Kth category. The term inside the log function is called the odds ratio or logit, which represents the ratio of the probability of Y=k to the probability of Y=K.
The coefficients β_{0k}, β_{1k}, ..., β_{pk} represent the effects of the predictor variables on the log-odds of the response variable being in the kth category. The goal of Multiclass Logistic Regression is to estimate these coefficients based on the observed data and use them to make predictions about the probability of the response variable being in a certain category.
The estimation of the coefficients can be performed using Maximum Likelihood Estimation (MLE), which involves finding the values of the coefficients that maximize the likelihood of the observed data given the model. The likelihood function can be written as:
L(β)=∏i=1n∏k=1K−1[p(Yi=k∣xi;β)]yikL(\beta) = \prod_{i=1}^n \prod_{k=1}^{K-1} [p(Y_i=k|x_i;\beta)]^{y_{ik}}L(β)=i=1∏nk=1∏K−1[p(Yi=k∣xi;β)]yikwhere x_i is the vector of predictor variables for the ith observation, y_{ik} is an indicator variable that takes on the value 1 if the ith observation is in the kth category, and 0 otherwise, and n is the sample size. The MLE estimates of the coefficients are the values that maximize this likelihood function.
Once the coefficients are estimated, the model can be used to make predictions about the probability of the response variable being in a certain category given a set of predictor variable values. This can be done using the softmax function, which maps the linear predictor to a vector of probabilities that sum to 1:
p(Y=k∣X)=exp(β0k+β1kX1+⋯+βpkXp)1+∑j=1K−1exp(β0j+β1jX1+⋯+βpjXp),k=1,2,…,K−1p(Y=k|X) = \frac{\exp(\beta_{0k} + \beta_{1k} X_1 + \dots + \beta_{pk} X_p)}{1 + \sum_{j=1}^{K-1} \exp(\beta_{0j} + \beta_{1j} X_1 + \dots + \beta_{pj} X_p)}, \quad k = 1,2,\dots,K-1p(Y=k∣X)=1+∑j=1K−1exp(β0j+β1jX1+⋯+βpjXp)exp(β0k+β1kX1+⋯+βpkXp),k=1,2,…,K−1The softmax function can also be used to calculate the odds ratio or logit for any two categories k and j, as it is simply the ratio of their probabilities: