@@ -25,3 +25,32 @@ print("Done!")
2525```
2626
2727Above should print two lines.
28+
29+ ## "Likelihood" from [ ` rstanarm ` ] ( https://mc-stan.org/rstanarm/articles/lm#likelihood )
30+
31+ The likelihood for one observation under a linear model can be written as a
32+ conditionally normal PDF
33+ $$ \frac{1}{\sigma_{\epsilon} \sqrt{2 \pi}}
34+ e^{-\frac{1}{2} \left(\frac{y - \mu}{\sigma_{\epsilon}}\right)^2}, $$
35+ where $\mu = \alpha + \mathbf{x}^\top \boldsymbol{\beta}$ is a linear predictor
36+ and $\sigma_ {\epsilon}$ is the standard deviation of the error in predicting
37+ the outcome, $y$. The likelihood of the entire sample is the product of $N$
38+ individual likelihood contributions.
39+
40+ It is well-known that the likelihood of the sample is maximized when the
41+ sum-of-squared residuals is minimized, which occurs when
42+ $$ \widehat{\boldsymbol{\beta}} = \left(\mathbf{X}^\top \mathbf{X}\right)^{-1}
43+ \mathbf{X}^\top \mathbf{y}, $$
44+ $$ \widehat{\alpha} = \overline{y} - \overline{\mathbf{x}}^\top
45+ \widehat{\boldsymbol{\beta}}, $$
46+ $$ \widehat{\sigma}_{\epsilon}^2 =
47+ \frac{\left(\mathbf{y} - \widehat{\alpha} - \mathbf{X} \widehat{
48+ \boldsymbol{\beta}}\right)^\top
49+ \left(\mathbf{y} - \widehat{\alpha} - \mathbf{X} \widehat{
50+ \boldsymbol{\beta}}\right)}{N}, $$
51+ where $\overline{\mathbf{x}}$ is a vector that contains the sample means of the
52+ $K$ predictors, $\mathbf{X}$ is a $N \times K$ matrix of _ centered_ predictors,
53+ $\mathbf{y}$ is a $N$-vector of outcomes and $\overline{y}$ is the sample mean
54+ of the outcome.
55+
56+ Boldsymbol should render, i.e. this should render properly: $\boldsymbol{\beta}$ and not error out.
0 commit comments