From 651fe9a90eb814a9533309d938c9e830c2ee4b8c Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Tue, 22 Jul 2014 14:55:41 +0200
Subject: Formatting TODO
---
 TODO | 1 +
 1 file changed, 1 insertion(+)
(limited to 'TODO')
diff --git a/TODO b/TODO
index af4ff82d..83524220 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,7 @@ TODO for version 1.0
 - Think about what a user would expect from version 1.0
 - Complete the main package vignette named mkin to include a method description
 - Improve formatting of differential equations in the summary
+- Improve order of parameters in output
 
 Nice to have:
 - Calculate confidence intervals for DT50 and DT90 values when only one
-- 
cgit v1.2.3
From 4c6f29fe2a3ece5a85160b891c89ce0f55299c11 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Wed, 23 Jul 2014 08:34:59 +0200
Subject: Parallel metabolite formation with formation fractions in mkinerrmin
---
 DESCRIPTION    | 2 +-
 NEWS.md        | 4 ++++
 R/mkinerrmin.R | 7 ++++---
 TODO           | 1 +
 4 files changed, 10 insertions(+), 4 deletions(-)
(limited to 'TODO')
diff --git a/DESCRIPTION b/DESCRIPTION
index bad72501..de9ff203 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
 Title: Routines for fitting kinetic models with one or more state
   variables to chemical degradation data
 Version: 0.9-32
-Date: 2014-07-21
+Date: 2014-07-23
 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), 
                     email = "jranke@uni-bremen.de"),
              person("Katrin", "Lindenberger", role = "ctb"),
diff --git a/NEWS.md b/NEWS.md
index c10a25b0..9d5129c9 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## NEW FEATURES
 
+- The number of degrees of freedom is difficult to define in the case of ilr transformation of formation fractions. Now for each source compartment the number of ilr parameters (=number of optimised parameters) is divided by the number of pathways to metabolites (=number of affected data series) which leads to fractional degrees of freedom in some cases.
+
 - The default for the initial value for the first state value is now taken from the mean of the observations at time zero, if available.
 
 - The kinetic model can alternatively be specified with a shorthand name for parent only degradation models, e.g. `SFO`, or `DFOP`.
@@ -14,6 +16,8 @@
 
 ## BUG FIXES
 
+- In the determination of the degrees of freedom in `mkinerrmin`, formation fractions were accounted for multiple times in the case of parallel formation of metabolites. See the new feature described above for the solution.
+
 - `transform_rates=FALSE` in `mkinfit` now also works for FOMC and HS models.
 
 - Initial values for formation fractions were not set in all cases.
diff --git a/R/mkinerrmin.R b/R/mkinerrmin.R
index 9ebac6a4..09724730 100644
--- a/R/mkinerrmin.R
+++ b/R/mkinerrmin.R
@@ -65,11 +65,12 @@ mkinerrmin <- function(fit, alpha = 0.05)
     # Formation fractions are attributed to the target variable, so look
     # for source compartments with formation fractions
     for (source_var in fit$obs_vars) {
+      n.ff.source = length(grep(paste("^f", source_var, sep = "_"),
+                                 names(parms.optim)))
+      n.paths.source = length(fit$mkinmod$spec[[source_var]]$to)
       for (target_var in fit$mkinmod$spec[[source_var]]$to) {
         if (obs_var == target_var) {
-          n.ff.optim <- n.ff.optim +  
-                        length(grep(paste("^f", source_var, sep = "_"),
-                                    names(parms.optim))) 
+          n.ff.optim <- n.ff.optim + n.ff.source/n.paths.source
         }
       }
     }
diff --git a/TODO b/TODO
index 83524220..a9eb8b70 100644
--- a/TODO
+++ b/TODO
@@ -3,6 +3,7 @@ TODO for version 1.0
 - Complete the main package vignette named mkin to include a method description
 - Improve formatting of differential equations in the summary
 - Improve order of parameters in output
