Comments (5)
That’s a great suggestion! I played around with different solutions to that kind of plot in a recent blog and this is a nice addition to those methods. Thanks for bringing it to my attention. Before I release the next revision of the Rethinking project, I’ll update this plot, for sure.
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.
I ultimately went with a different solution. But the spirit is the same. It'll appear in the upcoming bookdown update. Thanks again for opening the issue.
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.
There are some zigzags in Fig. 12.2.a. I am not sure what is the reason. But the set.seed and sample_n affected the pattern. Please check the figure.
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.
What seed values gave you noticeably different results?
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.
I reproduced the graph in my PC.
I guess there is a problem in (sample_n, expand, nesting)
Fig. 12.2.b with zig-zag lines
sample_n: 35
set.seed(12)
post %>%
sample_n(35, replace = FALSE) %>%
expand(nesting(iter, b_Intercept, sd_tank__Intercept),
x = seq(-4, 5, length.out = 100)
) %>%
mutate(
y = dnorm(x, b_Intercept, sd_tank__Intercept)
) %>%
ggplot(aes(x = x, y = y, group = iter)) +
geom_line(alpha = .5, color = "orange2") +
labs(
title = "Population survival distribution",
subtitle = "The Gaussians are on the log-odds scale."
) +
scale_y_continuous(NULL, breaks = NULL) +
coord_cartesian(xlim = c(-3, 4)) +
theme_fivethirtyeight() +
theme(
plot.title = element_text(size = 13),
plot.subtitle = element_text(size = 10)
)
https://raw.githubusercontent.com/gglee4ai/public/master/sample35.png
Fig. 12.2.b without zig-zag lines
sample_n: 30
set.seed(12)
post %>%
sample_n(30, replace = FALSE) %>%
expand(nesting(iter, b_Intercept, sd_tank__Intercept),
x = seq(-4, 5, length.out = 100)
) %>%
mutate(
y = dnorm(x, b_Intercept, sd_tank__Intercept)
) %>%
ggplot(aes(x = x, y = y, group = iter)) +
geom_line(alpha = .5, color = "orange2") +
labs(
title = "Population survival distribution",
subtitle = "The Gaussians are on the log-odds scale."
) +
scale_y_continuous(NULL, breaks = NULL) +
coord_cartesian(xlim = c(-3, 4)) +
theme_fivethirtyeight() +
theme(
plot.title = element_text(size = 13),
plot.subtitle = element_text(size = 10)
)
https://raw.githubusercontent.com/gglee4ai/public/master/sample30.png
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.
Related Issues (20)
- Error when building the index.Rmd HOT 1
- start using `tidyr::crossing()`
- Section 3.2.2 normalizing constant typo (?) HOT 1
- model 10.16
- Errata
- effective samples
- typos
- gp() HOT 1
- softmax HOT 1
- me() to be depreciated HOT 1
- mi() in chapter 14
- embed_url()
- Book takes several minutes to allow interaction
- New book: An Introduction to Bayesian Data Analysis for Cognitive Science
- urbnmapr HOT 1
- A minor ggplot() code update HOT 1
- request: embed hypothes.is HOT 3
- Section 4.4.3.4. Predictions for E{height} at a given weight. HOT 3
- Section 4.4.3.5 Using `nesting` when doing posterior calculations HOT 1
- Post-treatment bias clarity
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statistical_rethinking_with_brms_ggplot2_and_the_tidyverse.