diff options
37 files changed, 600 insertions, 129 deletions
| @@ -1,8 +1,11 @@ -# mkin 0.9.49.4 (2019-05-07) +# mkin 0.9.49.4 (2019-05-08) +  - Direct minimization of the negative log-likelihood for non-constant error models (two-component and variance by variable). In the case the error model is constant variance, least squares is used as this is more stable  - The argument 'reweight.method' to mkinfit and mmkin is now obsolete, use 'error_model' instead +- New function 'mkinerrplot'. This function is also used for residual plots in 'plot.mmkin' if the argument 'resplot = "errmod"' is given, and in 'plot.mkinfit' if 'show_errplot' is set to TRUE. +  - Remove dependency on FME, only use nlminb for optimisation  - Use the numDeriv package to calculate hessians diff --git a/R/mkinerrplot.R b/R/mkinerrplot.R new file mode 100644 index 00000000..a2adcefa --- /dev/null +++ b/R/mkinerrplot.R @@ -0,0 +1,84 @@ +# Copyright (C) 2008-2014,2019 Johannes Ranke +# Contact: jranke@uni-bremen.de + +# This file is part of the R package mkin + +# mkin is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more +# details. + +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <http://www.gnu.org/licenses/> +if(getRversion() >= '2.15.1') utils::globalVariables(c("variable", "residual")) + +mkinerrplot <- function (object, +  obs_vars = names(object$mkinmod$map), +  xlim = c(0, 1.1 * max(object$data$predicted)), +  xlab = "Predicted", ylab = "Squared residual", +  maxy = "auto", legend= TRUE, lpos = "topright",  +  col_obs = "auto", pch_obs = "auto", +  ...) +{ +  obs_vars_all <- as.character(unique(object$data$variable)) + +  if (length(obs_vars) > 0){ +      obs_vars <- intersect(obs_vars_all, obs_vars) +  } else obs_vars <- obs_vars_all + +  residuals <- subset(object$data, variable %in% obs_vars, residual) + +  if (maxy == "auto") maxy = max(residuals^2, na.rm = TRUE) + +  # Set colors and symbols +  if (col_obs[1] == "auto") { +    col_obs <- 1:length(obs_vars) +  } + +  if (pch_obs[1] == "auto") { +    pch_obs <- 1:length(obs_vars) +  } +  names(col_obs) <- names(pch_obs) <- obs_vars + +  plot(0, type = "n", +       xlab = xlab, ylab = ylab, +       xlim = xlim, +       ylim = c(0, 1.2 * maxy), ...) + +  for(obs_var in obs_vars){ +    residuals_plot <- subset(object$data, variable == obs_var, c("predicted", "residual")) +    points(residuals_plot[["predicted"]], +           residuals_plot[["residual"]]^2, +           pch = pch_obs[obs_var], col = col_obs[obs_var]) +  } + +  if (object$err_mod == "const") { +    abline(h = object$errparms^2, lty = 2, col = col_obs[obs_var]) +  } +  if (object$err_mod == "obs") { +    for (obs_var in obs_vars) { +      sigma_name = paste0("sigma_", obs_var) +      abline(h = object$errparms[sigma_name]^2, lty = 2, +             col = col_obs[obs_var]) +    } +  } +  if (object$err_mod == "tc") { +    sigma_plot <- function(predicted) { +      sigma_twocomp(predicted, +                    sigma_low = object$errparms[1], +                    rsd_high = object$errparms[2])^2 +    } +    plot(sigma_plot, from = 0, to = max(object$data$predicted), +         add = TRUE, lty = 2, col = col_obs[obs_var]) +  } + +  if (legend == TRUE) { +    legend(lpos, inset = c(0.05, 0.05), legend = obs_vars, +      col = col_obs[obs_vars], pch = pch_obs[obs_vars]) +  } +} diff --git a/R/mkinresplot.R b/R/mkinresplot.R index 3650ef4b..739a80e9 100644 --- a/R/mkinresplot.R +++ b/R/mkinresplot.R @@ -23,7 +23,7 @@ mkinresplot <- function (object,    xlab = "Time", ylab = "Residual",
    maxabs = "auto", legend= TRUE, lpos = "topright", ...)
  {
 -	obs_vars_all <- as.character(unique(object$data$variable))
 +  obs_vars_all <- as.character(unique(object$data$variable))
    if (length(obs_vars) > 0){
        obs_vars <- intersect(obs_vars_all, obs_vars)
 @@ -33,18 +33,18 @@ mkinresplot <- function (object,    if (maxabs == "auto") maxabs = max(abs(residuals), na.rm = TRUE)
 -	col_obs <- pch_obs <- 1:length(obs_vars)
 - 	names(col_obs) <- names(pch_obs) <- obs_vars
 +  col_obs <- pch_obs <- 1:length(obs_vars)
 +  names(col_obs) <- names(pch_obs) <- obs_vars
    plot(0, type = "n",
         xlab = xlab, ylab = ylab,
         xlim = xlim,
         ylim = c(-1.2 * maxabs, 1.2 * maxabs), ...)
 -	for(obs_var in obs_vars){
 -		residuals_plot <- subset(object$data, variable == obs_var, c("time", "residual"))
 -		points(residuals_plot, pch = pch_obs[obs_var], col = col_obs[obs_var])
 -	}
 +  for(obs_var in obs_vars){
 +    residuals_plot <- subset(object$data, variable == obs_var, c("time", "residual"))
 +    points(residuals_plot, pch = pch_obs[obs_var], col = col_obs[obs_var])
 +  }
    abline(h = 0, lty = 2)
 diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R index ee836eb8..df9888e7 100644 --- a/R/plot.mkinfit.R +++ b/R/plot.mkinfit.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2016 Johannes Ranke +# Copyright (C) 2010-2016,2019 Johannes Ranke  # Contact: jranke@uni-bremen.de  # This file is part of the R package mkin @@ -26,12 +26,16 @@ plot.mkinfit <- function(x, fit = x,    pch_obs = col_obs,    lty_obs = rep(1, length(obs_vars)),    add = FALSE, legend = !add, -  show_residuals = FALSE, maxabs = "auto", +  show_residuals = FALSE, +  show_errplot = FALSE, +  maxabs = "auto",    sep_obs = FALSE, rel.height.middle = 0.9,    lpos = "topright", inset = c(0.05, 0.05),    show_errmin = FALSE, errmin_digits = 3, ...)  {    if (add && show_residuals) stop("If adding to an existing plot we can not show residuals") +  if (add && show_errplot) stop("If adding to an existing plot we can not show the error model plot") +  if (show_residuals && show_errplot) stop("We can either show residuals over time or the error model plot, not both")    if (add && sep_obs) stop("If adding to an existing plot we can not show observed variables separately")    solution_type = fit$solution_type @@ -68,8 +72,7 @@ plot.mkinfit <- function(x, fit = x,    # Create a plot layout only if not to be added to an existing plot    # or only a single plot is requested (e.g. by plot.mmkin)    do_layout = FALSE -  if (show_residuals) do_layout = TRUE -  if (sep_obs) do_layout = TRUE +  if (show_residuals | sep_obs | show_errplot) do_layout = TRUE    n_plot_rows = if (sep_obs) length(obs_vars) else 1    if (do_layout) { @@ -78,7 +81,7 @@ plot.mkinfit <- function(x, fit = x,      # If the observed variables are shown separately, do row layout      if (sep_obs) { -      n_plot_cols = if (show_residuals) 2 else 1 +      n_plot_cols = if (show_residuals | show_errplot) 2 else 1        n_plots = n_plot_rows * n_plot_cols        # Set relative plot heights, so the first and the last plot are the norm @@ -201,6 +204,12 @@ plot.mkinfit <- function(x, fit = x,        }        abline(h = 0, lty = 2)      } + +    # Show error model plot if requested +    if (show_errplot) { +      mkinerrplot(fit, obs_vars = row_obs_vars, pch_obs = pch_obs[row_obs_vars], col_obs = col_obs[row_obs_vars], +                  legend = FALSE) +    }    }    if (do_layout) par(oldpar, no.readonly = TRUE)  } diff --git a/R/plot.mmkin.R b/R/plot.mmkin.R index ee7075d3..c9d98718 100644 --- a/R/plot.mmkin.R +++ b/R/plot.mmkin.R @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 Johannes Ranke +# Copyright (C) 2015-2016,2019 Johannes Ranke  # Contact: jranke@uni-bremen.de  # This file is part of the R package mkin @@ -16,11 +16,15 @@  # You should have received a copy of the GNU General Public License along with  # this program. If not, see <http://www.gnu.org/licenses/> -plot.mmkin <- function(x, main = "auto", legends = 1, errmin_var = "All data", errmin_digits = 3, +plot.mmkin <- function(x, main = "auto", legends = 1,  +                       resplot = c("time", "errmod"), +                       errmin_var = "All data", errmin_digits = 3,                         cex = 0.7, rel.height.middle = 0.9, ...) {    n.m <- nrow(x)    n.d <- ncol(x) +  resplot <- match.arg(resplot) +    # We can handle either a row (different models, same dataset)    # or a column (same model, different datasets)    if (n.m > 1 & n.d > 1) stop("Please select fits either for one model or for one dataset") @@ -90,7 +94,11 @@ plot.mmkin <- function(x, main = "auto", legends = 1, errmin_var = "All data", e      }      mtext(chi2_text, cex = cex, line = 0.4) -    mkinresplot(fit, legend = FALSE, ...) +    if (resplot == "time") { +      mkinresplot(fit, legend = FALSE, ...) +    } else { +      mkinerrplot(fit, legend = FALSE, ...) +    }      mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)    } diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index 644a35b5..ba694065 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -88,7 +88,7 @@        <h1>Example evaluation of FOCUS Example Dataset D</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>FOCUS_D.Rmd</code></div> @@ -168,8 +168,8 @@  <div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(fit)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:46 2019  -## Date of summary: Tue May  7 08:37:46 2019  +## Date of fit:     Wed May  8 20:52:27 2019  +## Date of summary: Wed May  8 20:52:27 2019   ##   ## Equations:  ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent @@ -177,7 +177,7 @@  ##   ## Model predictions using solution type deSolve   ##  -## Fitted using 389 model solutions performed in 1.018 s +## Fitted using 389 model solutions performed in 0.998 s  ##   ## Error model:  ## Constant variance  diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index 2cffb323..6771bf63 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -88,7 +88,7 @@        <h1>Example evaluation of FOCUS Laboratory Data L1 to L3</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>FOCUS_L.Rmd</code></div> @@ -114,15 +114,15 @@  <a class="sourceLine" id="cb2-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L1.SFO)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:48 2019  -## Date of summary: Tue May  7 08:37:48 2019  +## Date of fit:     Wed May  8 20:52:29 2019  +## Date of summary: Wed May  8 20:52:29 2019   ##   ## Equations:  ## d_parent/dt = - k_parent_sink * parent  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 133 model solutions performed in 0.284 s +## Fitted using 133 model solutions performed in 0.276 s  ##   ## Error model:  ## Constant variance  @@ -215,8 +215,8 @@  ## finite result is doubtful</code></pre>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:50 2019  -## Date of summary: Tue May  7 08:37:50 2019  +## Date of fit:     Wed May  8 20:52:31 2019  +## Date of summary: Wed May  8 20:52:31 2019   ##   ##   ## Warning: Optimisation did not converge: @@ -228,7 +228,7 @@  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 899 model solutions performed in 1.913 s +## Fitted using 899 model solutions performed in 1.868 s  ##   ## Error model:  ## Constant variance  @@ -319,15 +319,15 @@  <div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L2.FOMC, <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:51 2019  -## Date of summary: Tue May  7 08:37:51 2019  +## Date of fit:     Wed May  8 20:52:32 2019  +## Date of summary: Wed May  8 20:52:32 2019   ##   ## Equations:  ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 239 model solutions performed in 0.494 s +## Fitted using 239 model solutions performed in 0.483 s  ##   ## Error model:  ## Constant variance  @@ -394,8 +394,8 @@  <div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L2.DFOP, <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:53 2019  -## Date of summary: Tue May  7 08:37:53 2019  +## Date of fit:     Wed May  8 20:52:33 2019  +## Date of summary: Wed May  8 20:52:33 2019   ##   ## Equations:  ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -404,7 +404,7 @@  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 572 model solutions performed in 1.244 s +## Fitted using 572 model solutions performed in 1.185 s  ##   ## Error model:  ## Constant variance  @@ -493,8 +493,8 @@  <div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L3[[<span class="st">"DFOP"</span>, <span class="dv">1</span>]])</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:55 2019  -## Date of summary: Tue May  7 08:37:55 2019  +## Date of fit:     Wed May  8 20:52:35 2019  +## Date of summary: Wed May  8 20:52:35 2019   ##   ## Equations:  ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -503,7 +503,7 @@  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 373 model solutions performed in 0.791 s +## Fitted using 373 model solutions performed in 0.768 s  ##   ## Error model:  ## Constant variance  @@ -598,15 +598,15 @@  <div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L4[[<span class="st">"SFO"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:56 2019  -## Date of summary: Tue May  7 08:37:56 2019  +## Date of fit:     Wed May  8 20:52:36 2019  +## Date of summary: Wed May  8 20:52:37 2019   ##   ## Equations:  ## d_parent/dt = - k_parent_sink * parent  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 142 model solutions performed in 0.29 s +## Fitted using 142 model solutions performed in 0.289 s  ##   ## Error model:  ## Constant variance  @@ -662,15 +662,15 @@  <div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb31-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L4[[<span class="st">"FOMC"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div>  <pre><code>## mkin version used for fitting:    0.9.49.4   ## R version used for fitting:       3.6.0  -## Date of fit:     Tue May  7 08:37:56 2019  -## Date of summary: Tue May  7 08:37:56 2019  +## Date of fit:     Wed May  8 20:52:36 2019  +## Date of summary: Wed May  8 20:52:37 2019   ##   ## Equations:  ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent  ##   ## Model predictions using solution type analytical   ##  -## Fitted using 224 model solutions performed in 0.453 s +## Fitted using 224 model solutions performed in 0.45 s  ##   ## Error model:  ## Constant variance  diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html index 271da77e..c274696c 100644 --- a/docs/articles/mkin.html +++ b/docs/articles/mkin.html @@ -88,7 +88,7 @@        <h1>Introduction to mkin</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>mkin.Rmd</code></div> diff --git a/docs/articles/twa.html b/docs/articles/twa.html index 9f08036a..9f660fab 100644 --- a/docs/articles/twa.html +++ b/docs/articles/twa.html @@ -88,7 +88,7 @@        <h1>Calculation of time weighted average concentrations with mkin</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>twa.Rmd</code></div> diff --git a/docs/articles/web_only/FOCUS_Z.html b/docs/articles/web_only/FOCUS_Z.html index 3cda0261..9184fad5 100644 --- a/docs/articles/web_only/FOCUS_Z.html +++ b/docs/articles/web_only/FOCUS_Z.html @@ -88,7 +88,7 @@        <h1>Example evaluation of FOCUS dataset Z</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>FOCUS_Z.Rmd</code></div> diff --git a/docs/articles/web_only/NAFTA_examples.html b/docs/articles/web_only/NAFTA_examples.html index 237b506e..4d9e9b2d 100644 --- a/docs/articles/web_only/NAFTA_examples.html +++ b/docs/articles/web_only/NAFTA_examples.html @@ -88,7 +88,7 @@        <h1>Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>NAFTA_examples.Rmd</code></div> diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html index a250f005..a53f1927 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -88,7 +88,7 @@        <h1>Benchmark timings for mkin on various systems</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>benchmarks.Rmd</code></div> @@ -198,67 +198,67 @@  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 8.184  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 7.064  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 7.296 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 5.982 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 5.792  ##                                                                         t2  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 11.019  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 22.889  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 12.558  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 21.239 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 17.777 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 17.398  ##                                                                        t3  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 3.764  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 4.649  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 4.786  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 4.510 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.545 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.427  ##                                                                         t4  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 14.347  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 13.789  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2  8.461  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 13.805 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 16.684 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 16.104  ##                                                                        t5  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 9.495  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 6.395  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 5.675  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 7.386 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 7.868 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 7.527  ##                                                                        t6  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 2.623  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 2.542  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 2.723  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 2.643 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4  2.66 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 2.541  ##                                                                        t7  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 4.587  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 4.128  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 4.478  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 4.374 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.496 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.308  ##                                                                        t8  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 7.525  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 4.632  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 4.862  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3  7.02 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.919 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 4.775  ##                                                                         t9  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 16.621  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1  8.171  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2  7.618  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 11.124 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 11.683 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 11.116  ##                                                                       t10  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 8.576  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1 3.676  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2 3.579  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3 5.388 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 5.344 +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4 5.063  ##                                                                        t11  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.48.1 31.267  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.1  5.636  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.2  5.574  ## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.3  7.365 -## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4  7.752</code></pre> +## Linux, AMD Ryzen 7 1700 Eight-Core Processor, mkin version 0.9.49.4  7.784</code></pre>  <div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/save">save</a></span>(mkin_benchmarks, <span class="dt">file =</span> <span class="st">"~/git/mkin/vignettes/mkin_benchmarks.rda"</span>)</a></code></pre></div>  </div>    </div> diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html index 54d3148f..f296c8a4 100644 --- a/docs/articles/web_only/compiled_models.html +++ b/docs/articles/web_only/compiled_models.html @@ -88,7 +88,7 @@        <h1>Performance benefit by using compiled model definitions in mkin</h1>                          <h4 class="author">Johannes Ranke</h4> -            <h4 class="date">2019-05-07</h4> +            <h4 class="date">2019-05-08</h4>        <div class="hidden name"><code>compiled_models.Rmd</code></div> @@ -163,9 +163,9 @@  ## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet  ## = TRUE): Observations with value of zero were removed from the data</code></pre>  <pre><code>##                    test replications elapsed relative user.self sys.self -## 3     deSolve, compiled            3   3.067    1.000     3.065        0 -## 1 deSolve, not compiled            3  28.135    9.173    28.122        0 -## 2      Eigenvalue based            3   4.306    1.404     4.303        0 +## 3     deSolve, compiled            3   3.131    1.000     3.129        0 +## 1 deSolve, not compiled            3  28.306    9.041    28.290        0 +## 2      Eigenvalue based            3   4.361    1.393     4.358        0  ##   user.child sys.child  ## 3          0         0  ## 1          0         0 @@ -214,8 +214,8 @@  ## Warning in mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE): Observations with  ## value of zero were removed from the data</code></pre>  <pre><code>##                    test replications elapsed relative user.self sys.self -## 2     deSolve, compiled            3   4.827    1.000     4.825        0 -## 1 deSolve, not compiled            3  52.646   10.907    52.622        0 +## 2     deSolve, compiled            3   5.023    1.000     5.021        0 +## 1 deSolve, not compiled            3  53.267   10.605    53.235        0  ##   user.child sys.child  ## 2          0         0  ## 1          0         0</code></pre> diff --git a/docs/news/index.html b/docs/news/index.html index d165b6f9..11414ed3 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -122,13 +122,14 @@      </div> -    <div id="mkin-0-9-49-4-2019-05-07" class="section level1"> +    <div id="mkin-0-9-49-4-2019-05-08" class="section level1">  <h1 class="page-header"> -<a href="#mkin-0-9-49-4-2019-05-07" class="anchor"></a>mkin 0.9.49.4 (2019-05-07)<small> Unreleased </small> +<a href="#mkin-0-9-49-4-2019-05-08" class="anchor"></a>mkin 0.9.49.4 (2019-05-08)<small> Unreleased </small>  </h1>  <ul>  <li><p>Direct minimization of the negative log-likelihood for non-constant error models (two-component and variance by variable). In the case the error model is constant variance, least squares is used as this is more stable</p></li>  <li><p>The argument ‘reweight.method’ to mkinfit and mmkin is now obsolete, use ‘error_model’ instead</p></li> +<li><p>New function ‘mkinerrplot’. This function is also used for residual plots in ‘plot.mmkin’ if the argument ‘resplot = “errmod”’ is given, and in ‘plot.mkinfit’ if ‘show_errplot’ is set to TRUE.</p></li>  <li><p>Remove dependency on FME, only use nlminb for optimisation</p></li>  <li><p>Use the numDeriv package to calculate hessians</p></li>  <li><p>Add a benchmark vignette to document the impact on performance. For very simple fits, the new code is a bit slower, presumably because of the time it takes to calculate the hessian matrices with and without parameter transformation</p></li> @@ -695,7 +696,7 @@      <div id="tocnav">        <h2>Contents</h2>        <ul class="nav nav-pills nav-stacked"> -        <li><a href="#mkin-0-9-49-4-2019-05-07">0.9.49.4</a></li> +        <li><a href="#mkin-0-9-49-4-2019-05-08">0.9.49.4</a></li>          <li><a href="#mkin-0-9-48-1-2019-03-04">0.9.48.1</a></li>          <li><a href="#mkin-0-9-47-5-2018-09-14">0.9.47.5</a></li>          <li><a href="#mkin-0-9-47-3">0.9.47.3</a></li> diff --git a/docs/reference/mkinerrplot-1.png b/docs/reference/mkinerrplot-1.pngBinary files differ new file mode 100644 index 00000000..9c663646 --- /dev/null +++ b/docs/reference/mkinerrplot-1.png diff --git a/docs/reference/mkinerrplot.html b/docs/reference/mkinerrplot.html new file mode 100644 index 00000000..66da40b5 --- /dev/null +++ b/docs/reference/mkinerrplot.html @@ -0,0 +1,250 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html lang="en"> +  <head> +  <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Function to plot squared residuals and the error model for an mkin object — mkinerrplot • mkin</title> + +<!-- jquery --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" /> +<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" /> + +<!-- clipboard.js --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script> + +<!-- sticky kit --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script> + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../pkgdown.js"></script> + + + +<meta property="og:title" content="Function to plot squared residuals and the error model for an mkin object — mkinerrplot" /> + +<meta property="og:description" content="This function plots the squared residuals for the specified subset of the +  observed variables from an mkinfit object. In addition, one or more +  dashed line(s) show the fitted error model. +  A combined plot of the fitted model and this error model plot can be +  obtained with plot.mkinfit +  using the argument show_errplot = TRUE." /> +<meta name="twitter:card" content="summary" /> + + + +<!-- mathjax --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + + +  </head> + +  <body> +    <div class="container template-reference-topic"> +      <header> +      <div class="navbar navbar-default navbar-fixed-top" role="navigation"> +  <div class="container"> +    <div class="navbar-header"> +      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"> +        <span class="sr-only">Toggle navigation</span> +        <span class="icon-bar"></span> +        <span class="icon-bar"></span> +        <span class="icon-bar"></span> +      </button> +      <span class="navbar-brand"> +        <a class="navbar-link" href="../index.html">mkin</a> +        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.4</span> +      </span> +    </div> + +    <div id="navbar" class="navbar-collapse collapse"> +      <ul class="nav navbar-nav"> +        <li> +  <a href="../reference/index.html">Functions and data</a> +</li> +<li class="dropdown"> +  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> +    Articles +      +    <span class="caret"></span> +  </a> +  <ul class="dropdown-menu" role="menu"> +    <li> +      <a href="../articles/mkin.html">Introduction to mkin</a> +    </li> +    <li> +      <a href="../articles/FOCUS_D.html">Example evaluation of FOCUS Example Dataset D</a> +    </li> +    <li> +      <a href="../articles/FOCUS_L.html">Example evaluation of FOCUS Laboratory Data L1 to L3</a> +    </li> +    <li> +      <a href="../articles/web_only/FOCUS_Z.html">Example evaluation of FOCUS Example Dataset Z</a> +    </li> +    <li> +      <a href="../articles/web_only/compiled_models.html">Performance benefit by using compiled model definitions in mkin</a> +    </li> +    <li> +      <a href="../articles/twa.html">Calculation of time weighted average concentrations with mkin</a> +    </li> +    <li> +      <a href="../articles/web_only/NAFTA_examples.html">Example evaluation of NAFTA SOP Attachment examples</a> +    </li> +  </ul> +</li> +<li> +  <a href="../news/index.html">News</a> +</li> +      </ul> +       +      <ul class="nav navbar-nav navbar-right"> +         +      </ul> +       +    </div><!--/.nav-collapse --> +  </div><!--/.container --> +</div><!--/.navbar --> + +       +      </header> + +<div class="row"> +  <div class="col-md-9 contents"> +    <div class="page-header"> +    <h1>Function to plot squared residuals and the error model for an mkin object</h1> +     +    <div class="hidden name"><code>mkinerrplot.Rd</code></div> +    </div> + +    <div class="ref-description"> +     +    <p>This function plots the squared residuals for the specified subset of the +  observed variables from an mkinfit object. In addition, one or more +  dashed line(s) show the fitted error model. +  A combined plot of the fitted model and this error model plot can be +  obtained with <code><a href='plot.mkinfit.html'>plot.mkinfit</a></code> +  using the argument <code>show_errplot = TRUE</code>.</p> +     +    </div> + +    <pre class="usage"><span class='fu'>mkinerrplot</span>(<span class='no'>object</span>, +    <span class='kw'>obs_vars</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/names'>names</a></span>(<span class='no'>object</span>$<span class='no'>mkinmod</span>$<span class='no'>map</span>), +    <span class='kw'>xlim</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1.1</span> * <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/Extremes'>max</a></span>(<span class='no'>object</span>$<span class='no'>data</span>$<span class='no'>predicted</span>)), +    <span class='kw'>xlab</span> <span class='kw'>=</span> <span class='st'>"Predicted"</span>, <span class='kw'>ylab</span> <span class='kw'>=</span> <span class='st'>"Squared residual"</span>, +    <span class='kw'>maxy</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, <span class='kw'>legend</span><span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='st'>"topright"</span>, +    <span class='kw'>col_obs</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, <span class='kw'>pch_obs</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, +    <span class='no'>...</span>)</pre> +     +    <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> +    <table class="ref-arguments"> +    <colgroup><col class="name" /><col class="desc" /></colgroup> +    <tr> +      <th>object</th> +      <td><p>A fit represented in an <code><a href='mkinfit.html'>mkinfit</a></code> object.</p></td> +    </tr> +    <tr> +      <th>obs_vars</th> +      <td><p>A character vector of names of the observed variables for which residuals +    should be plotted. Defaults to all observed variables in the model</p></td> +    </tr> +    <tr> +      <th>xlim</th> +      <td><p>plot range in x direction.</p></td> +    </tr> +    <tr> +      <th>xlab</th> +      <td><p>Label for the x axis.</p></td> +    </tr> +    <tr> +      <th>ylab</th> +      <td><p>Label for the y axis.</p></td> +    </tr> +    <tr> +      <th>maxy</th> +      <td><p>Maximum value of the residuals. This is used for the scaling of +    the y axis and defaults to "auto".</p></td> +    </tr> +    <tr> +      <th>legend</th> +      <td><p>Should a legend be plotted?</p></td> +    </tr> +    <tr> +      <th>lpos</th> +      <td><p>Where should the legend be placed? Default is "topright". Will be passed on to +    <code><a href='https://www.rdocumentation.org/packages/graphics/topics/legend'>legend</a></code>.</p></td> +    </tr> +    <tr> +      <th>col_obs</th> +      <td><p>Colors for the observed variables.</p></td> +    </tr> +    <tr> +      <th>pch_obs</th> +      <td><p>Symbols to be used for the observed variables.</p></td> +    </tr> +    <tr> +      <th>…</th> +      <td><p>further arguments passed to <code><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></code>.</p></td> +    </tr> +    </table> +     +    <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2> + +    <p>Nothing is returned by this function, as it is called for its side effect, namely to produce a plot.</p> +     +    <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2> + +    <div class='dont-index'><p><code><a href='mkinplot.html'>mkinplot</a></code>, for a way to plot the data and the fitted lines of the + mkinfit object.</p></div> +     + +    <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> +    <pre class="examples"><div class='input'><span class='no'>model</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>), <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>model</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'>mkinerrplot</span>(<span class='no'>fit</span>)</div><div class='img'><img src='mkinerrplot-1.png' alt='' width='700' height='433' /></div></pre> +  </div> +  <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> +    <h2>Contents</h2> +    <ul class="nav nav-pills nav-stacked"> +      <li><a href="#arguments">Arguments</a></li> +       +      <li><a href="#value">Value</a></li> + +      <li><a href="#see-also">See also</a></li> +       +      <li><a href="#examples">Examples</a></li> +    </ul> + +    <h2>Author</h2> +    <p>Johannes Ranke</p> +  </div> +</div> + +      <footer> +      <div class="copyright"> +  <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> +  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.9000.</p> +</div> +      </footer> +   </div> + +   + +  </body> +</html> + diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html index 09329a86..bfca44fc 100644 --- a/docs/reference/mkinfit.html +++ b/docs/reference/mkinfit.html @@ -362,15 +362,15 @@ Per default, parameters in the kinetic models are internally transformed in  <span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='st'>"FOMC"</span>, <span class='no'>FOCUS_2006_C</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> mkin version used for fitting:    0.9.49.4   #> R version used for fitting:       3.6.0  -#> Date of fit:     Tue May  7 08:36:16 2019  -#> Date of summary: Tue May  7 08:36:16 2019  +#> Date of fit:     Wed May  8 20:50:50 2019  +#> Date of summary: Wed May  8 20:50:50 2019   #>   #> Equations:  #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent  #>   #> Model predictions using solution type analytical   #>  -#> Fitted using 222 model solutions performed in 0.89 s +#> Fitted using 222 model solutions performed in 0.456 s  #>   #> Error model:  #> Constant variance  @@ -443,7 +443,7 @@ Per default, parameters in the kinetic models are internally transformed in    <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='co'># Fit the model to the FOCUS example dataset D using defaults</span>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(<span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>,                             <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)))</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='output co'>#>        User      System verstrichen  -#>       2.251       0.000       2.253 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> NULL</div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> $ff +#>       1.488       0.000       1.488 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> NULL</div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> $ff  #> parent_sink   parent_m1     m1_sink   #>    0.485524    0.514476    1.000000   #>  @@ -515,7 +515,7 @@ Per default, parameters in the kinetic models are internally transformed in  #> Sum of squared residuals at call 126: 371.2134  #> Sum of squared residuals at call 135: 371.2134  #> Negative log-likelihood at call 145: 97.22429</div><div class='output co'>#> <span class='message'>Optimisation successfully terminated.</span></div><div class='output co'>#>        User      System verstrichen  -#>       1.151       0.000       1.152 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> NULL</div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> $ff +#>       1.086       0.000       1.087 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> NULL</div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> $ff  #> parent_sink   parent_m1     m1_sink   #>    0.485524    0.514476    1.000000   #>  @@ -547,8 +547,8 @@ Per default, parameters in the kinetic models are internally transformed in  <span class='no'>SFO_SFO.ff</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>),                        <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</span>)</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>f.noweight</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.noweight</span>)</div><div class='output co'>#> mkin version used for fitting:    0.9.49.4   #> R version used for fitting:       3.6.0  -#> Date of fit:     Tue May  7 08:36:33 2019  -#> Date of summary: Tue May  7 08:36:33 2019  +#> Date of fit:     Wed May  8 20:51:06 2019  +#> Date of summary: Wed May  8 20:51:06 2019   #>   #> Equations:  #> d_parent/dt = - k_parent * parent @@ -556,7 +556,7 @@ Per default, parameters in the kinetic models are internally transformed in  #>   #> Model predictions using solution type deSolve   #>  -#> Fitted using 421 model solutions performed in 1.1 s +#> Fitted using 421 model solutions performed in 1.082 s  #>   #> Error model:  #> Constant variance  @@ -665,8 +665,8 @@ Per default, parameters in the kinetic models are internally transformed in  #>   120       m1    25.15  28.78984 -3.640e+00  #>   120       m1    33.31  28.78984  4.520e+00</div><div class='input'><span class='no'>f.obs</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"obs"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.obs</span>)</div><div class='output co'>#> mkin version used for fitting:    0.9.49.4   #> R version used for fitting:       3.6.0  -#> Date of fit:     Tue May  7 08:36:35 2019  -#> Date of summary: Tue May  7 08:36:35 2019  +#> Date of fit:     Wed May  8 20:51:08 2019  +#> Date of summary: Wed May  8 20:51:08 2019   #>   #> Equations:  #> d_parent/dt = - k_parent * parent @@ -674,7 +674,7 @@ Per default, parameters in the kinetic models are internally transformed in  #>   #> Model predictions using solution type deSolve   #>  -#> Fitted using 758 model solutions performed in 1.991 s +#> Fitted using 758 model solutions performed in 1.971 s  #>   #> Error model:  #> Variance unique to each observed variable  @@ -795,8 +795,8 @@ Per default, parameters in the kinetic models are internally transformed in  #>   120       m1    25.15  28.80430 -3.654e+00  #>   120       m1    33.31  28.80430  4.506e+00</div><div class='input'><span class='no'>f.tc</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.tc</span>)</div><div class='output co'>#> mkin version used for fitting:    0.9.49.4   #> R version used for fitting:       3.6.0  -#> Date of fit:     Tue May  7 08:36:39 2019  -#> Date of summary: Tue May  7 08:36:39 2019  +#> Date of fit:     Wed May  8 20:51:11 2019  +#> Date of summary: Wed May  8 20:51:11 2019   #>   #> Equations:  #> d_parent/dt = - k_parent * parent @@ -804,7 +804,7 @@ Per default, parameters in the kinetic models are internally transformed in  #>   #> Model predictions using solution type deSolve   #>  -#> Fitted using 821 model solutions performed in 3.304 s +#> Fitted using 821 model solutions performed in 3.29 s  #>   #> Error model:  #> Two-component variance function  diff --git a/docs/reference/mkinmod.html b/docs/reference/mkinmod.html index d0b2a0eb..51be5465 100644 --- a/docs/reference/mkinmod.html +++ b/docs/reference/mkinmod.html @@ -234,7 +234,7 @@ For the definition of model types and their parameters, the equations given  <span class='no'>SFO_SFO</span> <span class='kw'><-</span> <span class='fu'>mkinmod</span>(    <span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>),    <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> Compilation argument: -#>  /usr/lib/R/bin/R CMD SHLIB fileb5a1e31297a.c 2> fileb5a1e31297a.c.err.txt  +#>  /usr/lib/R/bin/R CMD SHLIB file4bbd307f8763.c 2> file4bbd307f8763.c.err.txt   #> Program source:  #>   1: #include <R.h>  #>   2:  diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html index 522cbbfe..8e2e307b 100644 --- a/docs/reference/mkinpredict.html +++ b/docs/reference/mkinpredict.html @@ -328,17 +328,17 @@                  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),                  <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#>     time   parent       m1  #> 201   20 4.978707 27.46227</div><div class='output co'>#>        User      System verstrichen  -#>       0.003       0.000       0.003 </div><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>( +#>       0.003       0.000       0.004 </div><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(      <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>),                  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),                  <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#>     time   parent       m1  #> 201   20 4.978707 27.46227</div><div class='output co'>#>        User      System verstrichen  -#>       0.001       0.000       0.002 </div><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>( +#>       0.002       0.000       0.001 </div><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(      <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>),                  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),                  <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>, <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#>     time   parent       m1  #> 201   20 4.978707 27.46227</div><div class='output co'>#>        User      System verstrichen  -#>       0.021       0.000       0.022 </div><div class='input'> +#>       0.021       0.000       0.021 </div><div class='input'>    </div><div class='input'>    <span class='co'># Predict from a fitted model</span>      <span class='no'>f</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_C</span>)</div><div class='output co'>#> <span class='message'>Ordinary least squares optimisation</span></div><div class='output co'>#> Sum of squared residuals at call 1: 552.5739  #> Sum of squared residuals at call 3: 552.5739 diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html index d0cd748c..3e297eb3 100644 --- a/docs/reference/mmkin.html +++ b/docs/reference/mmkin.html @@ -194,8 +194,8 @@  <span class='no'>time_1</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(<span class='no'>fits.4</span> <span class='kw'><-</span> <span class='fu'>mmkin</span>(<span class='no'>models</span>, <span class='no'>datasets</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>))  <span class='no'>time_default</span></div><div class='output co'>#>        User      System verstrichen  -#>       0.047       0.033       5.463 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#>        User      System verstrichen  -#>      19.909       0.004      19.967 </div><div class='input'> +#>       0.048       0.024       5.085 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#>        User      System verstrichen  +#>      19.074       0.004      19.089 </div><div class='input'>  <span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fits.0</span><span class='kw'>[[</span><span class='st'>"SFO_lin"</span>, <span class='fl'>2</span>]])</div><div class='output co'>#> $ff  #>   parent_M1 parent_sink       M1_M2     M1_sink   #>   0.7340481   0.2659519   0.7505684   0.2494316  diff --git a/docs/reference/plot.mkinfit-1.png b/docs/reference/plot.mkinfit-1.pngBinary files differ index e7b3bac7..f70e9e31 100644 --- a/docs/reference/plot.mkinfit-1.png +++ b/docs/reference/plot.mkinfit-1.png diff --git a/docs/reference/plot.mkinfit-2.png b/docs/reference/plot.mkinfit-2.pngBinary files differ index 15bdba55..6facce0f 100644 --- a/docs/reference/plot.mkinfit-2.png +++ b/docs/reference/plot.mkinfit-2.png diff --git a/docs/reference/plot.mkinfit-3.png b/docs/reference/plot.mkinfit-3.pngBinary files differ index 52de09bd..b53b3134 100644 --- a/docs/reference/plot.mkinfit-3.png +++ b/docs/reference/plot.mkinfit-3.png diff --git a/docs/reference/plot.mkinfit-4.png b/docs/reference/plot.mkinfit-4.pngBinary files differ index a832ede2..70a936ee 100644 --- a/docs/reference/plot.mkinfit-4.png +++ b/docs/reference/plot.mkinfit-4.png diff --git a/docs/reference/plot.mkinfit-5.png b/docs/reference/plot.mkinfit-5.pngBinary files differ new file mode 100644 index 00000000..2e208996 --- /dev/null +++ b/docs/reference/plot.mkinfit-5.png diff --git a/docs/reference/plot.mkinfit-6.png b/docs/reference/plot.mkinfit-6.pngBinary files differ new file mode 100644 index 00000000..1da876b4 --- /dev/null +++ b/docs/reference/plot.mkinfit-6.png diff --git a/docs/reference/plot.mkinfit.html b/docs/reference/plot.mkinfit.html index 525200ff..7bfc17f6 100644 --- a/docs/reference/plot.mkinfit.html +++ b/docs/reference/plot.mkinfit.html @@ -36,7 +36,7 @@    from a previous successful call to mkinfit and plots    the observed data together with the solution of the fitted model.  If the current plot device is a tikz device, -  then latex is being used for the formatting of the chi2 error level,  +  then latex is being used for the formatting of the chi2 error level,    if show_errmin = TRUE." />  <meta name="twitter:card" content="summary" /> @@ -137,7 +137,7 @@ If the current plot device is a tikz device,    from a previous successful call to <code><a href='mkinfit.html'>mkinfit</a></code> and plots    the observed data together with the solution of the fitted model.</p>  <p>If the current plot device is a <code><a href='https://www.rdocumentation.org/packages/tikzDevice/topics/tikz'>tikz</a></code> device, -  then latex is being used for the formatting of the chi2 error level,  +  then latex is being used for the formatting of the chi2 error level,    if <code>show_errmin = TRUE</code>.</p>      </div> @@ -151,7 +151,9 @@ plot(x, fit = x,    col_obs = 1:length(obs_vars), pch_obs = col_obs,    lty_obs = rep(1, length(obs_vars)),    add = FALSE, legend = !add, -  show_residuals = FALSE, maxabs = "auto", +  show_residuals = FALSE, +  show_errplot = FALSE, +  maxabs = "auto",    sep_obs = FALSE, rel.height.middle = 0.9,    lpos = "topright", inset = c(0.05, 0.05),    show_errmin = FALSE, errmin_digits = 3, …) @@ -213,11 +215,18 @@ plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, …      <tr>        <th>show_residuals</th>        <td><p>Should residuals be shown? If only one plot of the fits is shown, the -    residual plot is in the lower third of the plot? Otherwise, i.e. if +    residual plot is in the lower third of the plot. Otherwise, i.e. if      "sep_obs" is given, the residual plots will be located to the right of      the plots of the fitted curves.</p></td>      </tr>      <tr> +      <th>show_errplot</th> +      <td><p>Should squared residuals and the error model be shown? If only one plot of +    the fits is shown, this plot is in the lower third of the plot. +    Otherwise, i.e. if "sep_obs" is given, the residual plots will be located +    to the right of the plots of the fitted curves.</p></td> +    </tr> +    <tr>        <th>maxabs</th>        <td><p>Maximum absolute value of the residuals. This is used for the scaling of      the y axis and defaults to "auto".</p></td> @@ -263,14 +272,18 @@ plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, …      <pre class="examples"><div class='input'><span class='co'># One parent compound, one metabolite, both single first order, path from</span>  <span class='co'># parent to sink included</span>  <span class='no'>SFO_SFO</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>, <span class='kw'>full</span> <span class='kw'>=</span> <span class='st'>"Parent"</span>), -                   <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='kw'>full</span> <span class='kw'>=</span> <span class='st'>"Metabolite M1"</span> ))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>)</div><div class='img'><img src='plot.mkinfit-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>show_residuals</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-2.png' alt='' width='700' height='433' /></div><div class='input'> +                   <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='kw'>full</span> <span class='kw'>=</span> <span class='st'>"Metabolite M1"</span> ))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>)</div><div class='output co'>#> <span class='warning'>Warning: Observations with value of zero were removed from the data</span></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>)</div><div class='img'><img src='plot.mkinfit-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>show_residuals</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-2.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>show_errplot</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-3.png' alt='' width='700' height='433' /></div><div class='input'>  <span class='co'># Show the observed variables separately</span> -<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>sep_obs</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>))</div><div class='img'><img src='plot.mkinfit-3.png' alt='' width='700' height='433' /></div><div class='input'> +<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>sep_obs</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>))</div><div class='img'><img src='plot.mkinfit-4.png' alt='' width='700' height='433' /></div><div class='input'>  <span class='co'># Show the observed variables separately, with residuals</span>  <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>sep_obs</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>show_residuals</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>), -     <span class='kw'>show_errmin</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-4.png' alt='' width='700' height='433' /></div><div class='input'> +     <span class='kw'>show_errmin</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-5.png' alt='' width='700' height='433' /></div><div class='input'>  <span class='co'># The same can be obtained with less typing, using the convenience function plot_sep</span> -<span class='fu'>plot_sep</span>(<span class='no'>fit</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>))</div></pre> +<span class='fu'>plot_sep</span>(<span class='no'>fit</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>)) + +<span class='co'># Show the observed variables separately, with the error model</span> +<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fit</span>, <span class='kw'>sep_obs</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>show_errplot</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lpos</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"topright"</span>, <span class='st'>"bottomright"</span>), +     <span class='kw'>show_errmin</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='img'><img src='plot.mkinfit-6.png' alt='' width='700' height='433' /></div></pre>    </div>    <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">      <h2>Contents</h2> diff --git a/docs/reference/plot.mmkin-2.png b/docs/reference/plot.mmkin-2.pngBinary files differ index 555cb7d6..25ed01cc 100644 --- a/docs/reference/plot.mmkin-2.png +++ b/docs/reference/plot.mmkin-2.png diff --git a/docs/reference/plot.mmkin-4.png b/docs/reference/plot.mmkin-4.pngBinary files differ new file mode 100644 index 00000000..b03dffb2 --- /dev/null +++ b/docs/reference/plot.mmkin-4.png diff --git a/docs/reference/plot.mmkin.html b/docs/reference/plot.mmkin.html index b3f2de66..3037ca24 100644 --- a/docs/reference/plot.mmkin.html +++ b/docs/reference/plot.mmkin.html @@ -141,8 +141,9 @@ If the current plot device is a tikz device,      </div>      <pre class="usage"><span class='co'># S3 method for mmkin</span> -<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>x</span>, <span class='kw'>main</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, <span class='kw'>legends</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>errmin_var</span> <span class='kw'>=</span> <span class='st'>"All data"</span>, <span class='kw'>errmin_digits</span> <span class='kw'>=</span> <span class='fl'>3</span>, -              <span class='kw'>cex</span> <span class='kw'>=</span> <span class='fl'>0.7</span>, <span class='kw'>rel.height.middle</span> <span class='kw'>=</span> <span class='fl'>0.9</span>, <span class='no'>...</span>)</pre> +<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>x</span>, <span class='kw'>main</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, <span class='kw'>legends</span> <span class='kw'>=</span> <span class='fl'>1</span>, +  <span class='kw'>resplot</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"time"</span>, <span class='st'>"errmod"</span>), <span class='kw'>errmin_var</span> <span class='kw'>=</span> <span class='st'>"All data"</span>, <span class='kw'>errmin_digits</span> <span class='kw'>=</span> <span class='fl'>3</span>, +  <span class='kw'>cex</span> <span class='kw'>=</span> <span class='fl'>0.7</span>, <span class='kw'>rel.height.middle</span> <span class='kw'>=</span> <span class='fl'>0.9</span>, <span class='no'>...</span>)</pre>      <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>      <table class="ref-arguments"> @@ -160,6 +161,12 @@ If the current plot device is a tikz device,        <td><p>An index for the fits for which legends should be shown.</p></td>      </tr>      <tr> +      <th>resplot</th> +      <td><p>Should the residuals plotted against time, using <code><a href='mkinresplot.html'>mkinresplot</a></code>, +    or as squared residuals against predicted values, with the error model, +    using <code><a href='mkinerrplot.html'>mkinerrplot</a></code>.</p></td> +    </tr> +    <tr>        <th>errmin_var</th>        <td><p>The variable for which the FOCUS chi2 error value should be shown.</p></td>      </tr> @@ -187,15 +194,17 @@ If the current plot device is a tikz device,      <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> -    <pre class="examples"><div class='input'>  <span class='co'># Only use one core not to offend CRAN checks</span> +    <pre class="examples"><div class='input'>  </div><div class='input'>  <span class='co'># Only use one core not to offend CRAN checks</span>    <span class='no'>fits</span> <span class='kw'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"FOMC"</span>, <span class='st'>"HS"</span>),                  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/list'>list</a></span>(<span class='st'>"FOCUS B"</span> <span class='kw'>=</span> <span class='no'>FOCUS_2006_B</span>, <span class='st'>"FOCUS C"</span> <span class='kw'>=</span> <span class='no'>FOCUS_2006_C</span>), <span class='co'># named list for titles</span> -                <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) +                <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>)    <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fits</span>[, <span class='st'>"FOCUS C"</span>])</div><div class='img'><img src='plot.mmkin-1.png' alt='' width='700' height='433' /></div><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fits</span>[<span class='st'>"FOMC"</span>, ])</div><div class='img'><img src='plot.mmkin-2.png' alt='' width='700' height='433' /></div><div class='input'>    <span class='co'># We can also plot a single fit, if we like the way plot.mmkin works, but then the plot</span>    <span class='co'># height should be smaller than the plot width (this is not possible for the html pages</span>    <span class='co'># generated by pkgdown, as far as I know).</span> -  <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fits</span>[<span class='st'>"FOMC"</span>, <span class='st'>"FOCUS C"</span>]) <span class='co'># same as plot(fits[1, 2])</span></div><div class='img'><img src='plot.mmkin-3.png' alt='' width='700' height='433' /></div></pre> +  <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fits</span>[<span class='st'>"FOMC"</span>, <span class='st'>"FOCUS C"</span>]) <span class='co'># same as plot(fits[1, 2])</span></div><div class='img'><img src='plot.mmkin-3.png' alt='' width='700' height='433' /></div><div class='input'> +  <span class='co'># Show the error models</span> +  <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>fits</span>[<span class='st'>"FOMC"</span>, ], <span class='kw'>resplot</span> <span class='kw'>=</span> <span class='st'>"errmod"</span>)</div><div class='img'><img src='plot.mmkin-4.png' alt='' width='700' height='433' /></div><div class='input'>  </div></pre>    </div>    <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">      <h2>Contents</h2> diff --git a/docs/reference/summary.mkinfit.html b/docs/reference/summary.mkinfit.html index 9c4a21a9..b3151da1 100644 --- a/docs/reference/summary.mkinfit.html +++ b/docs/reference/summary.mkinfit.html @@ -211,15 +211,15 @@      <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>      <pre class="examples"><div class='input'>  <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>)), <span class='no'>FOCUS_2006_A</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>))</div><div class='output co'>#> mkin version used for fitting:    0.9.49.4   #> R version used for fitting:       3.6.0  -#> Date of fit:     Tue May  7 08:37:31 2019  -#> Date of summary: Tue May  7 08:37:31 2019  +#> Date of fit:     Wed May  8 20:52:12 2019  +#> Date of summary: Wed May  8 20:52:12 2019   #>   #> Equations:  #> d_parent/dt = - k_parent_sink * parent  #>   #> Model predictions using solution type analytical   #>  -#> Fitted using 131 model solutions performed in 0.277 s +#> Fitted using 131 model solutions performed in 0.266 s  #>   #> Error model:  #> Constant variance  diff --git a/man/mkinerrplot.Rd b/man/mkinerrplot.Rd new file mode 100644 index 00000000..4cbb5eb7 --- /dev/null +++ b/man/mkinerrplot.Rd @@ -0,0 +1,75 @@ +\name{mkinerrplot} +\alias{mkinerrplot} +\title{ +  Function to plot squared residuals and the error model for an mkin object +} +\description{ +  This function plots the squared residuals for the specified subset of the +  observed variables from an mkinfit object. In addition, one or more +  dashed line(s) show the fitted error model. +  A combined plot of the fitted model and this error model plot can be +  obtained with \code{\link{plot.mkinfit}} +  using the argument \code{show_errplot = TRUE}. +} +\usage{ +  mkinerrplot(object, +    obs_vars = names(object$mkinmod$map), +    xlim = c(0, 1.1 * max(object$data$predicted)), +    xlab = "Predicted", ylab = "Squared residual", +    maxy = "auto", legend= TRUE, lpos = "topright", +    col_obs = "auto", pch_obs = "auto", +    ...) +} +\arguments{ +  \item{object}{ +    A fit represented in an \code{\link{mkinfit}} object. +  } +  \item{obs_vars}{ +    A character vector of names of the observed variables for which residuals +    should be plotted. Defaults to all observed variables in the model +  } +  \item{xlim}{ +    plot range in x direction. +  } +  \item{xlab}{ +    Label for the x axis. +  } +  \item{ylab}{ +    Label for the y axis. +  } +  \item{maxy}{ +    Maximum value of the residuals. This is used for the scaling of +    the y axis and defaults to "auto". +  } +  \item{legend}{ +    Should a legend be plotted? +  } +  \item{lpos}{ +    Where should the legend be placed? Default is "topright". Will be passed on to +    \code{\link{legend}}. +  } +  \item{col_obs}{ +    Colors for the observed variables. +  } +  \item{pch_obs}{ +    Symbols to be used for the observed variables. +  } +  \item{\dots}{ +   further arguments passed to \code{\link{plot}}. +  } +} +\value{ +  Nothing is returned by this function, as it is called for its side effect, namely to produce a plot. +} +\author{ +  Johannes Ranke +} +\seealso{ + \code{\link{mkinplot}}, for a way to plot the data and the fitted lines of the + mkinfit object.  } +\examples{ +model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) +fit <- mkinfit(model, FOCUS_2006_D, error_model = "tc", quiet = TRUE) +mkinerrplot(fit) +} +\keyword{ hplot } diff --git a/man/plot.mkinfit.Rd b/man/plot.mkinfit.Rd index 733cdf76..9514c5e5 100644 --- a/man/plot.mkinfit.Rd +++ b/man/plot.mkinfit.Rd @@ -10,7 +10,7 @@    the observed data together with the solution of the fitted model.    If the current plot device is a \code{\link[tikzDevice]{tikz}} device, -  then latex is being used for the formatting of the chi2 error level,  +  then latex is being used for the formatting of the chi2 error level,    if \code{show_errmin = TRUE}.  }  \usage{ @@ -22,7 +22,9 @@    col_obs = 1:length(obs_vars), pch_obs = col_obs,    lty_obs = rep(1, length(obs_vars)),    add = FALSE, legend = !add, -  show_residuals = FALSE, maxabs = "auto", +  show_residuals = FALSE, +  show_errplot = FALSE, +  maxabs = "auto",    sep_obs = FALSE, rel.height.middle = 0.9,    lpos = "topright", inset = c(0.05, 0.05),    show_errmin = FALSE, errmin_digits = 3, \dots) @@ -69,10 +71,16 @@ plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, \dots)    }    \item{show_residuals}{      Should residuals be shown? If only one plot of the fits is shown, the -    residual plot is in the lower third of the plot? Otherwise, i.e. if +    residual plot is in the lower third of the plot. Otherwise, i.e. if      "sep_obs" is given, the residual plots will be located to the right of      the plots of the fitted curves.    } +  \item{show_errplot}{ +    Should squared residuals and the error model be shown? If only one plot of +    the fits is shown, this plot is in the lower third of the plot. +    Otherwise, i.e. if "sep_obs" is given, the residual plots will be located +    to the right of the plots of the fitted curves. +  }    \item{maxabs}{      Maximum absolute value of the residuals. This is used for the scaling of      the y axis and defaults to "auto". @@ -109,9 +117,10 @@ plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, \dots)  # parent to sink included  SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1", full = "Parent"),                     m1 = mkinsub("SFO", full = "Metabolite M1" )) -fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) +fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, error_model = "tc")  plot(fit)  plot(fit, show_residuals = TRUE) +plot(fit, show_errplot = TRUE)  # Show the observed variables separately  plot(fit, sep_obs = TRUE, lpos = c("topright", "bottomright")) @@ -122,6 +131,10 @@ plot(fit, sep_obs = TRUE, show_residuals = TRUE, lpos = c("topright", "bottomrig  # The same can be obtained with less typing, using the convenience function plot_sep  plot_sep(fit, lpos = c("topright", "bottomright")) + +# Show the observed variables separately, with the error model +plot(fit, sep_obs = TRUE, show_errplot = TRUE, lpos = c("topright", "bottomright"), +     show_errmin = TRUE)  }  \author{    Johannes Ranke diff --git a/man/plot.mmkin.Rd b/man/plot.mmkin.Rd index b3312292..44e5e4c7 100644 --- a/man/plot.mmkin.Rd +++ b/man/plot.mmkin.Rd @@ -12,8 +12,9 @@    then latex is being used for the formatting of the chi2 error level.  }  \usage{ -\method{plot}{mmkin}(x, main = "auto", legends = 1, errmin_var = "All data", errmin_digits = 3, -              cex = 0.7, rel.height.middle = 0.9, ...) +\method{plot}{mmkin}(x, main = "auto", legends = 1, +  resplot = c("time", "errmod"), errmin_var = "All data", errmin_digits = 3, +  cex = 0.7, rel.height.middle = 0.9, ...)  }  \arguments{    \item{x}{ @@ -25,6 +26,11 @@    \item{legends}{      An index for the fits for which legends should be shown.  } +  \item{resplot}{ +    Should the residuals plotted against time, using \code{\link{mkinresplot}}, +    or as squared residuals against predicted values, with the error model, +    using \code{\link{mkinerrplot}}. +}    \item{errmin_var}{      The variable for which the FOCUS chi2 error value should be shown.  } @@ -48,10 +54,11 @@    Johannes Ranke  }  \examples{ +  \dontrun{    # Only use one core not to offend CRAN checks    fits <- mmkin(c("FOMC", "HS"),                  list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles -                cores = 1, quiet = TRUE) +                cores = 1, quiet = TRUE, error_model = "tc")    plot(fits[, "FOCUS C"])    plot(fits["FOMC", ]) @@ -59,4 +66,8 @@    # height should be smaller than the plot width (this is not possible for the html pages    # generated by pkgdown, as far as I know).    plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2]) + +  # Show the error models +  plot(fits["FOMC", ], resplot = "errmod") +  }  } @@ -2,33 +2,28 @@ Loading mkin  Testing mkin  ✔ |  OK F W S | Context  
⠏ |   0       | Export dataset for reading into CAKE
✔ |   1       | Export dataset for reading into CAKE -
⠏ |   0       | Error model fitting
⠋ |   1       | Error model fitting
⠹ |   3       | Error model fitting
⠸ |   4       | Error model fitting
⠼ |   5       | Error model fitting
⠴ |   6       | Error model fitting
⠧ |   8       | Error model fitting
⠏ |  10       | Error model fitting
⠋ |  11       | Error model fitting
✔ |  12       | Error model fitting [214.9 s] -
⠏ |   0       | Calculation of FOCUS chi2 error levels
⠋ |   1       | Calculation of FOCUS chi2 error levels
⠹ |   3       | Calculation of FOCUS chi2 error levels
✔ |   3       | Calculation of FOCUS chi2 error levels [2.4 s] -
⠏ |   0       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠙ |   2       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠸ |   4       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠇ |   9       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
✔ |  13       | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.7 s] +
⠏ |   0       | Error model fitting
⠋ |   1       | Error model fitting
⠹ |   3       | Error model fitting
⠸ |   4       | Error model fitting
⠼ |   5       | Error model fitting
⠴ |   6       | Error model fitting
⠧ |   8       | Error model fitting
⠏ |  10       | Error model fitting
⠋ |  11       | Error model fitting
✔ |  12       | Error model fitting [214.1 s] +
⠏ |   0       | Calculation of FOCUS chi2 error levels
⠋ |   1       | Calculation of FOCUS chi2 error levels
⠹ |   3       | Calculation of FOCUS chi2 error levels
✔ |   3       | Calculation of FOCUS chi2 error levels [2.3 s] +
⠏ |   0       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠙ |   2       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠸ |   4       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠇ |   9       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
✔ |  13       | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.8 s]  
⠏ |   0       | Test fitting the decline of metabolites from their maximum
⠋ |   1       | Test fitting the decline of metabolites from their maximum
⠹ |   3       | Test fitting the decline of metabolites from their maximum
⠼ |   5       | Test fitting the decline of metabolites from their maximum
✔ |   6       | Test fitting the decline of metabolites from their maximum [0.9 s]  
⠏ |   0       | Fitting the logistic model
⠋ |   1       | Fitting the logistic model
✔ |   1       | Fitting the logistic model [0.9 s]  
⠏ |   0       | Test dataset class mkinds used in gmkin
✔ |   1       | Test dataset class mkinds used in gmkin -
⠏ |   0       | Special cases of mkinfit calls
⠋ |   1       | Special cases of mkinfit calls
⠇ |   9       | Special cases of mkinfit calls
⠏ |  10       | Special cases of mkinfit calls
⠋ |  10 1     | Special cases of mkinfit calls
⠙ |  11 1     | Special cases of mkinfit calls
✖ |  11 1     | Special cases of mkinfit calls [2.8 s] -──────────────────────────────────────────────────────────────────────────────── -test_mkinfit_errors.R:72: failure: We get reproducible output if quiet = FALSE -`mkinfit("DFOP", FOCUS_2006_C, reweight.method = "tc", trace_parms = TRUE)` has changed from known value recorded in 'DFOP_FOCUS_C_messages.txt'. -Lengths differ: 165 is not 410 -──────────────────────────────────────────────────────────────────────────────── -
⠏ |   0       | mkinmod model generation and printing
⠇ |   9       | mkinmod model generation and printing
✔ |   9       | mkinmod model generation and printing [0.1 s] +
⠏ |   0       | Special cases of mkinfit calls
⠋ |   1       | Special cases of mkinfit calls
⠇ |   9       | Special cases of mkinfit calls
⠏ |  10       | Special cases of mkinfit calls
⠋ |  11       | Special cases of mkinfit calls
⠙ |  12       | Special cases of mkinfit calls
✔ |  12       | Special cases of mkinfit calls [2.9 s] +
⠏ |   0       | mkinmod model generation and printing
⠇ |   9       | mkinmod model generation and printing
✔ |   9       | mkinmod model generation and printing [0.2 s]  
⠏ |   0       | Model predictions with mkinpredict
⠋ |   1       | Model predictions with mkinpredict
✔ |   3       | Model predictions with mkinpredict [0.3 s] -
⠏ |   0       | Evaluations according to 2015 NAFTA guidance
⠙ |   2       | Evaluations according to 2015 NAFTA guidance
⠇ |   9       | Evaluations according to 2015 NAFTA guidance
⠏ |  10       | Evaluations according to 2015 NAFTA guidance
⠴ |  16       | Evaluations according to 2015 NAFTA guidance
✔ |  16       | Evaluations according to 2015 NAFTA guidance [4.0 s] -
⠏ |   0       | Fitting of parent only models
⠋ |   1       | Fitting of parent only models
⠙ |   2       | Fitting of parent only models
⠹ |   3       | Fitting of parent only models
⠸ |   4       | Fitting of parent only models
⠼ |   5       | Fitting of parent only models
⠴ |   6       | Fitting of parent only models
⠦ |   7       | Fitting of parent only models
⠧ |   8       | Fitting of parent only models
⠇ |   9       | Fitting of parent only models
⠏ |  10       | Fitting of parent only models
⠋ |  11       | Fitting of parent only models
⠙ |  12       | Fitting of parent only models
⠹ |  13       | Fitting of parent only models
⠴ |  16       | Fitting of parent only models
⠧ |  18       | Fitting of parent only models
⠏ |  20       | Fitting of parent only models
✔ |  21       | Fitting of parent only models [40.5 s] -
⠏ |   0       | Calculation of maximum time weighted average concentrations (TWAs)
⠋ |   1       | Calculation of maximum time weighted average concentrations (TWAs)
⠙ |   2       | Calculation of maximum time weighted average concentrations (TWAs)
⠹ |   3       | Calculation of maximum time weighted average concentrations (TWAs)
⠸ |   4       | Calculation of maximum time weighted average concentrations (TWAs)
✔ |   4       | Calculation of maximum time weighted average concentrations (TWAs) [2.2 s] +
⠏ |   0       | Evaluations according to 2015 NAFTA guidance
⠙ |   2       | Evaluations according to 2015 NAFTA guidance
⠇ |   9       | Evaluations according to 2015 NAFTA guidance
⠏ |  10       | Evaluations according to 2015 NAFTA guidance
⠴ |  16       | Evaluations according to 2015 NAFTA guidance
✔ |  16       | Evaluations according to 2015 NAFTA guidance [4.1 s] +
⠏ |   0       | Fitting of parent only models
⠋ |   1       | Fitting of parent only models
⠙ |   2       | Fitting of parent only models
⠹ |   3       | Fitting of parent only models
⠸ |   4       | Fitting of parent only models
⠼ |   5       | Fitting of parent only models
⠴ |   6       | Fitting of parent only models
⠦ |   7       | Fitting of parent only models
⠧ |   8       | Fitting of parent only models
⠇ |   9       | Fitting of parent only models
⠏ |  10       | Fitting of parent only models
⠋ |  11       | Fitting of parent only models
⠙ |  12       | Fitting of parent only models
⠹ |  13       | Fitting of parent only models
⠴ |  16       | Fitting of parent only models
⠧ |  18       | Fitting of parent only models
⠏ |  20       | Fitting of parent only models
✔ |  21       | Fitting of parent only models [40.1 s] +
⠏ |   0       | Calculation of maximum time weighted average concentrations (TWAs)
⠋ |   1       | Calculation of maximum time weighted average concentrations (TWAs)
⠙ |   2       | Calculation of maximum time weighted average concentrations (TWAs)
⠹ |   3       | Calculation of maximum time weighted average concentrations (TWAs)
⠸ |   4       | Calculation of maximum time weighted average concentrations (TWAs)
✔ |   4       | Calculation of maximum time weighted average concentrations (TWAs) [2.3 s]  
⠏ |   0       | Summary
✔ |   1       | Summary  
⠏ |   0       | Plotting
⠹ |   3       | Plotting
✔ |   4       | Plotting [0.3 s]  
⠏ |   0       | AIC calculation
✔ |   2       | AIC calculation -
⠏ |   0       | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ |   1       | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ |   2       | Complex test case from Schaefer et al. (2007) Piacenza paper [5.3 s] -
⠏ |   0       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ |   3       | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ |   4       | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.1 s] +
⠏ |   0       | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ |   1       | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ |   2       | Complex test case from Schaefer et al. (2007) Piacenza paper [5.2 s] +
⠏ |   0       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ |   3       | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ |   4       | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.0 s]  ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 291.1 s +Duration: 289.7 s -OK:       114 -Failed:   1 +OK:       115 +Failed:   0  Warnings: 0  Skipped:  0 diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index df408385..da2e2fbe 100644 --- a/tests/testthat/FOCUS_2006_D.csf +++ b/tests/testthat/FOCUS_2006_D.csf @@ -5,7 +5,7 @@ Description:  MeasurementUnits: % AR  TimeUnits: days  Comments: Created using mkin::CAKE_export -Date: 2019-05-07 +Date: 2019-05-08  Optimiser: IRLS  [Data] diff --git a/vignettes/mkin_benchmarks.rda b/vignettes/mkin_benchmarks.rdaBinary files differ index f8723d56..e7a1bed1 100644 --- a/vignettes/mkin_benchmarks.rda +++ b/vignettes/mkin_benchmarks.rda | 
