From e05656d57668688b971c28e32b4cfd4d3eac4662 Mon Sep 17 00:00:00 2001
From: Johannes Ranke mkinpredict(x, odeparms, odeini, outtimes = seq(0, 120, by = 0.1),
+
mkinpredict(x, odeparms, odeini, outtimes = seq(0, 120, by = 0.1),
solution_type = "deSolve", use_compiled = "auto", method.ode = "lsoda",
atol = 1e-08, rtol = 1e-10, map_output = TRUE, ...)
@@ -200,7 +204,7 @@
variables (default) or for all state variables (if set to FALSE).
Further arguments passed to the ode solver in case such a solver is used.
+#> 6 0.5 70.78673 5.441679SFO <- mkinmod(degradinol = mkinsub("SFO")) # Compare solution types - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "analytical")#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -235,7 +239,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -257,7 +261,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "deSolve", use_compiled = FALSE)#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -279,7 +283,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -304,42 +308,43 @@ #> 21 20 0.2478752# Compare integration methods to analytical solution - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "analytical")[21,]#> time degradinol -#> 21 20 0.2478752#> time degradinol -#> 21 20 0.2478752#> time degradinol -#> 21 20 0.2478752#> time degradinol #> 21 20 0.2480043# rk4 is not as precise here # The number of output times used to make a lot of difference until the # default for atol was adjusted - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.1))[201,]#> time degradinol -#> 201 20 0.2478752#> time degradinol + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.1))[201,]#> time degradinol +#> 201 20 0.2478752#> time degradinol #> 2001 20 0.2478752# 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"))#>system.time( - print(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), + SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"))#>system.time( + print(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 = "eigen")[201,]))#> time parent m1 #> 201 20 4.978707 27.46227#> User System verstrichen -#> 0.003 0.000 0.003system.time( - print(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), +#> 0.004 0.000 0.003system.time( + print(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")[201,]))#> time parent m1 #> 201 20 4.978707 27.46227#> User System verstrichen -#> 0.001 0.000 0.002system.time( - print(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), +#> 0.002 0.000 0.001system.time( + print(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,]))#> time parent m1 #> 201 20 4.978707 27.46227#> User System verstrichen -#> 0.022 0.000 0.021-# Predict from a fitted model +#> 0.021 0.000 0.021#>#> Sum of squared residuals at call 1: 552.5739 #> Sum of squared residuals at call 3: 552.5739 #> Sum of squared residuals at call 4: 552.5739 @@ -368,13 +373,14 @@ #> Sum of squared residuals at call 59: 196.5334 #> Sum of squared residuals at call 65: 196.5334 #> Sum of squared residuals at call 73: 196.5334 -#> Negative log-likelihood at call 75: 26.64668#>#> time parent m1 +#> Negative log-likelihood at call 75: 26.64668#>#> time parent m1 #> 1 0.0 82.49216 0.000000 #> 2 0.1 80.00563 1.179955 #> 3 0.2 77.59404 2.312580 #> 4 0.3 75.25515 3.399419 #> 5 0.4 72.98675 4.441969 -#> 6 0.5 70.78673 5.441679