# NOT RUN {
data01 <- data_lorenz
# create column 'reference_virulence' with values of 1 and 2 when
# Infectious.dose = 5000 and 160000, respectively, otherwise 0
data01$reference_virulence <- ifelse(data01$g == 0, 0,
ifelse(data01$g == 1, ifelse(data01$Infectious.dose == 5000, 1,
ifelse(data01$Infectious.dose == 160000, 2, 0)), 0)
)
m01_prep_function <- function(
a1 = a1, b1 = b1, a2 = a2, b2 = b2, theta = theta){
nll_proportional_virulence(
a1 = a1, b1 = b1, a2 = a2, b2 = b2, theta = theta,
data = data01,
time = t,
censor = censored,
infected_treatment = g,
reference_virulence = reference_virulence,
d1 = 'Gumbel', d2 = 'Weibull')
}
m01 <- mle2(m01_prep_function,
start = list(a1 = 23, b1 = 5, a2 = 4, b2 = 0.2, theta = 1)
)
summary(m01)
# virulence in the high dose treatment is estimated as
# ~ 6x greater than in the low dose treatment
# }
Run the code above in your browser using DataLab