aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/FOCUS_D.Rmd
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2017-07-21 14:42:14 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2017-07-21 14:42:14 +0200
commit4a918da6d5f971335b74b0fc83cb08f5c3163f95 (patch)
treece67e7a1b2f4763342bee6f4ef9af283b74a27c0 /docs/articles/FOCUS_D.Rmd
parent4f73b627fefd78405d9d996ca096cd9dd2b958c9 (diff)
Rename twa to max_twa_parent, update docs
Diffstat (limited to 'docs/articles/FOCUS_D.Rmd')
-rw-r--r--docs/articles/FOCUS_D.Rmd74
1 files changed, 74 insertions, 0 deletions
diff --git a/docs/articles/FOCUS_D.Rmd b/docs/articles/FOCUS_D.Rmd
new file mode 100644
index 00000000..b4e61a7c
--- /dev/null
+++ b/docs/articles/FOCUS_D.Rmd
@@ -0,0 +1,74 @@
+---
+title: Example evaluation of FOCUS Example Dataset D
+author: Johannes Ranke
+date: "`r Sys.Date()`"
+output:
+ html_document:
+ mathjax: null
+ theme: united
+ fig_retina: null
+vignette: >
+ %\VignetteIndexEntry{Example evaluation of FOCUS Example Dataset D}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+library(knitr)
+opts_chunk$set(tidy = FALSE, cache = TRUE)
+```
+
+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`.
+
+
+```{r data}
+library("mkin")
+print(FOCUS_2006_D)
+```
+
+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.
+
+```{r model}
+SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+print(SFO_SFO$diffs)
+```
+
+We do the fitting without progress report (`quiet = TRUE`).
+
+
+```{r fit}
+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.
+
+```{r plot, fig.height = 6, fig.width = 8}
+plot_sep(fit, lpos = c("topright", "bottomright"))
+```
+
+Confidence intervals for the parameter estimates are obtained using the `mkinparplot` function.
+
+
+```{r plot_2, fig.height = 4, fig.width = 8}
+mkinparplot(fit)
+```
+
+A comprehensive report of the results is obtained using the `summary` method for `mkinfit`
+objects.
+
+
+```{r}
+summary(fit)
+```

Contact - Imprint