# NOT RUN {
# example using data from Parker et al
data01 <- data_parker
# step #1: parameterise nll function to be passed to 'mle2'
m01_prep_function <- function(
a1 = a1, b1 = b1, a2 = a2, b2 = b2, a3 = a3, b3 = b3, p1 = p1){
nll_two_inf_subpops_unobs(
a1 = a1, b1 = b1, a2 = a2, b2 = b2, a3 = a3, b3 = b3, p1 = p1,
data = data01,
time = t,
censor = censored,
infected_treatment = g,
d1 = "Frechet",
d2 = "Weibull",
d3 = "Weibull"
)}
# step #2: send 'prep_function' to 'mle2' for maximum likelihood estimation
m01 <- mle2(
m01_prep_function,
start = list(a1 = 2, b1 = 1,
a2 = 2, b2 = 0.3,
a3 = 2, b3 = 0.7,
p1 = 0.5)
)
summary(m01)
# }
Run the code above in your browser using DataLab