[Tex/LaTex] “overfull hbox (62.122123 too wide)” message in a long equation

equationsmath-mode

2.\\
(a) Since there is only one observation the likelihood function only includes $p_1^{y_1}(1-p_1)^{(1-y_1)}$.\\\

=$>$ $L(\alpha  , \beta_1 , \beta_2 , \beta_3) =   p_1^{y_1}(1-p_1)^{(1-y_1)}$\\\

=$>$ $l(\alpha  , \beta_1 , \beta_2 , \beta_3) = ln(p_1^{y_1}(1-p_1)^{(1-y_1)})$\\\

=$>$ $l(\alpha  , \beta_1 , \beta_2 , \beta_3) = y_1ln(p_1) + (1 - y_1)ln(1 - p_1)$\\\

=$>$ $l(\alpha  , \beta_1 , \beta_2 , \beta_3) = y_1ln(\frac{1}{1-e^{-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13})}}) + (1 - y_1)ln(1 - \frac{1}{1-e^{-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13}}})$\\\

I got an error at the first line (as the app said). Is there a way to fix this? Thanks a lot guys

Best Answer

You have to introduce a line break in the fourth equation. However, that's not the only adjustment you should perform. I suggest you do the following:

  • use enumerate environments; this will give you typographically sound amounts of indentation of the various items. Also, get rid of the manual line breaks.

  • remove the instances of =$>$, as they are redundant. (Aside: if you really need it, do write it as $\Rightarrow.)

  • place the four long equations in a single align* environment, and insert line breaks (with \\ directives) after each of the first three equations as well as after the obvious point in the fourth equation

  • don't over-use second-level subscripts and superscripts, especially not in the numerator or denominator of a fraction. Thus, instead of

    e^{-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13})}
    

    do write

    \exp\bigl(-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13})\bigr)
    

    Your readers will thank you.

  • Increase the sizes of some of the parentheses using \bigl(, \bigr), \biggl(, and \biggr) directives (see above for an example).

  • Last but not least, please write \ln instead of just ln. That way, the letters "ln" will be typeset in the upright Roman typeface.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "align*" environment
\begin{document}
\begin{enumerate}
\setcounter{enumi}{1} % just for this example
\item 
\begin{enumerate}
\item Since there is only 1 observation, the likelihood function only includes $p_1^{y_1}(1-p_1)^{(1-y_1)}$.
\begin{align*}
L(\alpha  , &\beta_1 , \beta_2 , \beta_3) 
  = p_1^{y_1}(1-p_1)^{(1-y_1)}\\
l(\alpha  , &\beta_1 , \beta_2 , \beta_3) 
  = \ln(p_1^{y_1}(1-p_1)^{(1-y_1)})\\
l(\alpha  , &\beta_1 , \beta_2 , \beta_3) 
  = y_1\ln(p_1) + (1 - y_1)\ln(1 - p_1)\\
l(\alpha  , &\beta_1 , \beta_2 , \beta_3) 
  = y_1\ln\biggl(\frac{1}{1-\exp\bigl(-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13})\bigr)}\biggr) \\
  &\quad+ (1 - y_1)\ln\biggl(1 - \frac{1}{1-\exp\bigl(-(\alpha + \beta_1 x_{11} + \beta_2 x_{12} + \beta x_{13})\bigr)}\biggr)
\end{align*}
\end{enumerate}
\end{enumerate}
\end{document}