Equations

These are formulas that appear with an equation number.

Basic Equation

The names of equations can not include . or _ but it can include -

\begin{equation} 
  1 + 1 = 2 
  (\#eq:eq99-1)
\end{equation} 

Which appears as:

\[\begin{equation} 1 + 1 = 2 \tag{13.1} \end{equation}\]

The reference to the equation is (13.1) which comes from this code \@ref(eq:eq99-1)

Case-When Equation (Large Curly Brace)

Based on: https://tex.stackexchange.com/questions/9065/large-braces-for-specifying-values-of-variables-by-condition

Case when formula:

\[\begin{equation} y = \begin{cases} 0, & \text{if}\ a=1 \\ 1, & \text{otherwise} \end{cases} \tag{13.2} \end{equation} \]

Which comes from this code:

    \begin{equation} 
      y =
      \begin{cases}
        0, & \text{if}\ a=1 \\
        1, & \text{otherwise}
      \end{cases}
      (\#eq:eq99-2)
    \begin{equation} 

The reference to equation is (13.2) which comes from this code \@ref(eq:eq99-2)

Alligned with Underbars

\[\begin{equation} \begin{aligned} \mathrm{E}(Y-\hat{Y})^2 & = \mathrm{E}[f(X) + \epsilon -\hat{f}(X)]^2 \\ & = \underbrace{[f(X) -\hat{f}(X)]^2}_{\mathrm{Reducible}} + \underbrace{\mathrm{var}(\epsilon)}_{\mathrm{Irreducible}} \\ \end{aligned} \tag{13.3} \end{equation}\]

Comes from this code:

\begin{equation}
\begin{aligned}
\mathrm{E}(Y-\hat{Y})^2 & = \mathrm{E}[f(X) + \epsilon -\hat{f}(X)]^2 \\
                        & = \underbrace{[f(X) -\hat{f}(X)]^2}_{\mathrm{Reducible}} + \underbrace{\mathrm{var}(\epsilon)}_{\mathrm{Irreducible}} \\
\end{aligned}
(\#eq:eq99-3)
\end{equation}