# Generate five datasets following SFO kinetics
sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
dt50_sfo_in_pop <- 50
k_in_pop <- log(2) / dt50_sfo_in_pop
set.seed(1234)
k_in <- rlnorm(5, log(k_in_pop), 0.5)
SFO <- mkinmod(parent = mkinsub("SFO"))
pred_sfo <- function(k) {
mkinpredict(SFO,
c(k_parent = k),
c(parent = 100),
sampling_times)
}
ds_sfo_mean <- lapply(k_in, pred_sfo)
names(ds_sfo_mean) <- paste("ds", 1:5)
set.seed(12345)
ds_sfo_syn <- lapply(ds_sfo_mean, function(ds) {
add_err(ds,
sdfunc = function(value) sqrt(1^2 + value^2 * 0.07^2),
n = 1)[[1]]
})
if (FALSE) {
# Evaluate using mmkin and nlme
library(nlme)
f_mmkin <- mmkin("SFO", ds_sfo_syn, quiet = TRUE, error_model = "tc", cores = 1)
f_nlme <- nlme(f_mmkin)
summary(f_nlme, data = TRUE)
}
Run the code above in your browser using DataLab