res_weibull = getWeilbull(dat_udca)
res_beta = getBeta(as.numeric(dat_udca$entry.dt))
prop = c(table(dat_udca$group)/length(dat_udca$group))
SHAPEV = res_weibull$shape
SCALEV = res_weibull$scale
LAMW = rep(-log(1 - 0.1)/6, 4)
A = rep(res_beta$a/30.416, 4) # convert days to months
BETA = rep(res_beta$b_Mean, 4)
myres1 = calcDuration(d=50, n=169, proportion=prop, SHAPEV, SCALEV, LAMW=LAMW, A, BETA)
c(myres1$d_lower, myres1$d_med, myres1$d_upper)
# drop-out will make the target number of events not achievable
myres2 = calcDuration(d=80, n=169, proportion=prop, SHAPEV, SCALEV, LAMW=LAMW, A, BETA)
c(myres2$d_lower, myres2$d_med, myres2$d_upper)
# If there is no drop-out
myres3 = calcDuration(d=80, n=169, proportion=prop, SHAPEV, SCALEV, LAMW=rep(0, 4), A, BETA)
c(myres3$d_lower, myres3$d_med, myres3$d_upper)
Run the code above in your browser using DataLab