Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2H4 #1

Open
alecloudenback opened this issue Jun 8, 2019 · 1 comment
Open

2H4 #1

alecloudenback opened this issue Jun 8, 2019 · 1 comment

Comments

@alecloudenback
Copy link

Hello,

Thank you for posting a set of solutions!

For 2H4, I believe that the intent of the question is that you use the posterior from the birthing solution as your prior for the analysis with the genetic test. See here:

https://konradsenf.com/statistical-rethinking-chapter-2/

@alecloudenback alecloudenback changed the title Chapter 2H4 2H4 Jun 8, 2019
@gifuni
Copy link

gifuni commented Sep 16, 2019

Hi,
Wonderful set of solutions indeed.
2H4 is not entirely clear if we should accont for the first birth or both. However, nothing is more simple than adding an extra Bayesian update :

#p1
likelihood_test <- c(0.8, 1-0.65)
prior <- c(1, 1)
posterior_vet <- prior * likelihood_test
posterior_vet <- posterior_vet/sum(posterior_vet)

posterior_vet[1] #0.6956522
#p2
p_twins_A <- 0.1
p_twins_B <- 0.2
likelihood_twins <- c(p_twins_A, p_twins_B)
prior <- posterior_vet
posterior <- prior * likelihood_twins
posterior <- posterior/sum(posterior)

posterior[1] #0.5333333

#p3
p_singles_A <- 1 - 0.1
p_singles_B <- 1 - 0.2
likelihood_singles <- c(p_singles_A, p_singles_B)
prior <- posterior
posterior <- prior * likelihood_singles
posterior <- posterior/sum(posterior)

posterior[1] #0.5625```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants