# NOT RUN {
# step #1: prepare nll function for analysis
m01_prep_function <- function(a1 = a1, b1 = b1, a2 = a2, b2 = b2, theta = theta){
nll_frailty_shared(a1 = a1, b1 = b1, a2 = a2, b2 = b2, theta = theta,
data = data_lorenz,
time = t,
censor = censored,
infected_treatment = g,
d1 = "Gumbel", d2 = "Gumbel"
)}
# step #2: send 'prep_function' to mle2 for maximum likelihood estimation,
# specifying starting values
m01 <- mle2(m01_prep_function,
start = list(a1 = 23, b1 = 5, a2 = 10, b2 = 1, theta = 1),
method = "Nelder-Mead",
control = list(maxit = 5000)
)
summary(m01)
# }
Run the code above in your browser using DataLab