+- Write unit tests for mkinerrmin
 
 Nice to have:
 - Calculate confidence intervals for DT50 and DT90 values when only one
-- 
cgit v1.2.3
From bf4200964f270db9fb29c333e3c694e299f9d78d Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Thu, 31 Jul 2014 11:16:48 +0200
Subject: More to do, gathered during the software validation checks
---
 TODO | 5 +++++
 1 file changed, 5 insertions(+)
(limited to 'TODO')
diff --git a/TODO b/TODO
index a9eb8b70..a1afc933 100644
--- a/TODO
+++ b/TODO
@@ -4,8 +4,13 @@ TODO for version 1.0
 - Improve formatting of differential equations in the summary
 - Improve order of parameters in output
 - Write unit tests for mkinerrmin
+- Calculate confidence intervals for more than one formation fraction using Monte Carlo simulations
+- When checking for degrees of freedom for metabolites, check if their time zero value is fixed
+  instead of checking if the observed value is zero (usually in regulatory kinetics it is set to
+  zero anyway, but in the case of known impurities this may not be the case).
 
 Nice to have:
+- Get starting values for formation fractions from data
 - Calculate confidence intervals for DT50 and DT90 values when only one
   parameter is involved
 - Calculate transformation only DT50 values (exclude pathways to sink) as
-- 
cgit v1.2.3
From ea171bdf4772824a7d61d3ac5189c0bbc5bc2900 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Thu, 31 Jul 2014 11:16:48 +0200
Subject: More to do, gathered during the software validation checks
---
 TODO | 2 ++
 1 file changed, 2 insertions(+)
(limited to 'TODO')
diff --git a/TODO b/TODO
index a1afc933..2617bf2c 100644
--- a/TODO
+++ b/TODO
@@ -8,6 +8,8 @@ TODO for version 1.0
 - When checking for degrees of freedom for metabolites, check if their time zero value is fixed
   instead of checking if the observed value is zero (usually in regulatory kinetics it is set to
   zero anyway, but in the case of known impurities this may not be the case).
+- For mkinerrmin calculations for metabolites, check if state.ini is fixed in order to determine
+  the degrees of freedom
 
 Nice to have:
 - Get starting values for formation fractions from data
-- 
cgit v1.2.3
From 37a252cb44fed78c4f7a00a2f7874f1c47456468 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Tue, 19 Aug 2014 17:55:06 +0200
Subject: Improve formatting of differential equations in output
Rebuild of FOCUS_Z vignette with improved formatting
---
 DESCRIPTION           |   5 +++--
 R/mkinfit.R           |   2 +-
 TODO                  |   1 -
 vignettes/FOCUS_Z.Rnw |   1 +
 vignettes/FOCUS_Z.pdf | Bin 214013 -> 220196 bytes
 5 files changed, 5 insertions(+), 4 deletions(-)
(limited to 'TODO')
diff --git a/DESCRIPTION b/DESCRIPTION
index 02480e56..3898f69a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
 Title: Routines for fitting kinetic models with one or more state
   variables to chemical degradation data
 Version: 0.9-33
-Date: 2014-07-25
+Date: 2014-08-19
 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), 
                     email = "jranke@uni-bremen.de"),
              person("Katrin", "Lindenberger", role = "ctb"),
@@ -24,5 +24,6 @@ LazyData: yes
 Encoding: UTF-8
 VignetteBuilder: knitr
 BugReports: http://github.com/jranke/mkin/issues
-URL: http://kinfit.r-forge.r-project.org, http://cran.r-project.org/package=mkin, 
+URL: http://cran.r-project.org/package=mkin, 
+     http://kinfit.r-forge.r-project.org/mkin_static, 
      http://github.com/jranke/mkin
diff --git a/R/mkinfit.R b/R/mkinfit.R
index c98c7586..92c8f8bf 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -567,7 +567,7 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), .
   if (!is.null(x$warning)) cat("\n\nWarning:", x$warning, "\n\n")
 
   cat("\nEquations:\n")
-  print(noquote(as.character(x[["diffs"]])))
+  cat(noquote(strwrap(x[["diffs"]], exdent = 11)), fill = TRUE)
   df  <- x$df
   rdf <- df[2]
 
diff --git a/TODO b/TODO
index 2617bf2c..4b73063f 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
 TODO for version 1.0
 - Think about what a user would expect from version 1.0
 - Complete the main package vignette named mkin to include a method description
-- Improve formatting of differential equations in the summary
 - Improve order of parameters in output
 - Write unit tests for mkinerrmin
 - Calculate confidence intervals for more than one formation fraction using Monte Carlo simulations
diff --git a/vignettes/FOCUS_Z.Rnw b/vignettes/FOCUS_Z.Rnw
index 5b0ee79e..e2a2473e 100644
--- a/vignettes/FOCUS_Z.Rnw
+++ b/vignettes/FOCUS_Z.Rnw
@@ -20,6 +20,7 @@
 <>=
 require(knitr)
 opts_chunk$set(engine='R', tidy=FALSE)
+options(width=70)
 @
 
 \title{Example evaluation of FOCUS dataset Z}
diff --git a/vignettes/FOCUS_Z.pdf b/vignettes/FOCUS_Z.pdf
index f7b0a65a..210ce099 100644
Binary files a/vignettes/FOCUS_Z.pdf and b/vignettes/FOCUS_Z.pdf differ
-- 
cgit v1.2.3
From 58e084b89512f797f071db52939f6bb52d3e8fa5 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Tue, 19 Aug 2014 18:15:24 +0200
Subject: Small reformulations
---
 TODO | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
(limited to 'TODO')
diff --git a/TODO b/TODO
index 4b73063f..92a91069 100644
--- a/TODO
+++ b/TODO
@@ -3,15 +3,14 @@ TODO for version 1.0
 - Complete the main package vignette named mkin to include a method description
 - Improve order of parameters in output
 - Write unit tests for mkinerrmin
-- Calculate confidence intervals for more than one formation fraction using Monte Carlo simulations
-- When checking for degrees of freedom for metabolites, check if their time zero value is fixed
-  instead of checking if the observed value is zero (usually in regulatory kinetics it is set to
-  zero anyway, but in the case of known impurities this may not be the case).
-- For mkinerrmin calculations for metabolites, check if state.ini is fixed in order to determine
-  the degrees of freedom
+- When checking for degrees of freedom for metabolites, check if their time
+  zero value (state.ini) is fixed instead of checking if the observed value is
+  zero (usually in regulatory kinetics it is set to zero anyway, but in the
+  case of known impurities this may not be the case).
 
 Nice to have:
 - Get starting values for formation fractions from data
+- Calculate confidence intervals for more than one formation fraction using Monte Carlo simulations
 - Calculate confidence intervals for DT50 and DT90 values when only one
   parameter is involved
 - Calculate transformation only DT50 values (exclude pathways to sink) as
-- 
cgit v1.2.3
From f30472ecd2afea6bd2153b8ad2bb2f663f3a2742 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Mon, 25 Aug 2014 10:39:40 +0200
Subject: Bug fix and unit tests for mkinerrmin
See NEWS.md for details
---
 NEWS.md                           |   7 +++
 R/mkinerrmin.R                    |   9 +--
 TODO                              |   5 --
 inst/unitTests/runit.mkinerrmin.R |  62 +++++++++++++++++++++
 inst/unitTests/runit.mkinfit.R    |  38 +------------
 man/mkinerrmin.Rd                 |  10 ++++
 tests/doRUnit.R                   |   1 -
 vignettes/FOCUS_L.html            | 112 +++++++++++++++++++++-----------------
 vignettes/FOCUS_Z.pdf             | Bin 220196 -> 220177 bytes
 9 files changed, 146 insertions(+), 98 deletions(-)
 create mode 100644 inst/unitTests/runit.mkinerrmin.R
