2  Chapter 2: Advanced Topics

This is the second chapter. Continue building your book with more chapters.

2.1 Mathematical Equations

You can include mathematical equations using LaTeX syntax:

Inline equation: \(E = mc^2\)

Display equation:

\[ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} \]

2.2 Custom Macros

This book uses the d-morrison/macros submodule to provide convenient LaTeX shorthand for statistical and mathematical notation.

2.2.1 Probability and Distributions

The normal distribution \(\Normal\paren{\m, \ss}\) can be written using macros as $\Normal\paren{\m, \ss}$, where \m expands to \(\mu\) and \ss expands to \(\sigma^2\).

A random variable \(X \dist \Normal\paren{\mu, \sigma^2}\) has expectation \(\E{X} = \mu\) and variance \(\Var{X} = \sigma^2\).

2.2.2 Regression Notation

In linear regression, we estimate \(\vbeta\) using ordinary least squares. The fitted values are \(\hy = \mX \hb\), where \(\hb = \inv{\mX' \mX} \mX' \vy\).

The standard error of \(\hb\) is \(\hse{\hb} = \hs \sqrt{\inv{\mX' \mX}}\).

2.2.3 Likelihood and Estimation

The log-likelihood function \(\llik(\th)\) is maximized at the MLE \(\hth_{\text{ML}}\).

The score function is \(\score(\th) = \deriv{\th} \llik(\th)\) and the observed information is \(\oinf(\th) = -\hess(\th)\).

2.2.4 Logistic Regression

The logit link function is \(\logitf{\pi} = \logt\paren{\frac{\pi}{1 - \pi}}\) and its inverse is \(\expitf{\eta} = \frac{e^\eta}{1 + e^\eta}\).

2.3 Tables

Table 2.1: Example table caption
Column 1 Column 2 Column 3
Data 1 Data 2 Data 3
Data 4 Data 5 Data 6

2.4 Figures

You can include images by placing them in the images/ directory:

![Example image caption](images/your-image.png){#fig-example}

Then reference the figure in text using @fig-example.

2.5 Callouts

Note

This is a note callout. Use it to highlight important information.

Tip

This is a tip callout. Share helpful suggestions with your readers.

Warning

This is a warning callout. Alert readers to potential issues.

Important

This is an important callout. Emphasize critical information.