Skip to content

Commit fbef9e8

Browse files
committed
Trying to add boldsymbol as package to mathjax
1 parent 29822f0 commit fbef9e8

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

inst/pkgdown/templates/head.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@
2727

2828
{{#uses_mathjax}}
2929
<!-- mathjax math -->
30-
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js"
31-
integrity="sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI=" crossorigin="anonymous"></script>
3230
<script>
3331
window.MathJax = {
32+
loader: { load: ['[tex]/boldsymbol'] },
33+
tex: { packages: { '[+]': ['boldsymbol'] } },
3434
chtml: {
3535
fontURL: "https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/output/chtml/fonts/woff-v2"
3636
}
3737
};
3838
</script>
39+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js"
40+
integrity="sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI=" crossorigin="anonymous">
41+
</script>
3942
{{/uses_mathjax}}
4043

4144
{{#lightswitch}}

vignettes/Example.rmd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,32 @@ print("Done!")
2525
```
2626

2727
Above 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

Comments
 (0)