(limited to 'TODO')
diff --git a/NEWS.md b/NEWS.md
index d05c2095..1ed94c97 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,12 +4,19 @@
 
 - The initial value (state.ini) for the observed variable with the highest observed residue is set to 100 in case it has no time zero observation and `state.ini = "auto"`
 
+- A basic unit test for `mkinerrmin()` was written
+
 ## BUG FIXES
 
 - `mkinfit()`: The internally fitted parameter for `g` was named `g_ilr` even when `transform_fractions=FALSE`
 
 - `mkinfit()`: The initial value (state.ini) for the parent compound was not set when the parent was not the (only) variable with the highest value in the observed data.
 
+- `mkinerrmin()`: When checking for degrees of freedom for metabolites, check
+  if their time zero value is fixed instead of checking if the observed value
+  is zero. This ensures correct calculation of degrees of freedom also in cases
+  where the metabolite residue at time zero is greater zero.
+
 ## MINOR CHANGES
 
 - The formatting of differential equations in the summary was improved by wrapping overly long lines
diff --git a/R/mkinerrmin.R b/R/mkinerrmin.R
index 09724730..2697d0a0 100644
--- a/R/mkinerrmin.R
+++ b/R/mkinerrmin.R
@@ -36,10 +36,11 @@ mkinerrmin <- function(fit, alpha = 0.05)
     suffixes = c("_mean", "_pred"))
   errdata <- errdata[order(errdata$time, errdata$name), ]
 
-  # Any value that is set to exactly zero is not really an observed value
-  # Remove those at time 0 - those are caused by the FOCUS recommendation
-  # to set metabolites occurring at time 0 to 0
-  errdata <- subset(errdata, !(time == 0 & value_mean == 0))
+  # Remove values at time zero for variables whose value for state.ini is fixed,
+  # as these will not have any effect in the optimization and should therefore not 
+  # be counted as degrees of freedom.
+  fixed_initials = gsub("_0$", "", rownames(subset(fit$fixed, type = "state")))
+  errdata <- subset(errdata, !(time == 0 & name %in% fixed_initials))
 
   n.optim.overall <- length(parms.optim)
 
diff --git a/TODO b/TODO
index 92a91069..f979d13a 100644
--- a/TODO
+++ b/TODO
@@ -2,11 +2,6 @@ TODO for version 1.0
 - Think about what a user would expect from version 1.0
 - Complete the main package vignette named mkin to include a method description
 - Improve order of parameters in output
-- Write unit tests for mkinerrmin
-- When checking for degrees of freedom for metabolites, check if their time
-  zero value (state.ini) is fixed instead of checking if the observed value is
-  zero (usually in regulatory kinetics it is set to zero anyway, but in the
-  case of known impurities this may not be the case).
 
 Nice to have:
 - Get starting values for formation fractions from data
