Last active
March 9, 2017 11:44
-
-
Save ldeassis/3aee619031dfa5a41f66cd0ac9dd6c02 to your computer and use it in GitHub Desktop.
Cálculos de quantis distribuição beta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Brincando de Estatística Bayesiana | |
# | |
require(tidyverse) | |
n1 <- 9.5 | |
n2 <- 0.5 | |
n<-68 | |
n.inocente<- 68 | |
n.culpado <- n-n.inocente | |
# priori | |
qbeta(c(0.025,0.975), n1,n2) | |
#posteriori | |
qbeta(c(0.025,0.975), n1+n.culpado,n2+n.inocente) | |
x<-rbeta(1000, n1+n.culpado,n2+n.inocente) | |
y<-rbeta(1000, n1,n2) | |
sim.beta <- | |
data.frame( | |
data= | |
c(y,x), | |
kind= | |
factor( | |
c( | |
rep('Priori',length(y)), | |
rep('Posteriori',length(x)) | |
) | |
) | |
) | |
ggplot(data=sim.beta, aes(data, fill=kind)) + | |
geom_density() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment