# NOT RUN {
# prepare a subset of the Blanford data for analysis
data01 <- subset(data_blanford,
(data_blanford$block == 3) &
(data_blanford$treatment == 'cont') &
(data_blanford$day > 0))
# check data frame for names of columns
head(data01)
# step #1: 'prep function' linking 'nll_controls' to data
# and identifying parameters to estimate
m01_prep_function <- function(a1 = a1, b1 = b1){
nll_controls(
a1 = a1, b1 = b1,
data = data01,
time = t,
censor = censor,
d1 = 'Weibull'
)}
# step #2: send 'prep_function' to mle2 for maximum likelihood estimation
# specifying starting values
m01 <- mle2(m01_prep_function,
start = list(a1 = 2, b1 = 0.5)
)
summary(m01)
# }
Run the code above in your browser using DataLab