diff --git a/inst/unitTests/runit.mkinerrmin.R b/inst/unitTests/runit.mkinerrmin.R
new file mode 100644
index 00000000..56a33ff9
--- /dev/null
+++ b/inst/unitTests/runit.mkinerrmin.R
@@ -0,0 +1,62 @@
+# Test SFO_SFO model with FOCUS_2006_D against Schaefer 2007 paper, tolerance = 1% # {{{
+# and check chi2 error values against values obtained with mkin 0.33
+test.FOCUS_2006_D_SFO_SFO <- function()
+{
+  SFO_SFO.1 <- mkinmod(parent = list(type = "SFO", to = "m1"),
+         m1 = list(type = "SFO"), use_of_ff = "min")
+  SFO_SFO.2 <- mkinmod(parent = list(type = "SFO", to = "m1"),
+         m1 = list(type = "SFO"), use_of_ff = "max")
+
+  fit.1.e <- mkinfit(SFO_SFO.1, FOCUS_2006_D)
+  fit.1.d <- mkinfit(SFO_SFO.1, solution_type = "deSolve", FOCUS_2006_D)
+  fit.2.e <- mkinfit(SFO_SFO.2, FOCUS_2006_D)
+  fit.2.d <- mkinfit(SFO_SFO.2, solution_type = "deSolve", FOCUS_2006_D)
+
+  FOCUS_2006_D_results_schaefer07_means <- c(
+    parent_0 = 99.65, DT50_parent = 7.04, DT50_m1 = 131.34)
+
+  r.1.e <- c(fit.1.e$bparms.optim[[1]], endpoints(fit.1.e)$distimes[[1]])
+  r.1.d <- c(fit.1.d$bparms.optim[[1]], endpoints(fit.1.d)$distimes[[1]])
+  r.2.e <- c(fit.2.e$bparms.optim[[1]], endpoints(fit.2.e)$distimes[[1]])
+  r.2.d <- c(fit.2.d$bparms.optim[[1]], endpoints(fit.2.d)$distimes[[1]])
+
+  dev.1.e <- 100 * (r.1.e - FOCUS_2006_D_results_schaefer07_means)/r.1.e 
+  checkIdentical(as.numeric(abs(dev.1.e)) < 1, rep(TRUE, 3))
+  dev.1.d <- 100 * (r.1.d - FOCUS_2006_D_results_schaefer07_means)/r.1.d 
+  checkIdentical(as.numeric(abs(dev.1.d)) < 1, rep(TRUE, 3))
+  dev.2.e <- 100 * (r.2.e - FOCUS_2006_D_results_schaefer07_means)/r.2.e 
+  checkIdentical(as.numeric(abs(dev.2.e)) < 1, rep(TRUE, 3))
+  dev.2.d <- 100 * (r.2.d - FOCUS_2006_D_results_schaefer07_means)/r.2.d 
+  checkIdentical(as.numeric(abs(dev.2.d)) < 1, rep(TRUE, 3))
+
+  round(mkinerrmin(fit.2.e), 4)
+  round(mkinerrmin(fit.2.d), 4)
+
+  errmin.FOCUS_2006_D_rounded = data.frame(
+    err.min = c(0.0640, 0.0646, 0.0469),
+    n.optim = c(4, 2, 2),
+    df = c(15, 7, 8), 
+    row.names = c("All data", "parent", "m1"))
+  checkEqualsNumeric(round(mkinerrmin(fit.2.e), 4),
+                     errmin.FOCUS_2006_D_rounded)
+} # }}}
+
+# Test SFO_SFO model with FOCUS_2006_E against values obtained with mkin 0.33 {{{
+test.FOCUS_2006_E_SFO_SFO <- function()
+{
+  SFO_SFO.2 <- mkinmod(parent = list(type = "SFO", to = "m1"),
+         m1 = list(type = "SFO"), use_of_ff = "max")
+
+  fit.2.e <- mkinfit(SFO_SFO.2, FOCUS_2006_E)
+
+  round(mkinerrmin(fit.2.e), 4)
+  errmin.FOCUS_2006_E_rounded = data.frame(
+    err.min = c(0.1544, 0.1659, 0.1095),
+    n.optim = c(4, 2, 2),
+    df = c(13, 7, 6),
+    row.names = c("All data", "parent", "m1"))
+  checkEqualsNumeric(round(mkinerrmin(fit.2.e), 4),
+                     errmin.FOCUS_2006_E_rounded)
+} # }}}
+
+
diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R
index fdbc86e0..8eefb995 100644
--- a/inst/unitTests/runit.mkinfit.R
+++ b/inst/unitTests/runit.mkinfit.R
@@ -1,6 +1,4 @@
-# $Id: runit.mkinfit.R 68 2010-09-09 22:40:04Z jranke $
-
-# Copyright (C) 2010-2013 Johannes Ranke
+# Copyright (C) 2010-2014 Johannes Ranke
 # Contact: jranke@uni-bremen.de
 
 # This file is part of the R package mkin
