Skip to content

Commit 37e99ec

Browse files
polish up index
1 parent 8df6b03 commit 37e99ec

2 files changed

Lines changed: 35 additions & 10 deletions

File tree

ch7ModelComparison.qmd

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,22 @@ b7.0 <- brm(data = speciesBrain,
173173
prior = c(
174174
prior(normal(0.5, 1), class = Intercept),
175175
prior(normal(0, 1), class = b),
176-
prior(exponential(1), class = sigma)
176+
prior(lognormal(0,1), class = sigma)
177177
),
178178
iter = 2000, warmup = 500, seed = 4, cores = 4,
179-
backend = "cmdstanr", silent = 2, file = "fits/b07.0.4"
179+
backend = "cmdstanr", silent = 2, file = "fits/b07.0.5"
180180
)
181181
182182
b7.0_sim <- as_tibble(b7.0) %>%
183183
mutate(simMass = seq(from = -3, to = 3, length.out = n()),
184184
simBrainEst = Intercept + (b_mass_z * simMass),
185185
simBrain = rnorm(n(), simBrainEst, sd = sigma))
186186
187+
```
188+
189+
```{r}
190+
#| fig-width: 6
191+
#| fig-height: 4
187192
188193
ggplot() +
189194
stat_density_2d(data = b7.0_sim,
@@ -192,9 +197,10 @@ ggplot() +
192197
scale_fill_viridis_c(option = "magma") +
193198
geom_point(data = speciesBrain,
194199
aes(x = mass_z, y = brain_z),
195-
shape = 21, color = "white", fill = "black", lwd = 3, alpha = .8)+
200+
shape = 21, color = "white", fill = "black", lwd = 3, alpha = 1, size =2.5)+
196201
labs(title = "brain ~ mass", subtitle = "Mu estimate") +
197202
theme_minimal()+
203+
ggrepel::geom_text_repel(data = speciesBrain, aes(x = mass_z, y = brain_z, label = species), color = "white", size = 3)+
198204
# xlim(c(-3,3))+
199205
# ylim(c(-3,3))+
200206
scale_x_continuous("body mass (kg)",
@@ -212,3 +218,21 @@ ggplot() +
212218
213219
```
214220

221+
```{r}
222+
mass_brain <- speciesBrain %>%
223+
rename("mass_obs" = mass_z,
224+
"brain_obs" = brain_z) %>%
225+
dplyr::select(c(mass_obs, brain_obs))
226+
227+
228+
as_tibble(b7.0) %>%
229+
# Add row numbers to track individual draws
230+
mutate(draw_id = row_number()) %>%
231+
# Create all combinations of draws and new X values
232+
crossing(mass_brain) %>%
233+
mutate(brain_mu_pred = b_Intercept + (b_mass_z * brain_obs),
234+
brain_mu_resid= brain_obs - brain_pred_mu,
235+
brain_mu_
236+
)
237+
```
238+

index.qmd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
2-
title: "Statistical Rethinking Homepage"
2+
title: "Statistical Rethinking"
33
author: "Jaden Earl"
44
format: html
55
editor: visual
66
---
77

8-
# Welcome
8+
[Statistical Rethinking](https://oceanrep.geomar.de/id/eprint/55819/1/Statistical%20Rethinking%202nd%20Edition.pdf) has been a fun unlearning of the frequentist techniques that I practised in my undergrad. I appreciated it so much that I wanted to document my current statistical skillset using his textbook as the structure and basebone. Richard McElreath also has a great series on [youtube](https://www.youtube.com/watch?v=FdnMWdICdRs&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus) going through each chapter of his book that I highly reccommend as well.
99

10-
This site showcases projects from my **Statistical Rethinking** work in R and Quarto.
10+
## 📈 [Linear Regression](ch4_linear_regression_polished.qmd)
1111

12-
- 📈 [Linear Regression](ch4_linear_regression_polished.qmd)\
13-
- 🔀 [Multi Regression](ch5_multilinear.qmd)\
14-
- ➡️ [Causal Paths](ch6_DAG.qmd)
15-
- 🎯️ [Model Scoring](ch7ModelComparison.qmd)
12+
## 📊 [Multi Regression](ch5_multilinear.qmd)
13+
14+
## 🔀️ [Causal Paths](ch6_DAG.qmd)
15+
16+
## 🎯️ [Model Scoring](ch7ModelComparison.qmd)
1617

1718
Source code is on [GitHub](https://github.com/probably-jaden/Statistical-Rethinking).

0 commit comments

Comments
 (0)