# The kinetic model
m_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
M1 = mkinsub("SFO"), use_of_ff = "max")
# Generate a prediction for a specific set of parameters
sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
# This is the prediction used for the "Type 2 datasets" on the Piacenza poster
# from 2015
d_SFO_SFO <- mkinpredict(m_SFO_SFO,
c(k_parent = 0.1, f_parent_to_M1 = 0.5,
k_M1 = log(2)/1000),
c(parent = 100, M1 = 0),
sampling_times)
# Add an error term with a constant (independent of the value) standard deviation
# of 10, and generate three datasets
d_SFO_SFO_err <- add_err(d_SFO_SFO, function(x) 10, n = 3, seed = 123456789 )
# Name the datasets for nicer plotting
names(d_SFO_SFO_err) <- paste("Dataset", 1:3)
# Name the model in the list of models (with only one member in this case) for
# nicer plotting later on. Be quiet and use only one core not to offend CRAN
# checks
if (FALSE) {
f_SFO_SFO <- mmkin(list("SFO-SFO" = m_SFO_SFO),
d_SFO_SFO_err, cores = 1,
quiet = TRUE)
plot(f_SFO_SFO)
# We would like to inspect the fit for dataset 3 more closely
# Using double brackets makes the returned object an mkinfit object
# instead of a list of mkinfit objects, so plot.mkinfit is used
plot(f_SFO_SFO[[3]], show_residuals = TRUE)
# If we use single brackets, we should give two indices (model and dataset),
# and plot.mmkin is used
plot(f_SFO_SFO[1, 3])
}
Run the code above in your browser using DataLab