@@ -189,40 +187,6 @@ test.FOCUS_2006_SFORB <- function()
   checkIdentical(dev.B.SFORB.2 < 1, rep(TRUE, length(dev.B.SFORB.2)))
 } # }}}
 
-# Test SFO_SFO model with FOCUS_2006_D against Schaefer 2007 paper, tolerance = 1% # {{{
-test.FOCUS_2006_D_SFO_SFO <- function()
-{
-  SFO_SFO.1 <- mkinmod(parent = list(type = "SFO", to = "m1"),
-         m1 = list(type = "SFO"), use_of_ff = "min")
-  SFO_SFO.2 <- mkinmod(parent = list(type = "SFO", to = "m1"),
-         m1 = list(type = "SFO"), use_of_ff = "max")
-
-  fit.1.e <- mkinfit(SFO_SFO.1, FOCUS_2006_D)
-  fit.1.d <- mkinfit(SFO_SFO.1, solution_type = "deSolve", FOCUS_2006_D)
-  fit.2.e <- mkinfit(SFO_SFO.2, FOCUS_2006_D)
-  SFO <- mkinmod(parent = list(type = "SFO"))
-  f.SFO <- mkinfit(SFO, FOCUS_2006_D)
-  fit.2.d <- mkinfit(SFO_SFO.2, solution_type = "deSolve", FOCUS_2006_D)
-  fit.2.e <- mkinfit(SFO_SFO.2, FOCUS_2006_D)
-
-  FOCUS_2006_D_results_schaefer07_means <- c(
-    parent_0 = 99.65, DT50_parent = 7.04, DT50_m1 = 131.34)
-
-  r.1.e <- c(fit.1.e$bparms.optim[[1]], endpoints(fit.1.e)$distimes[[1]])
-  r.1.d <- c(fit.1.d$bparms.optim[[1]], endpoints(fit.1.d)$distimes[[1]])
-  r.2.e <- c(fit.2.e$bparms.optim[[1]], endpoints(fit.2.e)$distimes[[1]])
-  r.2.d <- c(fit.2.d$bparms.optim[[1]], endpoints(fit.2.d)$distimes[[1]])
-
-  dev.1.e <- 100 * (r.1.e - FOCUS_2006_D_results_schaefer07_means)/r.1.e 
-  checkIdentical(as.numeric(abs(dev.1.e)) < 1, rep(TRUE, 3))
-  dev.1.d <- 100 * (r.1.d - FOCUS_2006_D_results_schaefer07_means)/r.1.d 
-  checkIdentical(as.numeric(abs(dev.1.d)) < 1, rep(TRUE, 3))
-  dev.2.e <- 100 * (r.2.e - FOCUS_2006_D_results_schaefer07_means)/r.2.e 
-  checkIdentical(as.numeric(abs(dev.2.e)) < 1, rep(TRUE, 3))
-  dev.2.d <- 100 * (r.2.d - FOCUS_2006_D_results_schaefer07_means)/r.2.d 
-  checkIdentical(as.numeric(abs(dev.2.d)) < 1, rep(TRUE, 3))
-} # }}}
-
 # Test eigenvalue based fit to Schaefer 2007 data against solution from conference paper {{{
 test.mkinfit.schaefer07_complex_example <- function()
 {
diff --git a/man/mkinerrmin.Rd b/man/mkinerrmin.Rd
index c43d87a1..78ab414e 100644
--- a/man/mkinerrmin.Rd
+++ b/man/mkinerrmin.Rd
@@ -34,6 +34,16 @@ mkinerrmin(fit, alpha = 0.05)
 \details{
     This function is used internally by \code{\link{summary.mkinfit}}.
 }
+\examples{
+SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"),
+                  m1 = list(type = "SFO"),
+                  use_of_ff = "max")
+
+fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+round(mkinerrmin(fit_FOCUS_D), 4)
+fit_FOCUS_E = mkinfit(SFO_SFO, FOCUS_2006_E, quiet = TRUE)
+round(mkinerrmin(fit_FOCUS_E), 4)
+}
 \references{ 
   FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence and
   Degradation Kinetics from Environmental Fate Studies on Pesticides in EU
diff --git a/tests/doRUnit.R b/tests/doRUnit.R
index f0f82812..9faee940 100644
--- a/tests/doRUnit.R
+++ b/tests/doRUnit.R
@@ -1,4 +1,3 @@
-# $Id: doRUnit.R 96 2011-04-29 11:10:40Z jranke $
 # Adapted from a version around 2.9 of the rcdk package by Rajarshi Guha
 if(require("RUnit", quietly=TRUE)) {
  
diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html
index ab7ccaee..2dd186de 100644
--- a/vignettes/FOCUS_L.html
+++ b/vignettes/FOCUS_L.html
@@ -193,7 +193,13 @@ hr {
 report, p. 284:
 
 library("mkin")
-FOCUS_2006_L1 = data.frame(
+
+
+## Loading required package: minpack.lm
+## Loading required package: rootSolve
+
+
+FOCUS_2006_L1 = data.frame(
   t = rep(c(0, 1, 2, 3, 5, 7, 14, 21, 30), each = 2),
   parent = c(88.3, 91.4, 85.6, 84.5, 78.9, 77.6, 
              72.0, 71.9, 50.3, 59.4, 47.0, 45.1,
@@ -215,17 +221,17 @@ given in the FOCUS report. 
 summary(m.L1.SFO)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:09 2014 
-## Date of summary: Thu Jul 24 10:32:09 2014 
+## Date of fit:     Mon Aug 25 10:34:14 2014 
+## Date of summary: Mon Aug 25 10:34:14 2014 
 ## 
 ## Equations:
-## [1] d_parent = - k_parent_sink * parent
+## d_parent = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 14 model solutions performed in 0.081 s
+## Fitted with method Marq using 14 model solutions performed in 0.083 s
 ## 
 ## Weighting: none
 ## 
@@ -318,17 +324,17 @@ is checked.
 summary(m.L1.FOMC, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:10 2014 
-## Date of summary: Thu Jul 24 10:32:11 2014 
+## Date of fit:     Mon Aug 25 10:34:17 2014 
+## Date of summary: Mon Aug 25 10:34:17 2014 
 ## 
 ## Equations:
-## [1] d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
+## d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 53 model solutions performed in 0.321 s
+## Fitted with method Marq using 53 model solutions performed in 0.3 s
 ## 
 ## Weighting: none
 ## 
@@ -412,17 +418,17 @@ FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
 summary(m.L2.SFO)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:11 2014 
-## Date of summary: Thu Jul 24 10:32:11 2014 
+## Date of fit:     Mon Aug 25 10:34:17 2014 
+## Date of summary: Mon Aug 25 10:34:17 2014 
 ## 
 ## Equations:
-## [1] d_parent = - k_parent_sink * parent
+## d_parent = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 29 model solutions performed in 0.196 s
+## Fitted with method Marq using 29 model solutions performed in 0.184 s
 ## 
 ## Weighting: none
 ## 
@@ -522,17 +528,17 @@ mkinresplot(m.L2.FOMC)
 summary(m.L2.FOMC, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:11 2014 
-## Date of summary: Thu Jul 24 10:32:11 2014 
+## Date of fit:     Mon Aug 25 10:34:17 2014 
+## Date of summary: Mon Aug 25 10:34:17 2014 
 ## 
 ## Equations:
-## [1] d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
+## d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 35 model solutions performed in 0.223 s
+## Fitted with method Marq using 35 model solutions performed in 0.2 s
 ## 
 ## Weighting: none
 ## 
@@ -608,17 +614,19 @@ plot(m.L2.DFOP)
 summary(m.L2.DFOP, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:12 2014 
-## Date of summary: Thu Jul 24 10:32:12 2014 
+## Date of fit:     Mon Aug 25 10:34:18 2014 
+## Date of summary: Mon Aug 25 10:34:18 2014 
 ## 
 ## Equations:
-## [1] d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time))) * parent
+## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * 
+##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * 
+##            time))) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 43 model solutions performed in 0.271 s
+## Fitted with method Marq using 43 model solutions performed in 0.26 s
 ## 
 ## Weighting: none
 ## 
@@ -695,17 +703,17 @@ plot(m.L3.SFO)
 summary(m.L3.SFO)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:14 2014 
-## Date of summary: Thu Jul 24 10:32:14 2014 
+## Date of fit:     Mon Aug 25 10:34:18 2014 
+## Date of summary: Mon Aug 25 10:34:18 2014 
 ## 
 ## Equations:
-## [1] d_parent = - k_parent_sink * parent
+## d_parent = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 44 model solutions performed in 0.251 s
+## Fitted with method Marq using 44 model solutions performed in 0.252 s
 ## 
 ## Weighting: none
 ## 
@@ -781,17 +789,17 @@ plot(m.L3.FOMC)
 summary(m.L3.FOMC, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:14 2014 
-## Date of summary: Thu Jul 24 10:32:14 2014 
+## Date of fit:     Mon Aug 25 10:34:19 2014 
+## Date of summary: Mon Aug 25 10:34:19 2014 
 ## 
 ## Equations:
-## [1] d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
+## d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 26 model solutions performed in 0.154 s
+## Fitted with method Marq using 26 model solutions performed in 0.148 s
 ## 
 ## Weighting: none
 ## 
@@ -854,17 +862,19 @@ plot(m.L3.DFOP)
 summary(m.L3.DFOP, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:14 2014 
-## Date of summary: Thu Jul 24 10:32:14 2014 
+## Date of fit:     Mon Aug 25 10:34:19 2014 
+## Date of summary: Mon Aug 25 10:34:19 2014 
 ## 
 ## Equations:
-## [1] d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time))) * parent
+## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * 
+##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * 
+##            time))) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 37 model solutions performed in 0.228 s
+## Fitted with method Marq using 37 model solutions performed in 0.236 s
 ## 
 ## Weighting: none
 ## 
@@ -950,17 +960,17 @@ plot(m.L4.SFO)
 summary(m.L4.SFO, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:15 2014 
-## Date of summary: Thu Jul 24 10:32:15 2014 
+## Date of fit:     Mon Aug 25 10:34:19 2014 
+## Date of summary: Mon Aug 25 10:34:19 2014 
 ## 
 ## Equations:
-## [1] d_parent = - k_parent_sink * parent
+## d_parent = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 20 model solutions performed in 0.141 s
+## Fitted with method Marq using 20 model solutions performed in 0.123 s
 ## 
 ## Weighting: none
 ## 
@@ -1025,17 +1035,17 @@ plot(m.L4.FOMC)
 summary(m.L4.FOMC, data = FALSE)
 
 
-## mkin version:    0.9.32 
+## mkin version:    0.9.33 
 ## R version:       3.1.1 
-## Date of fit:     Thu Jul 24 10:32:15 2014 
-## Date of summary: Thu Jul 24 10:32:15 2014 
+## Date of fit:     Mon Aug 25 10:34:20 2014 
+## Date of summary: Mon Aug 25 10:34:20 2014 
 ## 
 ## Equations:
-## [1] d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
+## d_parent = - (alpha/beta) * ((time/beta) + 1)^-1 * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Marq using 48 model solutions performed in 0.296 s
+## Fitted with method Marq using 48 model solutions performed in 0.281 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_Z.pdf b/vignettes/FOCUS_Z.pdf
index 210ce099..ca6d2506 100644
Binary files a/vignettes/FOCUS_Z.pdf and b/vignettes/FOCUS_Z.pdf differ
-- 
cgit v1.2.3