diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-09 21:18:42 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-09 21:18:42 +0200 |
commit | efab37957381919c21d874906ce870f4941c760a (patch) | |
tree | d485fa148ec1513a0c0810780a1ed10c4f9097d2 /man/mkinpredict.Rd | |
parent | 47ef00e3d0a961f8fbecf0bd5da0283bed21bb96 (diff) |
Avoid the call to merge for analytical solutions
This increases performance up to a factor of five!
Diffstat (limited to 'man/mkinpredict.Rd')
-rw-r--r-- | man/mkinpredict.Rd | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd index f7e4acfc..1ba5b5f8 100644 --- a/man/mkinpredict.Rd +++ b/man/mkinpredict.Rd @@ -91,7 +91,7 @@ FALSE).} solver is used.} } \value{ -A matrix in the same format as the output of \code{\link{ode}}. +A data frame with the solution in wide format } \description{ This function produces a time series for all the observed variables in a @@ -131,30 +131,35 @@ mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), # Check compiled model versions - they are faster than the eigenvalue based solutions! SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"), use_of_ff = "min") + m1 = list(type = "SFO"), use_of_ff = "max") if(require(rbenchmark)) { - benchmark( - eigen = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + benchmark(replications = 10, order = "relative", columns = c("test", "relative", "elapsed"), + eigen = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "eigen")[201,], - deSolve_compiled = mkinpredict(SFO_SFO, - c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + deSolve_compiled = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "deSolve")[201,], - deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), - solution_type = "deSolve", use_compiled = FALSE)[201,], - replications = 10) + deSolve = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "deSolve", use_compiled = FALSE)[201,], + analytical = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "analytical", use_compiled = FALSE)[201,]) } - -# Since mkin 0.9.49.11 we also have analytical solutions for some models, including SFO-SFO -# deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), -# c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), -# solution_type = "analytical", use_compiled = FALSE)[201,], + analytical = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "analytical", use_compiled = FALSE)[201,] \dontrun{ # Predict from a fitted model f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) + f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE, solution_type = "analytical") head(mkinpredict(f)) } |