diff options
Diffstat (limited to 'man')
-rw-r--r-- | man/mkinds.Rd | 2 | ||||
-rw-r--r-- | man/mkinfit.Rd | 8 | ||||
-rw-r--r-- | man/mkinpredict.Rd | 108 |
3 files changed, 63 insertions, 55 deletions
diff --git a/man/mkinds.Rd b/man/mkinds.Rd index 3bbb1c4b..8d1860e8 100644 --- a/man/mkinds.Rd +++ b/man/mkinds.Rd @@ -47,6 +47,7 @@ and value in order to be compatible with mkinfit} } \if{html}{\out{<hr>}} \if{html}{\out{<a id="method-new"></a>}} +\if{latex}{\out{\hypertarget{method-new}{}}} \subsection{Method \code{new()}}{ Create a new mkinds object \subsection{Usage}{ @@ -69,6 +70,7 @@ Create a new mkinds object } \if{html}{\out{<hr>}} \if{html}{\out{<a id="method-clone"></a>}} +\if{latex}{\out{\hypertarget{method-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/mkinfit.Rd b/man/mkinfit.Rd index 45036361..89d2ddd6 100644 --- a/man/mkinfit.Rd +++ b/man/mkinfit.Rd @@ -28,8 +28,8 @@ mkinfit( rtol = 1e-10, n.outtimes = 100, error_model = c("const", "obs", "tc"), - error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep", "fourstep", - "IRLS", "OLS"), + error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep", + "fourstep", "IRLS", "OLS"), reweight.tol = 1e-08, reweight.max.iter = 10, trace_parms = FALSE, @@ -238,13 +238,13 @@ SFO_SFO <- mkinmod( # Fit the model to the FOCUS example dataset D using defaults print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE))) -coef(fit) +parms(fit) endpoints(fit) \dontrun{ # deSolve is slower when no C compiler (gcc) was available during model generation print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve"))) -coef(fit.deSolve) +parms(fit.deSolve) endpoints(fit.deSolve) } diff --git a/man/mkinpredict.Rd b/man/mkinpredict.Rd index 17d7ef21..366d5b83 100644 --- a/man/mkinpredict.Rd +++ b/man/mkinpredict.Rd @@ -100,57 +100,63 @@ kinetic parameters and initial values for the state variables. } \examples{ - SFO <- mkinmod(degradinol = mkinsub("SFO")) - # Compare solution types - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "analytical") - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "deSolve") - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "deSolve", use_compiled = FALSE) - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "eigen") - - - # Compare integration methods to analytical solution - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - solution_type = "analytical")[21,] - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "lsoda")[21,] - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "ode45")[21,] - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, - method = "rk4")[21,] - # 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,] - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.01))[2001,] - - # 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), - solution_type = "eigen")[201,])) - 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 = "deSolve")[201,])) - 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 = "deSolve", use_compiled = FALSE)[201,])) - - \dontrun{ - # Predict from a fitted model - f <- mkinfit(SFO_SFO, FOCUS_2006_C) - head(mkinpredict(f)) - } +SFO <- mkinmod(degradinol = mkinsub("SFO")) +# Compare solution types +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical") +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve") +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve", use_compiled = FALSE) +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "eigen") + +# Compare integration methods to analytical solution +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical")[21,] +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "lsoda")[21,] +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "ode45")[21,] +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + method = "rk4")[21,] +# 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,] +mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.01))[2001,] + +# 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")) +if(require(rbenchmark)) { + benchmark( + eigen = 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,], + deSolve_compiled = 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,], + 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) +} + +# 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,], + +\dontrun{ + # Predict from a fitted model + f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) + head(mkinpredict(f)) +} } \author{ |