# example from blogpost:
# https://www.johndcook.com/blog/2010/01/31/parameters-from-percentiles/
# 10% of patients respond within 30 days of treatment
# and 80% respond within 90 days of treatment
find_normal(x1 = 30, p1 = .1, x2 = 90, p2 = .8)
find_cauchy(x1 = 30, p1 = .1, x2 = 90, p2 = .8)
parms <- find_normal(x1 = 30, p1 = .1, x2 = 90, p2 = .8)
curve(
dnorm(x, mean = parms$mean, sd = parms$sd),
from = 0, to = 200
)
parms <- find_cauchy(x1 = 30, p1 = .1, x2 = 90, p2 = .8)
curve(
dcauchy(x, location = parms$location, scale = parms$scale),
from = 0, to = 200
)
find_beta2(x = .25, ci = .5)
shapes <- find_beta2(x = .25, ci = .5)
curve(dbeta(x, shapes[[1]], shapes[[2]]))
# find Beta distribution for 3 events out of 20 observations
find_beta2(x = 3, n = 20)
shapes <- find_beta2(x = 3, n = 20)
curve(dbeta(x, shapes[[1]], shapes[[2]]))
Run the code above in your browser using DataLab