Sonia Ayers

2022-07-09

In logistic regression, the regression coefficients ($\stackrel{^}{{\beta }_{0}},\stackrel{^}{{\beta }_{1}}$) are calculated via the general method of maximum likelihood. For a simple logistic regression, the maximum likelihood function is given as
$\ell \left({\beta }_{0},{\beta }_{1}\right)=\prod _{i:{y}_{i}=1}p\left({x}_{i}\right)\prod _{{i}^{\prime }:{y}_{{i}^{\prime }}=0}\left(1-p\left({x}_{{i}^{\prime }}\right)\right).$
What is the maximum likelihood function for $2$ predictors? Or $3$ predictors?

Darrell Valencia

Expert

The same for any finite number of predictors, i.e.,
$p\left({y}_{i};\stackrel{\to }{{x}_{i}}\right)=\frac{1}{1+\mathrm{exp}\left\{-{x}_{i}^{\prime }\beta \right\}},$
where ${x}_{i}=\left(1,{x}_{1i},...,{x}_{pi}\right)$ and $\beta =\left({\beta }_{0},...,{\beta }_{p}\right)$. Thus the likelihood function is Binomial
$\mathcal{L}\left(\beta \right)=\prod _{i=1}^{m}p\left({y}_{i};\stackrel{\to }{{x}_{i}}{\right)}^{{y}_{i}}\left(1-p\left({y}_{i};\stackrel{\to }{{x}_{i}}\right){\right)}^{1-{y}_{i}}.$
E.g., if you have two predictors, i.e., ${x}_{1}$ and ${x}_{2}$, and total of $n$ observations, i.e., $\left\{\left({y}_{i},{x}_{1i},{x}_{2i}\right\}$ then the likelihood function is given by
$\prod _{i=1}^{n}p\left({y}_{i};{x}_{1i},{x}_{2i}{\right)}^{{y}_{i}}\left(1-p\left({y}_{i};{x}_{1i},{x}_{2i}\right){\right)}^{1-{y}_{i}},$
where
$p\left({y}_{i};{x}_{1i},{x}_{2i}\right)=\frac{1}{1+\mathrm{exp}\left\{-{\beta }_{0}+{\beta }_{1}{x}_{1i}+{\beta }_{2}{x}_{2i}\right\}}.$

Do you have a similar question?