From 4a918da6d5f971335b74b0fc83cb08f5c3163f95 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 21 Jul 2017 14:42:14 +0200 Subject: Rename twa to max_twa_parent, update docs --- docs/articles/FOCUS_D.html | 254 ++++++++++++++++++++++++++++----------------- 1 file changed, 161 insertions(+), 93 deletions(-) (limited to 'docs/articles/FOCUS_D.html') diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index 50b3d00a..5da77efa 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -1,71 +1,137 @@ -Example evaluation of FOCUS Example Dataset D • mkin -
-
- - -
-
- - - - -
+ + + + + + + + + + + + + + +Example evaluation of FOCUS Example Dataset D + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +

This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using mkin. After loading the library we look a the data. We have observed concentrations in the column named value at the times specified in column time for the two observed variables named parent and m1.

-
library("mkin")
-print(FOCUS_2006_D)
+
library("mkin")
+
## Loading required package: minpack.lm
+
## Loading required package: rootSolve
+
## Loading required package: inline
+
## Loading required package: methods
+
## Loading required package: parallel
+
print(FOCUS_2006_D)
##      name time  value
 ## 1  parent    0  99.46
 ## 2  parent    0 102.04
@@ -113,27 +179,27 @@
 ## 44     m1  120  33.31

Next we specify the degradation model: The parent compound degrades with simple first-order kinetics (SFO) to one metabolite named m1, which also degrades with SFO kinetics.

The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector $diffs of the mkinmod object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.

-
SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+
SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
## Successfully compiled differential equation model from auto-generated C code.
-
print(SFO_SFO$diffs)
+
print(SFO_SFO$diffs)
##                                                       parent 
-## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" 
+## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" 
 ##                                                           m1 
-##             "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"
+## "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"

We do the fitting without progress report (quiet = TRUE).

-
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)

A plot of the fit including a residual plot for both observed variables is obtained using the plot_sep method for mkinfit objects, which shows separate graphs for all compounds and their residuals.

-
plot_sep(fit, lpos = c("topright", "bottomright"))
-

+
plot_sep(fit, lpos = c("topright", "bottomright"))
+

Confidence intervals for the parameter estimates are obtained using the mkinparplot function.

- -

+
mkinparplot(fit)
+

A comprehensive report of the results is obtained using the summary method for mkinfit objects.

-
summary(fit)
+
summary(fit)
## mkin version:    0.9.45 
-## R version:       3.3.2 
-## Date of fit:     Thu Dec  8 09:39:23 2016 
-## Date of summary: Thu Dec  8 09:39:24 2016 
+## R version:       3.4.0 
+## Date of fit:     Fri May  5 12:14:00 2017 
+## Date of summary: Fri May  5 12:14:00 2017 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -141,7 +207,7 @@
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted with method Port using 153 model solutions performed in 0.627 s
+## Fitted with method Port using 153 model solutions performed in 1.033 s
 ## 
 ## Weighting: none
 ## 
@@ -175,7 +241,7 @@
 ## parent_0           1.00000            0.6075        -0.06625       -0.1701
 ## log_k_parent_sink  0.60752            1.0000        -0.08740       -0.6253
 ## log_k_parent_m1   -0.06625           -0.0874         1.00000        0.4716
-## log_k_m1_sink     -0.17006           -0.6253         0.47163        1.0000
+## log_k_m1_sink     -0.17006           -0.6253         0.47164        1.0000
 ## 
 ## Residual standard error: 3.211 on 36 degrees of freedom
 ## 
@@ -252,23 +318,25 @@
 ##   100       m1    33.13 3.198e+01  1.148e+00
 ##   120       m1    25.15 2.879e+01 -3.640e+00
 ##   120       m1    33.31 2.879e+01  4.520e+00
-
-
- -
-
- + + -- cgit v1.2.1