From 6211f3ef4995657798686d8d4ab43ed9406e8a08 Mon Sep 17 00:00:00 2001
From: Johannes Ranke A comprehensive report of the results is obtained using the The following code defines example dataset L1 from the FOCUS kinetics report, p. 284: Here we use the assumptions of simple first order (SFO), the case of declining rate constant over time (FOMC) and the case of two different phases of the kinetics (DFOP). For a more detailed discussion of the models, please see the FOCUS kinetics report. Since mkin version 0.9-32 (July 2014), we can use shorthand notation like A plot of the fit is obtained with the plot function for mkinfit objects. The residual plot can be easily obtained by For comparison, the FOMC model is fitted as well, and the \(\chi^2\) error level is checked. We get a warning that the default optimisation algorithm And in fact, due to the higher number of parameters, and the lower number of degrees of freedom of the fit, the \(\chi^2\) error level is actually higher for the FOMC model (3.6%) than for the SFO model (3.4%). Additionally, the parameters The \(\chi^2\) error levels reported in Appendix 3 and Appendix 7 to the FOCUS kinetics report are rounded to integer percentages and partly deviate by one percentage point from the results calculated by mkin. The reason for this is not known. However, mkin gives the same \(\chi^2\) error levels as the kinfit package and the calculation routines of the kinfit package have been extensively compared to the results obtained by the KinGUI software, as documented in the kinfit package vignette. KinGUI was the first widely used standard package in this field. Also, the calculation of \(\chi^2\) error levels was compared with KinGUII, CAKE and DegKin manager in a project sponsored by the German Umweltbundesamt (Ranke 2014). The following code defines example dataset L2 from the FOCUS kinetics report, p. 287: Again, the SFO model is fitted and the result is plotted. The residual plot can be obtained simply by adding the argument The \(\chi^2\) error level of 14% suggests that the model does not fit very well. This is also obvious from the plots of the fit, in which we have included the residual plot. In the FOCUS kinetics report, it is stated that there is no apparent systematic error observed from the residual plot up to the measured DT90 (approximately at day 5), and there is an underestimation beyond that point. For comparison, the FOMC model is fitted as well, and the \(\chi^2\) error level is checked. Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level. The following code defines example dataset L3 from the FOCUS kinetics report, p. 290. As of mkin version 0.9-39 (June 2015), we can fit several models to one or more datasets in one call to the function The \(\chi^2\) error level of 21% as well as the plot suggest that the SFO model does not fit very well. The FOMC model performs better, with an error level at which the \(\chi^2\) test passes of 7%. Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level considerably. The objects returned by mmkin are arranged like a matrix, with models as a row index and datasets as a column index. We can extract the summary and plot for e.g. the DFOP fit, using square brackets for indexing which will result in the use of the summary and plot functions working on mkinfit objects. Here, a look to the model plot, the confidence intervals of the parameters and the correlation matrix suggest that the parameter estimates are reliable, and the DFOP model can be used as the best-fit model based on the \(\chi^2\) error level criterion for laboratory data L3. This is also an example where the standard t-test for the parameter The following code defines example dataset L4 from the FOCUS kinetics report, p. 293: Fits of the SFO and FOMC models, plots and summaries are produced below: The \(\chi^2\) error level of 3.3% as well as the plot suggest that the SFO model fits very well. The error level at which the \(\chi^2\) test passes is slightly lower for the FOMC model. However, the difference appears negligible. The following code defines the example dataset from Appendix 7 to the FOCUS kinetics report (FOCUS Work Group on Degradation Kinetics 2014, 354). The next step is to set up the models used for the kinetic analysis. As the simultaneous fit of parent and the first metabolite is usually straightforward, Step 1 (SFO for parent only) is skipped here. We start with the model 2a, with formation and decline of metabolite Z1 and the pathway from parent directly to sink included (default in mkin). As obvious from the parameter summary (the component of the summary), the kinetic rate constant from parent compound Z to sink is very small and the t-test for this parameter suggests that it is not significantly different from zero. This suggests, in agreement with the analysis in the FOCUS kinetics report, to simplify the model by removing the pathway to sink. A similar result can be obtained when formation fractions are used in the model formulation: Here, the ilr transformed formation fraction fitted in the model takes a very large value, and the backtransformed formation fraction from parent Z to Z1 is practically unity. Here, the covariance matrix used for the calculation of confidence intervals is not returned as the model is overparameterised. A simplified model is obtained by removing the pathway to the sink. In the following, we use the parameterisation with formation fractions in order to be able to compare with the results in the FOCUS guidance, and as it makes it easier to use parameters obtained in a previous fit when adding a further metabolite. As suggested in the FOCUS report, the pathway to sink was removed for metabolite Z1 as well in the next step. While this step appears questionable on the basis of the above results, it is followed here for the purpose of comparison. Also, in the FOCUS report, it is assumed that there is additional empirical evidence that Z1 quickly and exclusively hydrolyses to Z2. Finally, metabolite Z3 is added to the model. We use the optimised differential equation parameter values from the previous fit in order to accelerate the optimization. This fit corresponds to the final result chosen in Appendix 7 of the FOCUS report. Confidence intervals returned by mkin are based on internally transformed parameters, however. As the FOCUS report states, there is a certain tailing of the time course of metabolite Z3. Also, the time course of the parent compound is not fitted very well using the SFO model, as residues at a certain low level remain. Therefore, an additional model is offered here, using the single first-order reversible binding (SFORB) model for metabolite Z3. As expected, the \(\chi^2\) error level is lower for metabolite Z3 using this model and the graphical fit for Z3 is improved. However, the covariance matrix is not returned. Therefore, a further stepwise model building is performed starting from the stage of parent and two metabolites, starting from the assumption that the model fit for the parent compound can be improved by using the SFORB model. This results in a much better representation of the behaviour of the parent compound Z0. Finally, Z3 is added as well. These models appear overparameterised (no covariance matrix returned) if the sink for Z1 is left in the models. The error level of the fit, but especially of metabolite Z3, can be improved if the SFORB model is chosen for this metabolite, as this model is capable of representing the tailing of the metabolite decline phase. The summary view of the backtransformed parameters shows that we get no confidence intervals due to overparameterisation. As the optimized is excessively small, it seems reasonable to fix it to zero. As expected, the residual plots for Z0 and Z3 are more random than in the case of the all SFO model for which they were shown above. In conclusion, the model is proposed as the best-fit model for the dataset from Appendix 7 of the FOCUS report. A graphical representation of the confidence intervals can finally be obtained. The endpoints obtained with this model are It is clear the degradation rate of Z3 towards the end of the experiment is very low as DT50_Z3_b2 (the second Eigenvalue of the system of two differential equations representing the SFORB system for Z3, corresponding to the slower rate constant of the DFOP model) is reported to be infinity. However, this appears to be a feature of the data. For this dataset, the IORE fit does not converge when the default starting values used by mkin for the IORE model are used. Therefore, a lower value for the rate constant is used here. In this case, the DFOP fit reported for PestDF resulted in a negative value for the slower rate constant, which is not possible in mkin. The other results are in agreement. When using an mkin version equal to or greater than 0.9-36 and a C compiler is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. Starting from version 0.9.49.9, the In previous versions, it used On Linux, you need to have the essential build tools like make and gcc or clang installed. On Debian based linux distributions, these will be pulled in by installing the build-essential package. On MacOS, which I do not use personally, I have had reports that a compiler is available by default. On Windows, you need to install Rtools and have the path to its bin directory in your PATH variable. You do not need to modify the PATH variable when installing Rtools. Instead, I would recommend to put the line into your .Rprofile startup file. This is just a text file with some R code that is executed when your R session starts. It has to be named .Rprofile and has to be located in your home directory, which will generally be your Documents folder. You can check the location of the home directory used by R by issuing First, we build a simple degradation model for a parent compound with one metabolite. First, we build a simple degradation model for a parent compound with one metabolite, and we remove zero values from the dataset. We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package. In the output of below code, the warnings about zero being removed from the FOCUS D dataset are suppressed. We see that using the compiled model is by a factor of around 9 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs. We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package. In the output of below code, the warnings about zero being removed from the FOCUS D dataset are suppressed. Since mkin version 0.9.49.11, an analytical solution is also implemented, which is included in the tests below. We see that using the compiled model is by more than a factor of 10 faster than using deSolve without compiled code. This evaluation is also taken from the example section of mkinfit. This evaluation is also taken from the example section of mkinfit. No analytical solution is available for this system, and now Eigenvalue based solution is possible, so only deSolve using with or without compiled code is available. Here we get a performance benefit of a factor of 11 using the version of the differential equation model compiled from C code! This vignette was built with mkin 0.9.49.9 on Here we get a performance benefit of a factor of 30 using the version of the differential equation model compiled from C code! This vignette was built with mkin 0.9.50.2 on Increase tolerance for a platform specific test results on the Solaris test machine on CRAN The function is called for its side effect. A data frame containing the following variables. A data frame containing the following variables. a factor giving the name of the software package The fitted initial concentration of the parent compound The fitted f parameter A data frame containing the following variables. A data frame containing the following variables. a factor giving the name of the software package The fitted initial concentration of the parent compound The fitted alpha parameter A data frame containing the following variables. A data frame containing the following variables. a factor giving the name of the software package The fitted initial concentration of the parent compound The fitted tb parameter A data frame containing the following variables. A data frame containing the following variables. a factor giving the name of the software package The fitted initial concentration of the parent compound The fitted first-order degradation rate constant 6 datasets with observations on the following variables. 6 datasets with observations on the following variables. a factor containing the name of the observed variable a numeric vector containing time points a numeric vector containing concentrations in percent of applied radioactivity 2 datasets with observations on the following variables. 2 datasets with observations on the following variables. a factor containing the name of the observed variable a numeric vector containing time points a numeric vector containing concentrations A list containing twelve datasets as an R6 class defined by The name of the dataset, e.g. A data frame with the data in the form expected by Example evaluation of FOCUS Example Dataset D
Johannes Ranke
- 2020-05-11
+ 2020-05-12
Source: vignettes/FOCUS_D.Rmd
FOCUS_D.Rmd
summary
method for mkinfit
objects.summary(fit)
+#> [1] 841.41## mkin version used for fitting: 0.9.50
+
-
@@ -191,7 +195,7 @@
diff --git a/docs/reference/FOMC.solution.html b/docs/reference/FOMC.solution.html
index f8fbd2ba..a7236844 100644
--- a/docs/reference/FOMC.solution.html
+++ b/docs/reference/FOMC.solution.html
@@ -73,7 +73,7 @@ a decreasing rate constant." />
diff --git a/docs/reference/HS.solution.html b/docs/reference/HS.solution.html
index 9404893c..2c4eebe3 100644
--- a/docs/reference/HS.solution.html
+++ b/docs/reference/HS.solution.html
@@ -73,7 +73,7 @@ between them." />
diff --git a/docs/reference/IORE.solution.html b/docs/reference/IORE.solution.html
index 194d11aa..9c8df9b3 100644
--- a/docs/reference/IORE.solution.html
+++ b/docs/reference/IORE.solution.html
@@ -73,7 +73,7 @@ a concentration dependent rate constant." />
diff --git a/docs/reference/NAFTA_SOP_2015.html b/docs/reference/NAFTA_SOP_2015.html
index 5ad02bf9..97674400 100644
--- a/docs/reference/NAFTA_SOP_2015.html
+++ b/docs/reference/NAFTA_SOP_2015.html
@@ -10,23 +10,27 @@
-
+
-
+
-
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
@@ -37,7 +41,6 @@
-
@@ -55,7 +58,7 @@
-
+
## mkin version used for fitting: 0.9.50.2
## R version used for fitting: 4.0.0
-## Date of fit: Mon May 11 05:14:41 2020
-## Date of summary: Mon May 11 05:14:41 2020
+## Date of fit: Tue May 12 15:31:36 2020
+## Date of summary: Tue May 12 15:31:36 2020
##
## Equations:
## d_parent/dt = - k_parent * parent
@@ -186,7 +186,7 @@
##
## Model predictions using solution type analytical
##
-## Fitted using 421 model solutions performed in 0.167 s
+## Fitted using 421 model solutions performed in 0.165 s
##
## Error model: Constant variance
##
diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html
index 4033beba..742718cb 100644
--- a/docs/articles/FOCUS_L.html
+++ b/docs/articles/FOCUS_L.html
@@ -6,19 +6,19 @@
Example evaluation of FOCUS Laboratory Data L1 to L3
+ Example evaluation of FOCUS Laboratory Data L1 to L3
Johannes Ranke
- 2019-11-01
-
+ 2020-05-12
+ Source: vignettes/FOCUS_L.Rmd
FOCUS_L.Rmd
Laboratory Data L1
library("mkin", quietly = TRUE)
-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,
- 27.7, 27.3, 10.0, 10.4, 2.9, 4.0))
-FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)
library("mkin", quietly = TRUE)
+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,
+ 27.7, 27.3, 10.0, 10.4, 2.9, 4.0))
+FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)
"SFO"
for parent only degradation models. The following two lines fit the model and produce the summary report of the model fit. This covers the numerical analysis given in the FOCUS report.## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:46 2019
-## Date of summary: Fri Nov 1 10:10:46 2019
+
+
## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:38 2020
+## Date of summary: Tue May 12 15:31:38 2020
##
## Equations:
## d_parent/dt = - k_parent_sink * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 133 model solutions performed in 0.287 s
+## Fitted using 133 model solutions performed in 0.03 s
##
## Error model: Constant variance
##
@@ -143,6 +150,11 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 93.88778 96.5589 -43.94389
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 92.470 1.28200 89.740 95.200
@@ -151,9 +163,9 @@
##
## Parameter correlation:
## parent_0 log_k_parent_sink sigma
-## parent_0 1.000e+00 6.186e-01 -1.712e-09
-## log_k_parent_sink 6.186e-01 1.000e+00 -3.237e-09
-## sigma -1.712e-09 -3.237e-09 1.000e+00
+## parent_0 1.000e+00 6.186e-01 -1.516e-09
+## log_k_parent_sink 6.186e-01 1.000e+00 -3.124e-09
+## sigma -1.516e-09 -3.124e-09 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -169,10 +181,6 @@
## All data 3.424 2 7
## parent 3.424 2 7
##
-## Resulting formation fractions:
-## ff
-## parent_sink 1
-##
## Estimated disappearance times:
## DT50 DT90
## parent 7.249 24.08
@@ -198,26 +206,26 @@
## 30 parent 2.9 5.251 -2.3513
## 30 parent 4.0 5.251 -1.2513
plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")
mkinresplot(m.L1.SFO, ylab = "Observed", xlab = "Time")
m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
-
+## Warning in mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet = TRUE): Optimisation did not converge:
## false convergence (8)
plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
summary(m.L1.FOMC, data = FALSE)
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
-## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:48 2019
-## Date of summary: Fri Nov 1 10:10:48 2019
+
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+## DT50 DT90 DT50back
+## parent 7.25 24.08 7.25## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:38 2020
+## Date of summary: Tue May 12 15:31:38 2020
##
##
## Warning: Optimisation did not converge:
@@ -229,7 +237,7 @@
##
## Model predictions using solution type analytical
##
-## Fitted using 899 model solutions performed in 1.91 s
+## Fitted using 380 model solutions performed in 0.081 s
##
## Error model: Constant variance
##
@@ -250,29 +258,34 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 95.88778 99.44927 -43.94389
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
-## parent_0 92.47 1.2800 89.730 95.220
-## log_alpha 10.58 NaN NaN NaN
-## log_beta 12.93 NaN NaN NaN
-## sigma 2.78 0.4507 1.813 3.747
+## parent_0 92.47 1.2820 89.720 95.220
+## log_alpha 16.92 NaN NaN NaN
+## log_beta 19.26 NaN NaN NaN
+## sigma 2.78 0.4501 1.814 3.745
##
## Parameter correlation:
-## parent_0 log_alpha log_beta sigma
-## parent_0 1.00000 NaN NaN 0.01452
-## log_alpha NaN 1 NaN NaN
-## log_beta NaN NaN 1 NaN
-## sigma 0.01452 NaN NaN 1.00000
+## parent_0 log_alpha log_beta sigma
+## parent_0 1.000000 NaN NaN 0.002218
+## log_alpha NaN 1 NaN NaN
+## log_beta NaN NaN 1 NaN
+## sigma 0.002218 NaN NaN 1.000000
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
## t-test (unrealistically) based on the assumption of normal distribution
## for estimators of untransformed parameters.
-## Estimate t value Pr(>t) Lower Upper
-## parent_0 92.47 72.13000 1.052e-19 89.730 95.220
-## alpha 39440.00 0.02397 4.906e-01 NA NA
-## beta 412500.00 0.02397 4.906e-01 NA NA
-## sigma 2.78 6.00000 1.628e-05 1.813 3.747
+## Estimate t value Pr(>t) Lower Upper
+## parent_0 9.247e+01 NA NA 89.720 95.220
+## alpha 2.223e+07 NA NA NA NA
+## beta 2.325e+08 NA NA NA NA
+## sigma 2.780e+00 NA NA 1.814 3.745
##
## FOCUS Chi2 error levels in percent:
## err.min n.optim df
@@ -280,8 +293,8 @@
## parent 3.619 3 6
##
## Estimated disappearance times:
-## DT50 DT90 DT50back
-## parent 7.249 24.08 7.249
Port
did not converge, which is an indication that the model is overparameterised, i.e. contains too many parameters that are ill-defined as a consequence.log_alpha
and log_beta
internally fitted in the model have excessive confidence intervals, that span more than 25 orders of magnitude (!) when backtransformed to the scale of alpha
and beta
. Also, the t-test for significant difference from zero does not indicate such a significant difference, with p-values greater than 0.1, and finally, the parameter correlation of log_alpha
and log_beta
is 1.000, clearly indicating that the model is overparameterised.
Laboratory Data L2
FOCUS_2006_L2 = data.frame(
- t = rep(c(0, 1, 3, 7, 14, 28), each = 2),
- parent = c(96.1, 91.8, 41.4, 38.7,
- 19.3, 22.3, 4.6, 4.6,
- 2.6, 1.2, 0.3, 0.6))
-FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
FOCUS_2006_L2 = data.frame(
+ t = rep(c(0, 1, 3, 7, 14, 28), each = 2),
+ parent = c(96.1, 91.8, 41.4, 38.7,
+ 19.3, 22.3, 4.6, 4.6,
+ 2.6, 1.2, 0.3, 0.6))
+FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
SFO fit for L2
show_residuals
to the plot command.m.L2.SFO <- mkinfit("SFO", FOCUS_2006_L2_mkin, quiet=TRUE)
-plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
- main = "FOCUS L2 - SFO")
m.L2.SFO <- mkinfit("SFO", FOCUS_2006_L2_mkin, quiet=TRUE)
+plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
+ main = "FOCUS L2 - SFO")
FOMC fit for L2
m.L2.FOMC <- mkinfit("FOMC", FOCUS_2006_L2_mkin, quiet = TRUE)
-plot(m.L2.FOMC, show_residuals = TRUE,
- main = "FOCUS L2 - FOMC")
m.L2.FOMC <- mkinfit("FOMC", FOCUS_2006_L2_mkin, quiet = TRUE)
+plot(m.L2.FOMC, show_residuals = TRUE,
+ main = "FOCUS L2 - FOMC")
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:49 2019
-## Date of summary: Fri Nov 1 10:10:49 2019
+
summary(m.L2.FOMC, data = FALSE)
## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:39 2020
+## Date of summary: Tue May 12 15:31:39 2020
##
## 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.489 s
+## Fitted using 239 model solutions performed in 0.047 s
##
## Error model: Constant variance
##
@@ -348,6 +361,11 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 61.78966 63.72928 -26.89483
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 93.7700 1.6130 90.05000 97.4900
@@ -357,10 +375,10 @@
##
## Parameter correlation:
## parent_0 log_alpha log_beta sigma
-## parent_0 1.000e+00 -1.151e-01 -2.085e-01 -7.637e-09
+## parent_0 1.000e+00 -1.151e-01 -2.085e-01 -7.436e-09
## log_alpha -1.151e-01 1.000e+00 9.741e-01 -1.617e-07
-## log_beta -2.085e-01 9.741e-01 1.000e+00 -1.387e-07
-## sigma -7.637e-09 -1.617e-07 -1.387e-07 1.000e+00
+## log_beta -2.085e-01 9.741e-01 1.000e+00 -1.386e-07
+## sigma -7.436e-09 -1.617e-07 -1.386e-07 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -386,24 +404,24 @@
DFOP fit for L2
m.L2.DFOP <- mkinfit("DFOP", FOCUS_2006_L2_mkin, quiet = TRUE)
-plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
- main = "FOCUS L2 - DFOP")
m.L2.DFOP <- mkinfit("DFOP", FOCUS_2006_L2_mkin, quiet = TRUE)
+plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
+ main = "FOCUS L2 - DFOP")
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:51 2019
-## Date of summary: Fri Nov 1 10:10:51 2019
+
summary(m.L2.DFOP, data = FALSE)
## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:39 2020
+## Date of summary: Tue May 12 15:31:39 2020
##
## Equations:
-## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
-## exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) *
-## exp(-k2 * time))) * parent
+## d_parent/dt = - ((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 using 572 model solutions performed in 1.218 s
+## Fitted using 572 model solutions performed in 0.13 s
##
## Error model: Constant variance
##
@@ -426,21 +444,26 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 52.36695 54.79148 -21.18347
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 93.9500 9.998e-01 91.5900 96.3100
-## log_k1 3.1370 2.376e+03 -5616.0000 5622.0000
+## log_k1 3.1370 2.376e+03 -5615.0000 5622.0000
## log_k2 -1.0880 6.285e-02 -1.2370 -0.9394
## g_ilr -0.2821 7.033e-02 -0.4484 -0.1158
## sigma 1.4140 2.886e-01 0.7314 2.0960
##
## Parameter correlation:
## parent_0 log_k1 log_k2 g_ilr sigma
-## parent_0 1.000e+00 5.155e-07 2.371e-09 2.665e-01 -6.849e-09
-## log_k1 5.155e-07 1.000e+00 8.434e-05 -1.659e-04 -7.791e-06
-## log_k2 2.371e-09 8.434e-05 1.000e+00 -7.903e-01 -1.262e-08
-## g_ilr 2.665e-01 -1.659e-04 -7.903e-01 1.000e+00 3.241e-08
-## sigma -6.849e-09 -7.791e-06 -1.262e-08 3.241e-08 1.000e+00
+## parent_0 1.000e+00 5.157e-07 2.376e-09 2.665e-01 -6.837e-09
+## log_k1 5.157e-07 1.000e+00 8.434e-05 -1.659e-04 -7.786e-06
+## log_k2 2.376e-09 8.434e-05 1.000e+00 -7.903e-01 -1.263e-08
+## g_ilr 2.665e-01 -1.659e-04 -7.903e-01 1.000e+00 3.248e-08
+## sigma -6.837e-09 -7.786e-06 -1.263e-08 3.248e-08 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -468,18 +491,18 @@
Laboratory Data L3
FOCUS_2006_L3 = data.frame(
- t = c(0, 3, 7, 14, 30, 60, 91, 120),
- parent = c(97.8, 60, 51, 43, 35, 22, 15, 12))
-FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
FOCUS_2006_L3 = data.frame(
+ t = c(0, 3, 7, 14, 30, 60, 91, 120),
+ parent = c(97.8, 60, 51, 43, 35, 22, 15, 12))
+FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
Fit multiple models
mmkin
. The datasets have to be passed in a list, in this case a named list holding only the L3 dataset prepared above.# Only use one core here, not to offend the CRAN checks
-mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1,
- list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE)
-plot(mm.L3)
# Only use one core here, not to offend the CRAN checks
+mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1,
+ list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE)
+plot(mm.L3)
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:53 2019
-## Date of summary: Fri Nov 1 10:10:53 2019
+
summary(mm.L3[["DFOP", 1]])
-
+## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:39 2020
+## Date of summary: Tue May 12 15:31:40 2020
##
## Equations:
-## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
-## exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) *
-## exp(-k2 * time))) * parent
+## d_parent/dt = - ((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 using 373 model solutions performed in 0.784 s
+## Fitted using 373 model solutions performed in 0.083 s
##
## Error model: Constant variance
##
@@ -524,6 +547,11 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 32.97732 33.37453 -11.48866
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 97.7500 1.01900 94.5000 101.000000
@@ -534,11 +562,11 @@
##
## Parameter correlation:
## parent_0 log_k1 log_k2 g_ilr sigma
-## parent_0 1.000e+00 1.732e-01 2.282e-02 4.009e-01 -6.872e-07
-## log_k1 1.732e-01 1.000e+00 4.945e-01 -5.809e-01 3.200e-07
-## log_k2 2.282e-02 4.945e-01 1.000e+00 -6.812e-01 7.673e-07
-## g_ilr 4.009e-01 -5.809e-01 -6.812e-01 1.000e+00 -8.731e-07
-## sigma -6.872e-07 3.200e-07 7.673e-07 -8.731e-07 1.000e+00
+## parent_0 1.000e+00 1.732e-01 2.282e-02 4.009e-01 -6.868e-07
+## log_k1 1.732e-01 1.000e+00 4.945e-01 -5.809e-01 3.175e-07
+## log_k2 2.282e-02 4.945e-01 1.000e+00 -6.812e-01 7.631e-07
+## g_ilr 4.009e-01 -5.809e-01 -6.812e-01 1.000e+00 -8.694e-07
+## sigma -6.868e-07 3.175e-07 7.631e-07 -8.694e-07 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -570,7 +598,7 @@
## 60 parent 22.0 23.26 -1.25919
## 91 parent 15.0 15.18 -0.18181
## 120 parent 12.0 10.19 1.81395
plot(mm.L3[["DFOP", 1]], show_errmin = TRUE)
g_ilr
is misleading, as it tests for a significant difference from zero. In this case, zero appears to be the correct value for this parameter, and the confidence interval for the backtransformed parameter g
is quite narrow.
Laboratory Data L4
FOCUS_2006_L4 = data.frame(
- t = c(0, 3, 7, 14, 30, 60, 91, 120),
- parent = c(96.6, 96.3, 94.3, 88.8, 74.9, 59.9, 53.5, 49.0))
-FOCUS_2006_L4_mkin <- mkin_wide_to_long(FOCUS_2006_L4)
FOCUS_2006_L4 = data.frame(
+ t = c(0, 3, 7, 14, 30, 60, 91, 120),
+ parent = c(96.6, 96.3, 94.3, 88.8, 74.9, 59.9, 53.5, 49.0))
+FOCUS_2006_L4_mkin <- mkin_wide_to_long(FOCUS_2006_L4)
# Only use one core here, not to offend the CRAN checks
-mm.L4 <- mmkin(c("SFO", "FOMC"), cores = 1,
- list("FOCUS L4" = FOCUS_2006_L4_mkin),
- quiet = TRUE)
-plot(mm.L4)
# Only use one core here, not to offend the CRAN checks
+mm.L4 <- mmkin(c("SFO", "FOMC"), cores = 1,
+ list("FOCUS L4" = FOCUS_2006_L4_mkin),
+ quiet = TRUE)
+plot(mm.L4)
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:53 2019
-## Date of summary: Fri Nov 1 10:10:54 2019
+
summary(mm.L4[["SFO", 1]], data = FALSE)
-
-## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:40 2020
+## Date of summary: Tue May 12 15:31:40 2020
##
## Equations:
## d_parent/dt = - k_parent_sink * parent
##
## Model predictions using solution type analytical
##
-## Fitted using 142 model solutions performed in 0.292 s
+## Fitted using 142 model solutions performed in 0.029 s
##
## Error model: Constant variance
##
@@ -622,6 +650,11 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 47.12133 47.35966 -20.56067
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 96.440 1.69900 92.070 100.800
@@ -630,9 +663,9 @@
##
## Parameter correlation:
## parent_0 log_k_parent_sink sigma
-## parent_0 1.000e+00 5.938e-01 3.440e-07
-## log_k_parent_sink 5.938e-01 1.000e+00 5.885e-07
-## sigma 3.440e-07 5.885e-07 1.000e+00
+## parent_0 1.000e+00 5.938e-01 3.387e-07
+## log_k_parent_sink 5.938e-01 1.000e+00 5.830e-07
+## sigma 3.387e-07 5.830e-07 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -648,25 +681,21 @@
## All data 3.287 2 6
## parent 3.287 2 6
##
-## Resulting formation fractions:
-## ff
-## parent_sink 1
-##
## Estimated disappearance times:
## DT50 DT90
## parent 106 352
## mkin version used for fitting: 0.9.49.6
-## R version used for fitting: 3.6.1
-## Date of fit: Fri Nov 1 10:10:54 2019
-## Date of summary: Fri Nov 1 10:10:54 2019
+
summary(mm.L4[["FOMC", 1]], data = FALSE)
## mkin version used for fitting: 0.9.50.2
+## R version used for fitting: 4.0.0
+## Date of fit: Tue May 12 15:31:40 2020
+## Date of summary: Tue May 12 15:31:40 2020
##
## 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.455 s
+## Fitted using 224 model solutions performed in 0.044 s
##
## Error model: Constant variance
##
@@ -687,6 +716,11 @@
## Fixed parameter values:
## None
##
+## Results:
+##
+## AIC BIC logLik
+## 40.37255 40.69032 -16.18628
+##
## Optimised, transformed parameters with symmetric confidence intervals:
## Estimate Std. Error Lower Upper
## parent_0 99.1400 1.2670 95.6300 102.7000
@@ -696,10 +730,10 @@
##
## Parameter correlation:
## parent_0 log_alpha log_beta sigma
-## parent_0 1.000e+00 -4.696e-01 -5.543e-01 -2.563e-07
-## log_alpha -4.696e-01 1.000e+00 9.889e-01 4.066e-08
-## log_beta -5.543e-01 9.889e-01 1.000e+00 6.818e-08
-## sigma -2.563e-07 4.066e-08 6.818e-08 1.000e+00
+## parent_0 1.000e+00 -4.696e-01 -5.543e-01 -2.456e-07
+## log_alpha -4.696e-01 1.000e+00 9.889e-01 2.169e-08
+## log_beta -5.543e-01 9.889e-01 1.000e+00 4.910e-08
+## sigma -2.456e-07 2.169e-08 4.910e-08 1.000e+00
##
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
@@ -731,31 +765,11 @@
Calculation of time weighted average concentrations with mkin
+ Calculation of time weighted average concentrations with mkin
Johannes Ranke
- 2019-11-01
-
+ 2020-05-12
+ Source: vignettes/twa.Rmd
twa.Rmd
Example evaluation of FOCUS dataset Z
+ Example evaluation of FOCUS dataset Z
Johannes Ranke
- 2019-11-01
-
+ 2020-05-12
+ Source: vignettes/web_only/FOCUS_Z.Rmd
FOCUS_Z.Rmd
The data
library(mkin, quietly = TRUE)
-LOD = 0.5
-FOCUS_2006_Z = data.frame(
- t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21,
- 42, 61, 96, 124),
- Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8,
- 2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
- Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1,
- 1.6, 0.6, 0.5 * LOD, NA, NA, NA),
- Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5,
- 0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
- Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5,
- 25.2, 17.2, 4.8, 4.5, 2.8, 4.4))
-
-FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)
library(mkin, quietly = TRUE)
+LOD = 0.5
+FOCUS_2006_Z = data.frame(
+ t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21,
+ 42, 61, 96, 124),
+ Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8,
+ 2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
+ Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1,
+ 1.6, 0.6, 0.5 * LOD, NA, NA, NA),
+ Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5,
+ 0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
+ Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5,
+ 25.2, 17.2, 4.8, 4.5, 2.8, 4.4))
+
+FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)
Parent and one metabolite
-
-## Successfully compiled differential equation model from auto-generated C code.
-
+## Warning in mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
+## Warning in mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
plot_sep(m.Z.2a)
+## Estimate se_notrans t value Pr(>t) Lower Upper
-## Z0_0 9.7015e+01 3.393176 2.8591e+01 6.4352e-21 91.66556 102.3642
-## k_Z0_sink 7.2231e-10 0.225254 3.2067e-09 5.0000e-01 0.00000 Inf
-## k_Z0_Z1 2.2360e+00 0.159134 1.4051e+01 1.1369e-13 1.95303 2.5600
-## k_Z1_sink 4.8212e-01 0.065454 7.3658e+00 5.1186e-08 0.40341 0.5762
-## sigma 4.8041e+00 0.637618 7.5345e+00 3.4431e-08 3.52677 6.0815
summary(m.Z.2a, data = FALSE)$bpar
## Estimate se_notrans t value Pr(>t) Lower Upper
+## Z0_0 97.01488 3.301084 29.3888 3.2971e-21 91.66556 102.3642
+## k_Z0 2.23601 0.207078 10.7979 3.3309e-11 1.95303 2.5600
+## k_Z1 0.48212 0.063265 7.6207 2.8154e-08 0.40341 0.5762
+## f_Z0_to_Z1 1.00000 0.094764 10.5525 5.3560e-11 0.00000 1.0000
+## sigma 4.80411 0.635638 7.5579 3.2592e-08 3.52677 6.0815
-
-## Successfully compiled differential equation model from auto-generated C code.
-
+## Warning in mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
+## Warning in mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
plot_sep(m.Z.2a.ff)
summary(m.Z.2a.ff, data = FALSE)$bpar
## Estimate se_notrans t value Pr(>t) Lower Upper
## Z0_0 97.01488 3.301084 29.3888 3.2971e-21 91.66556 102.3642
## k_Z0 2.23601 0.207078 10.7979 3.3309e-11 1.95303 2.5600
-## k_Z1 0.48212 0.063265 7.6207 2.8155e-08 0.40341 0.5762
+## k_Z1 0.48212 0.063265 7.6207 2.8154e-08 0.40341 0.5762
## f_Z0_to_Z1 1.00000 0.094764 10.5525 5.3560e-11 0.00000 1.0000
## sigma 4.80411 0.635638 7.5579 3.2592e-08 3.52677 6.0815
-
+## Successfully compiled differential equation model from auto-generated C code.
m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE)
-
+## Warning in mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
## value of zero were removed from the data
plot_sep(m.Z.3)
summary(m.Z.3, data = FALSE)$bpar
## Estimate se_notrans t value Pr(>t) Lower Upper
## Z0_0 97.01488 2.597342 37.352 2.0106e-24 91.67597 102.3538
## k_Z0 2.23601 0.146904 15.221 9.1477e-15 1.95354 2.5593
@@ -180,52 +187,51 @@
Metabolites Z2 and Z3
Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO"), use_of_ff = "max")
Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO"), use_of_ff = "max")
-
+## Successfully compiled differential equation model from auto-generated C code.
m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE)
-
+## Warning in mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
## value of zero were removed from the data
plot_sep(m.Z.5)
Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO", "Z3"),
- Z3 = mkinsub("SFO"),
- use_of_ff = "max")
Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO", "Z3"),
+ Z3 = mkinsub("SFO"),
+ use_of_ff = "max")
-
-## Successfully compiled differential equation model from auto-generated C code.
-
+## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.
-## 5$bparms.ode, : Observations with value of zero were removed from the data
m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin,
+ parms.ini = m.Z.5$bparms.ode,
+ quiet = TRUE)
+## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, :
+## Observations with value of zero were removed from the data
+## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, : Optimisation did not converge:
+## false convergence (8)
plot_sep(m.Z.FOCUS)
summary(m.Z.FOCUS, data = FALSE)$bpar
-
+## Estimate se_notrans t value Pr(>t) Lower Upper
-## Z0_0 96.838607 1.994273 48.5584 4.0283e-42 92.826626 100.850589
-## k_Z0 2.215405 0.118459 18.7018 1.0415e-23 1.989465 2.467003
-## k_Z1 0.478300 0.028257 16.9267 6.2408e-22 0.424701 0.538662
-## k_Z2 0.451618 0.042138 10.7177 1.6308e-14 0.374328 0.544867
-## k_Z3 0.058693 0.015246 3.8498 1.7806e-04 0.034805 0.098978
-## f_Z2_to_Z3 0.471508 0.058352 8.0804 9.6648e-11 0.357735 0.588320
+## Z0_0 96.838721 1.994275 48.5584 4.0283e-42 92.826878 100.850563
+## k_Z0 2.215400 0.118459 18.7019 1.0414e-23 1.989462 2.466998
+## k_Z1 0.478301 0.028257 16.9267 6.2411e-22 0.424705 0.538662
+## k_Z2 0.451623 0.042138 10.7176 1.6313e-14 0.374336 0.544867
+## k_Z3 0.058694 0.015246 3.8499 1.7804e-04 0.034809 0.098967
+## f_Z2_to_Z3 0.471510 0.058352 8.0804 9.6640e-11 0.357775 0.588283
## sigma 3.984431 0.383402 10.3923 4.5575e-14 3.213126 4.755736
endpoints(m.Z.FOCUS)
+## Z2 1.53479 5.0985
+## Z3 11.80955 39.2305## $ff
## Z2_Z3 Z2_sink
## 0.47151 0.52849
##
-## $SFORB
-## logical(0)
-##
## $distimes
## DT50 DT90
## Z0 0.31288 1.0394
## Z1 1.44919 4.8141
-## Z2 1.53481 5.0985
-## Z3 11.80965 39.2308
Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO", "Z3"),
- Z3 = mkinsub("SFORB"))
Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO", "Z3"),
+ Z3 = mkinsub("SFORB"))
-
-## Successfully compiled differential equation model from auto-generated C code.
-
+## Warning in mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE)
+## Warning in mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
plot_sep(m.Z.mkin.1)
summary(m.Z.mkin.1, data = FALSE)$cov.unscaled
## NULL
Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO"))
Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO"))
-
-## Successfully compiled differential equation model from auto-generated C code.
-
+## Warning in mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations
-## with value of zero were removed from the data
m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
+## Warning in mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
plot_sep(m.Z.mkin.3)
Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO", "Z3"),
- Z3 = mkinsub("SFO"))
Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO", "Z3"),
+ Z3 = mkinsub("SFO"))
-## Successfully compiled differential equation model from auto-generated C code.
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin,
- parms.ini = m.Z.mkin.3$bparms.ode,
- quiet = TRUE)
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin,
+ parms.ini = m.Z.mkin.3$bparms.ode,
+ quiet = TRUE)
-
+## Warning in mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
## 3$bparms.ode, : Observations with value of zero were removed from the data
plot_sep(m.Z.mkin.4)
Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
- Z1 = mkinsub("SFO", "Z2", sink = FALSE),
- Z2 = mkinsub("SFO", "Z3"),
- Z3 = mkinsub("SFORB"))
Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+ Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+ Z2 = mkinsub("SFO", "Z3"),
+ Z3 = mkinsub("SFORB"))
-## Successfully compiled differential equation model from auto-generated C code.
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
- parms.ini = m.Z.mkin.4$bparms.ode[1:4],
- quiet = TRUE)
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+ parms.ini = m.Z.mkin.4$bparms.ode[1:4],
+ quiet = TRUE)
-
+## 4$bparms.ode[1:4], : Observations with value of zero were removed from the data
+## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
-## 4$bparms.ode[1:4], : Observations with value of zero were removed from the
-## data
plot_sep(m.Z.mkin.5)
m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
- parms.ini = c(m.Z.mkin.5$bparms.ode[1:7],
- k_Z3_bound_free = 0),
- fixed_parms = "k_Z3_bound_free",
- quiet = TRUE)
m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+ parms.ini = c(m.Z.mkin.5$bparms.ode[1:7],
+ k_Z3_bound_free = 0),
+ fixed_parms = "k_Z3_bound_free",
+ quiet = TRUE)
-
+## 5$bparms.ode[1:7], : Observations with value of zero were removed from the data
+## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = c(m.Z.mkin.
-## 5$bparms.ode[1:7], : Observations with value of zero were removed from the
-## data
plot_sep(m.Z.mkin.5a)
mkinparplot(m.Z.mkin.5a)
endpoints(m.Z.mkin.5a)
+## Z3 NA NA NA NA 8.6636 Inf
## $ff
-## Z0_free_Z1 Z1_Z2 Z2_sink Z2_Z3_free Z3_free_sink
-## 1.00000 1.00000 0.46344 0.53656 1.00000
+## Z0_free Z2_Z3 Z2_sink Z3_free
+## 1.00000 0.53656 0.46344 1.00000
##
## $SFORB
## Z0_b1 Z0_b2 Z3_b1 Z3_b2
-## 2.4471381 0.0075124 0.0800075 0.0000000
+## 2.4471358 0.0075126 0.0800073 0.0000000
##
## $distimes
## DT50 DT90 DT50_Z0_b1 DT50_Z0_b2 DT50_Z3_b1 DT50_Z3_b2
-## Z0 0.3043 1.1848 0.28325 92.267 NA NA
+## Z0 0.3043 1.1848 0.28325 92.265 NA NA
## Z1 1.5148 5.0320 NA NA NA NA
## Z2 1.6414 5.4526 NA NA NA NA
-## Z3 NA NA NA NA 8.6635 Inf
Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance
+ Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance
Johannes Ranke
- 2019-11-01
-
+ 2020-05-12
+ Source: vignettes/web_only/NAFTA_examples.Rmd
NAFTA_examples.Rmd
Example on page 5, upper panel
-
+p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p5a)
print(p5a)
@@ -160,12 +167,12 @@
## Sums of squares:
## SFO IORE DFOP
## 465.21753 56.27506 32.06401
@@ -143,7 +150,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 9.99e+01 1.41e-26 98.8116 101.0810
## k1 2.67e-02 5.05e-06 0.0243 0.0295
-## k2 2.86e-12 5.00e-01 0.0000 Inf
+## k2 2.17e-12 5.00e-01 0.0000 Inf
## g 6.47e-01 3.67e-06 0.6248 0.6677
## sigma 1.27e+00 8.91e-06 0.8395 1.6929
##
@@ -152,7 +159,7 @@
## DT50 DT90 DT50_rep
## SFO 67.7 2.25e+02 6.77e+01
## IORE 58.2 1.07e+03 3.22e+02
-## DFOP 55.5 4.42e+11 2.42e+11
+## DFOP 55.5 5.83e+11 3.20e+11
##
## Representative half-life:
## [1] 321.51
Example on page 5, lower panel
-
+p5b <- nafta(NAFTA_SOP_Attachment[["p5b"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p5b)
print(p5b)
@@ -208,12 +215,12 @@
## Sums of squares:
## SFO IORE DFOP
## 94.81123 10.10936 7.55871
@@ -191,7 +198,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 9.84e+01 1.24e-27 97.8078 98.9187
## k1 1.55e-02 4.10e-04 0.0143 0.0167
-## k2 1.16e-11 5.00e-01 0.0000 Inf
+## k2 1.04e-11 5.00e-01 0.0000 Inf
## g 6.89e-01 2.92e-03 0.6626 0.7142
## sigma 6.48e-01 2.38e-05 0.4147 0.8813
##
@@ -200,7 +207,7 @@
## DT50 DT90 DT50_rep
## SFO 86.6 2.88e+02 8.66e+01
## IORE 85.5 7.17e+02 2.16e+02
-## DFOP 83.6 9.80e+10 5.98e+10
+## DFOP 83.6 1.09e+11 6.67e+10
##
## Representative half-life:
## [1] 215.87
Example on page 6
-
+p6 <- nafta(NAFTA_SOP_Attachment[["p6"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p6)
print(p6)
@@ -256,12 +263,12 @@
## Sums of squares:
## SFO IORE DFOP
## 188.45361 51.00699 42.46931
@@ -239,7 +246,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 9.66e+01 1.57e-25 95.3476 97.8979
## k1 2.55e-02 7.33e-06 0.0233 0.0278
-## k2 4.90e-11 5.00e-01 0.0000 Inf
+## k2 3.88e-11 5.00e-01 0.0000 Inf
## g 8.61e-01 7.55e-06 0.8314 0.8867
## sigma 1.46e+00 6.93e-06 0.9661 1.9483
##
@@ -248,7 +255,7 @@
## DT50 DT90 DT50_rep
## SFO 38.6 1.28e+02 3.86e+01
## IORE 34.0 1.77e+02 5.32e+01
-## DFOP 34.1 6.66e+09 1.41e+10
+## DFOP 34.1 8.42e+09 1.79e+10
##
## Representative half-life:
## [1] 53.17
Example on page 7
-
+p7 <- nafta(NAFTA_SOP_Attachment[["p7"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p7)
print(p7)
@@ -309,12 +316,12 @@
## Sums of squares:
## SFO IORE DFOP
## 3661.661 3195.030 3174.145
@@ -287,7 +294,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 9.89e+01 9.44e-49 95.4640 102.2573
## k1 1.81e-02 1.75e-01 0.0116 0.0281
-## k2 1.97e-10 5.00e-01 0.0000 Inf
+## k2 2.30e-10 5.00e-01 0.0000 Inf
## g 6.06e-01 2.19e-01 0.4826 0.7178
## sigma 7.40e+00 2.97e-15 6.0201 8.7754
##
@@ -296,7 +303,7 @@
## DT50 DT90 DT50_rep
## SFO 94.3 3.13e+02 9.43e+01
## IORE 96.7 1.51e+03 4.55e+02
-## DFOP 96.4 6.97e+09 3.52e+09
+## DFOP 96.4 5.95e+09 3.01e+09
##
## Representative half-life:
## [1] 454.55
Example on page 8
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p8)
print(p8)
## Sums of squares:
## SFO IORE DFOP
## 1996.9408 444.9237 547.5616
@@ -361,12 +368,12 @@
Example on page 9, upper panel
-
+p9a <- nafta(NAFTA_SOP_Attachment[["p9a"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p9a)
print(p9a)
@@ -410,17 +417,12 @@
## Sums of squares:
## SFO IORE DFOP
## 839.35238 88.57064 9.93363
@@ -392,7 +399,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 9.85e+01 2.54e-20 97.390 99.672
## k1 1.38e-01 3.52e-05 0.131 0.146
-## k2 6.02e-13 5.00e-01 0.000 Inf
+## k2 6.69e-13 5.00e-01 0.000 Inf
## g 6.52e-01 8.13e-06 0.642 0.661
## sigma 7.88e-01 6.13e-02 0.481 1.095
##
@@ -401,7 +408,7 @@
## DT50 DT90 DT50_rep
## SFO 16.9 5.63e+01 1.69e+01
## IORE 11.6 3.37e+02 1.01e+02
-## DFOP 10.5 2.07e+12 1.15e+12
+## DFOP 10.5 1.86e+12 1.04e+12
##
## Representative half-life:
## [1] 101.43
Example on page 9, lower panel
-
-
-## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
p9b <- nafta(NAFTA_SOP_Attachment[["p9b"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p9b)
print(p9b)
## Sums of squares:
## SFO IORE DFOP
## 35.64867 23.22334 35.64867
@@ -447,7 +449,7 @@
## parent_0 94.7123 1.61e-16 93.1355 96.2891
## k1 0.0389 1.43e-06 0.0312 0.0485
## k2 0.0389 6.67e-03 0.0186 0.0812
-## g 0.7742 NaN NA NA
+## g 0.7742 5.00e-01 0.0000 1.0000
## sigma 1.5957 2.50e-04 0.9135 2.2779
##
##
@@ -464,12 +466,12 @@
Example on page 10
-
+p10 <- nafta(NAFTA_SOP_Attachment[["p10"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p10)
print(p10)
## Sums of squares:
## SFO IORE DFOP
## 899.4089 336.4348 899.4089
@@ -492,12 +494,12 @@
## sigma 4.90 1.77e-04 2.837 6.968
##
## $DFOP
-## Estimate Pr(>t) Lower Upper
-## parent_0 101.7315 1.41e-09 91.6534 111.8097
-## k1 0.0495 6.42e-04 0.0301 0.0814
-## k2 0.0495 1.66e-02 0.0200 0.1225
-## g 0.6634 5.00e-01 0.0000 1.0000
-## sigma 8.0152 2.50e-04 4.5886 11.4418
+## Estimate Pr(>t) Lower Upper
+## parent_0 101.7315 1.41e-09 91.6534 111.810
+## k1 0.0495 6.48e-04 0.0303 0.081
+## k2 0.0495 1.67e-02 0.0201 0.122
+## g 0.6634 5.00e-01 0.0000 1.000
+## sigma 8.0152 2.50e-04 4.5886 11.442
##
##
## DTx values:
@@ -517,12 +519,12 @@
Example on page 11
-
+p11 <- nafta(NAFTA_SOP_Attachment[["p11"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p11)
print(p11)
+## [1] 41148171
## Sums of squares:
## SFO IORE DFOP
## 579.6805 204.7932 144.7783
@@ -560,7 +562,7 @@
## DFOP 4.21e+11 2.64e+12 9.56e+11
##
## Representative half-life:
-## [1] 41148169
Example on page 12, upper panel
-
-
+## Warning in summary.mkinfit(x): Could not calculate correlation; no
-## covariance matrix
p12a <- nafta(NAFTA_SOP_Attachment[["p12a"]])
## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
+## matrix
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p12a)
print(p12a)
## Sums of squares:
## SFO IORE DFOP
## 695.4440 220.0685 695.4440
@@ -603,8 +605,8 @@
## $DFOP
## Estimate Pr(>t) Lower Upper
## parent_0 100.521 2.74e-10 92.2366 108.805
-## k1 0.124 5.74e-06 0.0958 0.161
-## k2 0.124 6.61e-02 0.0319 0.484
+## k1 0.124 5.75e-06 0.0958 0.161
+## k2 0.124 6.72e-02 0.0319 0.484
## g 0.877 5.00e-01 0.0000 1.000
## sigma 7.048 2.50e-04 4.0349 10.061
##
@@ -621,20 +623,20 @@
Example on page 12, lower panel
-
+p12b <- nafta(NAFTA_SOP_Attachment[["p12b"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in qt(alpha/2, rdf): NaNs wurden erzeugt
## Warning in qt(1 - alpha/2, rdf): NaNs wurden erzeugt
## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
## Warning in pt(abs(tval), rdf, lower.tail = FALSE): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p12b)
print(p12b)
## Sums of squares:
## SFO IORE DFOP
## 58.90242 19.06353 58.90242
@@ -677,16 +679,12 @@
Example on page 13
-
-
-## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
p13 <- nafta(NAFTA_SOP_Attachment[["p13"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p13)
print(p13)
## Sums of squares:
## SFO IORE DFOP
## 174.5971 142.3951 174.5971
@@ -711,9 +709,9 @@
## $DFOP
## Estimate Pr(>t) Lower Upper
## parent_0 92.73500 9.25e-15 8.95e+01 9.59e+01
-## k1 0.00258 4.28e-01 1.70e-08 3.92e+02
+## k1 0.00258 4.28e-01 1.45e-08 4.61e+02
## k2 0.00258 3.69e-08 2.20e-03 3.03e-03
-## g 0.00442 5.00e-01 NA NA
+## g 0.00442 5.00e-01 0.00e+00 1.00e+00
## sigma 3.41172 1.35e-04 2.02e+00 4.80e+00
##
##
@@ -730,16 +728,16 @@
DT50 not observed in the study and DFOP problems in PestDF
-
+p14 <- nafta(NAFTA_SOP_Attachment[["p14"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p14)
print(p14)
@@ -783,17 +781,16 @@
## Sums of squares:
## SFO IORE DFOP
## 48.43249 28.67746 27.26248
@@ -765,7 +763,7 @@
## Estimate Pr(>t) Lower Upper
## parent_0 1.00e+02 2.96e-28 99.40280 101.2768
## k1 9.53e-03 1.20e-01 0.00638 0.0143
-## k2 7.29e-12 5.00e-01 0.00000 Inf
+## k2 7.70e-12 5.00e-01 0.00000 Inf
## g 3.98e-01 2.19e-01 0.30481 0.4998
## sigma 1.17e+00 7.68e-06 0.77406 1.5610
##
@@ -774,7 +772,7 @@
## DT50 DT90 DT50_rep
## SFO 2.48e+02 8.25e+02 2.48e+02
## IORE 4.34e+02 2.22e+04 6.70e+03
-## DFOP 2.54e+10 2.46e+11 9.51e+10
+## DFOP 2.41e+10 2.33e+11 9.00e+10
##
## Representative half-life:
## [1] 6697.44
N is less than 1 and DFOP fraction parameter is below zero
-
+p15a <- nafta(NAFTA_SOP_Attachment[["p15a"]])
-## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
## Warning in sqrt(diag(covar_notrans)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p15a)
print(p15a)
-
+## Sums of squares:
## SFO IORE DFOP
## 245.5248 135.0132 245.5248
@@ -816,12 +813,12 @@
## sigma 3.105 1.78e-04 1.795 4.416
##
## $DFOP
-## Estimate Pr(>t) Lower Upper
-## parent_0 97.96752 2.85e-13 94.21914 101.7159
-## k1 0.00952 6.80e-02 0.00277 0.0327
-## k2 0.00952 3.82e-06 0.00902 0.0100
-## g 0.17247 NaN NA NA
-## sigma 4.18778 2.50e-04 2.39747 5.9781
+## Estimate Pr(>t) Lower Upper
+## parent_0 97.96752 NA 94.21914 101.7159
+## k1 0.00952 NA 0.00241 0.0377
+## k2 0.00952 NA 0.00747 0.0121
+## g 0.17247 NA NA NA
+## sigma 4.18778 NA 2.39747 5.9781
##
##
## DTx values:
@@ -832,16 +829,16 @@
##
## Representative half-life:
## [1] 41.33
p15b <- nafta(NAFTA_SOP_Attachment[["p15b"]])
## Warning in sqrt(diag(covar)): NaNs wurden erzeugt
-## Warning in sqrt(1/diag(V)): NaNs wurden erzeugt
+## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite
-## result is doubtful
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
-
+## The half-life obtained from the IORE model may be used
plot(p15b)
print(p15b)
## Sums of squares:
## SFO IORE DFOP
## 106.91629 68.55574 106.91629
@@ -858,18 +855,18 @@
##
## $IORE
## Estimate Pr(>t) Lower Upper
-## parent_0 99.83 1.81e-16 97.51349 102.14
+## parent_0 99.83 1.81e-16 97.51348 102.14
## k__iore_parent_sink 0.38 3.22e-01 0.00352 41.05
-## N_parent 0.00 5.00e-01 -1.07695 1.08
+## N_parent 0.00 5.00e-01 -1.07696 1.08
## sigma 2.21 2.57e-04 1.23245 3.19
##
## $DFOP
## Estimate Pr(>t) Lower Upper
-## parent_0 1.01e+02 NA 9.82e+01 1.04e+02
-## k1 4.86e-03 NA 6.75e-04 3.49e-02
-## k2 4.86e-03 NA 3.37e-03 6.99e-03
+## parent_0 1.01e+02 NA 98.24464 1.04e+02
+## k1 4.86e-03 NA 0.00068 3.47e-02
+## k2 4.86e-03 NA 0.00338 6.99e-03
## g 1.50e-01 NA NA NA
-## sigma 2.76e+00 NA 1.58e+00 3.94e+00
+## sigma 2.76e+00 NA 1.58208 3.94e+00
##
##
## DTx values:
@@ -885,14 +882,14 @@
The DFOP fraction parameter is greater than 1
-
+p16 <- nafta(NAFTA_SOP_Attachment[["p16"]])
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
## The representative half-life of the IORE model is longer than the one corresponding
## to the terminal degradation rate found with the DFOP model.
-
+## The representative half-life obtained from the DFOP model may be used
plot(p16)
print(p16)
## Sums of squares:
## SFO IORE DFOP
## 3831.804 2062.008 1550.980
@@ -917,7 +914,7 @@
## $DFOP
## Estimate Pr(>t) Lower Upper
## parent_0 88.5333 7.40e-18 79.9836 97.083
-## k1 18.5561 5.00e-01 0.0000 Inf
+## k1 18.5560 5.00e-01 0.0000 Inf
## k2 0.0776 1.41e-05 0.0518 0.116
## g 0.4733 1.41e-09 0.3674 0.582
## sigma 7.1902 2.11e-08 5.2785 9.102
@@ -950,53 +947,11 @@
Performance benefit by using compiled model definitions in mkin
+ Performance benefit by using compiled model definitions in mkin
Johannes Ranke
- 2020-04-04
-
+ 2020-05-12
+ Source: vignettes/web_only/compiled_models.Rmd
compiled_models.Rmd
How to benefit from compiled models
mkinmod()
function checks for presence of a compiler usingpkgbuild::has_compiler()
Sys.which("gcc")
for this check.Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.getenv("HOME")
-Comparison with Eigenvalue based solutions
-library("mkin", quietly = TRUE)
-SFO_SFO <- mkinmod(
- parent = mkinsub("SFO", "m1"),
- m1 = mkinsub("SFO"))
library("mkin", quietly = TRUE)
+SFO_SFO <- mkinmod(
+ parent = mkinsub("SFO", "m1"),
+ m1 = mkinsub("SFO"))
-## Successfully compiled differential equation model from auto-generated C code.
if (require(rbenchmark)) {
- b.1 <- benchmark(
- "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
- solution_type = "deSolve",
- use_compiled = FALSE, quiet = TRUE),
- "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D,
- solution_type = "eigen", quiet = TRUE),
- "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
- solution_type = "deSolve", quiet = TRUE),
- replications = 3)
- print(b.1)
- factor_SFO_SFO <- round(b.1["1", "relative"])
-} else {
- factor_SFO_SFO <- NA
- print("R package rbenchmark is not available")
-}
-## test replications elapsed relative user.self sys.self
-## 3 deSolve, compiled 3 3.107 1.000 3.105 0
-## 1 deSolve, not compiled 3 28.765 9.258 28.749 0
-## 2 Eigenvalue based 3 4.446 1.431 4.445 0
-## user.child sys.child
-## 3 0 0
-## 1 0 0
-## 2 0 0
FOCUS_D <- subset(FOCUS_2006_D, value != 0)
if (require(rbenchmark)) {
+ b.1 <- benchmark(
+ "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_D,
+ solution_type = "deSolve",
+ use_compiled = FALSE, quiet = TRUE),
+ "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_D,
+ solution_type = "eigen", quiet = TRUE),
+ "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_D,
+ solution_type = "deSolve", quiet = TRUE),
+ "analytical" = mkinfit(SFO_SFO, FOCUS_D,
+ solution_type = "analytical",
+ use_compiled = FALSE, quiet = TRUE),
+ replications = 1, order = "relative",
+ columns = c("test", "replications", "relative", "elapsed"))
+ print(b.1)
+} else {
+ print("R package rbenchmark is not available")
+}
+## test replications relative elapsed
+## 4 analytical 1 1.000 0.190
+## 3 deSolve, compiled 1 1.774 0.337
+## 2 Eigenvalue based 1 2.105 0.400
+## 1 deSolve, not compiled 1 42.763 8.125
-Model that can not be solved with Eigenvalues
-if (require(rbenchmark)) {
- FOMC_SFO <- mkinmod(
- parent = mkinsub("FOMC", "m1"),
- m1 = mkinsub( "SFO"))
-
- b.2 <- benchmark(
- "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
- use_compiled = FALSE, quiet = TRUE),
- "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
- replications = 3)
- print(b.2)
- factor_FOMC_SFO <- round(b.2["1", "relative"])
-} else {
- factor_FOMC_SFO <- NA
- print("R package benchmark is not available")
-}
if (require(rbenchmark)) {
+ FOMC_SFO <- mkinmod(
+ parent = mkinsub("FOMC", "m1"),
+ m1 = mkinsub( "SFO"))
+
+ b.2 <- benchmark(
+ "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_D,
+ use_compiled = FALSE, quiet = TRUE),
+ "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE),
+ replications = 1, order = "relative",
+ columns = c("test", "replications", "relative", "elapsed"))
+ print(b.2)
+ factor_FOMC_SFO <- round(b.2["1", "relative"])
+} else {
+ factor_FOMC_SFO <- NA
+ print("R package benchmark is not available")
+}
-## Successfully compiled differential equation model from auto-generated C code.
-## test replications elapsed relative user.self sys.self
-## 2 deSolve, compiled 3 4.844 1.000 4.842 0
-## 1 deSolve, not compiled 3 53.833 11.113 53.807 0
-## user.child sys.child
-## 2 0 0
-## 1 0 0
## R version 3.6.3 (2020-02-29)
+
+## test replications relative elapsed
+## 2 deSolve, compiled 1 1.000 0.476
+## 1 deSolve, not compiled 1 30.103 14.329
## R version 4.0.0 (2020-04-24)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Debian GNU/Linux 10 (buster)
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
-mkin 0.9.50.2 (2020-05-12) Unreleased
+mkin 0.9.50.2 (2020-05-12) 2020-05-12
Format
-
+
package
M0
f
Examples
Format
-
+
package
M0
alpha
Examples
Format
-
+
package
M0
tb
Examples
Format
-
+
package
M0
k
Examples
Format
-
+
name
time
value
Format
-
+
name
time
value
Format
mkinds
,
- each containing, among others, the following components
+ each containing, among others, the following components
title
Soil 1
data
mkinfit
R/mkin_wide_to_long.R
mkin_wide_to_long.Rd
R/mkinerrmin.R
mkinerrmin.Rd
R/plot.mkinfit.R
mkinplot.Rd
The function is called for its side effect.
Should the data be printed?
Ignored, data are taken from the mmkin model
R/nobs.mkinfit.R
nobs.mkinfit.Rd
The number of rows in the data included in the mkinfit object
# S3 method for nafta -plot(x, legend = FALSE, main = "auto", ...)+plot(x, legend = FALSE, main = "auto", ...)