Mtext("distribution of female admission rates") # draw 50 beta distributions sampled from posteriorĬurve( dbeta2(x, p, theta), add=T,col=col.alpha("black", 0.2)) Ylab="Density", xlab="probability admit", ylim=c(0,3), lwd=2) We can visualize the posterior Beta-distribution: gid <- 2Ĭurve( dbeta2(x, mean( logistic(post$a)), mean(post$theta)), from=0, to=1, This might suggest there is a diffenrece in admission rates by gender, but the posterior difference da is highly uncertain with probability mass both above and below zero. data("UCBadmit")ĭ$gid <- ifelse(d$applicant.gender = "male", 1L, 2L)ĭat <- list(A = d$admit, N = d$applications, gid=d$gid) Where \(A\) is admit, \(N\) is the number of applications applications, and GID \(\) is gender id, 1 for male and 2 for female. ![]() There are different ways to parametrize the beta distribution: dbeta2 <- function( x, prob, theta, log=FALSE ) ) \\ library(rethinking)Ĭurve( dbeta2( x, pbar, theta), from=0, to=1, xlab="probability", ylab="Density") ![]() The beta distribution is a probability distribution over probabilities (over the interval \(\)). For the beta-binomial model, we’ll make use of the beta distribution.
0 Comments
Leave a Reply. |