Skip to content

Instantly share code, notes, and snippets.

@leobarone
Created May 17, 2019 20:40
Show Gist options
  • Save leobarone/7df6235a2e9e5789058cdb859f221dd3 to your computer and use it in GitHub Desktop.
Save leobarone/7df6235a2e9e5789058cdb859f221dd3 to your computer and use it in GitHub Desktop.
Probabilidade condicional do nascimento
prob_diaria <- function(dias_passados){
dia_quantile <- seq(from = -2,
to = 2,
length.out = 30)
prob <- pnorm(dia_quantile)
prob <- c(prob[1], prob[2:29] - prob[1:28], prob[1])
d <- data.frame(dia = (40 * 7 - 15):(40 * 7 + 14),
prob)
d <- d[(dias_passados + 1):nrow(d),]
d$prob <- d$prob / sum(d$prob)
return(d)
}
prob_diaria(7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment