From 3eefecf0adfbb30b8fb895c244dea6903bcb3e9c Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 31 Jan 2019 16:55:20 +0100 Subject: Restore NAMESPACE which was accidentally overwritten by pkgdown -> roxygen --- vignettes/FOCUS_D.Rmd | 11 +- vignettes/FOCUS_D.html | 438 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 389 insertions(+), 60 deletions(-) (limited to 'vignettes') diff --git a/vignettes/FOCUS_D.Rmd b/vignettes/FOCUS_D.Rmd index 037dd854..02c2c467 100644 --- a/vignettes/FOCUS_D.Rmd +++ b/vignettes/FOCUS_D.Rmd @@ -3,7 +3,7 @@ title: Example evaluation of FOCUS Example Dataset D author: Johannes Ranke date: "`r Sys.Date()`" output: - html_vignette: +rmarkdown::html_vignette: mathjax: null vignette: > %\VignetteIndexEntry{Example evaluation of FOCUS Example Dataset D} @@ -11,20 +11,21 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r, include = FALSE, message = FALSE} library(knitr) -opts_chunk$set(tidy = FALSE, cache = TRUE) +opts_chunk$set(tidy = FALSE, cache = FALSE) +library(mkin) ``` 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 +library we look at 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", quietly = TRUE) +library(mkin, quietly = TRUE) print(FOCUS_2006_D) ``` diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index bfbe2f7e..0507740f 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -8,75 +8,378 @@ - - + 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", quietly = TRUE)
-print(FOCUS_2006_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 at 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, quietly = TRUE)
+print(FOCUS_2006_D)
##      name time  value
 ## 1  parent    0  99.46
 ## 2  parent    0 102.04
@@ -124,27 +427,27 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 ## 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" 
 ##                                                           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)
-

+
mkinparplot(fit)
+

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

-
summary(fit)
-
## mkin version used for fitting:    0.9.47.1 
-## R version used for fitting:       3.5.1 
-## Date of fit:     Tue Jul 17 15:54:19 2018 
-## Date of summary: Tue Jul 17 15:54:19 2018 
+
summary(fit)
+
## mkin version used for fitting:    0.9.47.5 
+## R version used for fitting:       3.5.2 
+## Date of fit:     Thu Jan 31 16:45:24 2019 
+## Date of summary: Thu Jan 31 16:45:24 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -152,7 +455,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 ## 
 ## Model predictions using solution type deSolve 
 ## 
-## Fitted with method Port using 153 model solutions performed in 0.658 s
+## Fitted with method Port using 153 model solutions performed in 0.684 s
 ## 
 ## Weighting: none
 ## 
@@ -263,5 +566,30 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 
 
 
+
+ + + + + + -- cgit v1.2.1