From 7094934f1061563725f6caa8723dc3e23c8ca677 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 16 Nov 2022 11:30:06 +0100 Subject: Update online docs --- docs/dev/reference/mkinmod.html | 195 ++++++++++++++++++++++-------------- docs/dev/reference/mkinpredict.html | 2 +- docs/dev/reference/saem.html | 6 +- 3 files changed, 125 insertions(+), 78 deletions(-) (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html index 5d362f76..d0e192e7 100644 --- a/docs/dev/reference/mkinmod.html +++ b/docs/dev/reference/mkinmod.html @@ -21,7 +21,7 @@ components."> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calculate the AIC for a column of an mmkin object — AIC.mmkin • mkin + + - - - - -
-
- -
- -
+
@@ -149,102 +94,110 @@ same dataset." /> same dataset.

-
# S3 method for mmkin
-AIC(object, ..., k = 2)
-
-# S3 method for mmkin
-BIC(object, ...)
- -

Arguments

- - - - - - - - - - - - - - -
object

An object of class mmkin, containing only one -column.

...

For compatibility with the generic method

k

As in the generic method

- -

Value

- -

As in the generic method (a numeric value for single fits, or a -dataframe if there are several fits in the column).

-

Author

+
+
# S3 method for mmkin
+AIC(object, ..., k = 2)
+
+# S3 method for mmkin
+BIC(object, ...)
+
+ +
+

Arguments

+
object
+

An object of class mmkin, containing only one +column.

+ +
...
+

For compatibility with the generic method

+ + +
k
+

As in the generic method

+ +
+
+

Value

+ + +

As in the generic method (a numeric value for single fits, or a +dataframe if there are several fits in the column).

+
+
+

Author

Johannes Ranke

+
-

Examples

-
- # skip, as it takes > 10 s on winbuilder - f <- mmkin(c("SFO", "FOMC", "DFOP"), - list("FOCUS A" = FOCUS_2006_A, - "FOCUS C" = FOCUS_2006_C), cores = 1, quiet = TRUE) - # We get a warning because the FOMC model does not converge for the - # FOCUS A dataset, as it is well described by SFO - - AIC(f["SFO", "FOCUS A"]) # We get a single number for a single fit -
#> [1] 55.28197
AIC(f[["SFO", "FOCUS A"]]) # or when extracting an mkinfit object -
#> [1] 55.28197
- # For FOCUS A, the models fit almost equally well, so the higher the number - # of parameters, the higher (worse) the AIC - AIC(f[, "FOCUS A"]) -
#> df AIC -#> SFO 3 55.28197 -#> FOMC 4 57.28222 -#> DFOP 5 59.28197
AIC(f[, "FOCUS A"], k = 0) # If we do not penalize additional parameters, we get nearly the same -
#> df AIC -#> SFO 3 49.28197 -#> FOMC 4 49.28222 -#> DFOP 5 49.28197
BIC(f[, "FOCUS A"]) # Comparing the BIC gives a very similar picture -
#> df BIC -#> SFO 3 55.52030 -#> FOMC 4 57.59999 -#> DFOP 5 59.67918
- # For FOCUS C, the more complex models fit better - AIC(f[, "FOCUS C"]) -
#> df AIC -#> SFO 3 59.29336 -#> FOMC 4 44.68652 -#> DFOP 5 29.02372
BIC(f[, "FOCUS C"]) -
#> df BIC -#> SFO 3 59.88504 -#> FOMC 4 45.47542 -#> DFOP 5 30.00984
- -
+
+

Examples

+

+   # skip, as it takes > 10 s on winbuilder
+  f <- mmkin(c("SFO", "FOMC", "DFOP"),
+    list("FOCUS A" = FOCUS_2006_A,
+         "FOCUS C" = FOCUS_2006_C), cores = 1, quiet = TRUE)
+  # We get a warning because the FOMC model does not converge for the
+  # FOCUS A dataset, as it is well described by SFO
+
+  AIC(f["SFO", "FOCUS A"]) # We get a single number for a single fit
+#> [1] 55.28197
+  AIC(f[["SFO", "FOCUS A"]]) # or when extracting an mkinfit object
+#> [1] 55.28197
+
+  # For FOCUS A, the models fit almost equally well, so the higher the number
+  # of parameters, the higher (worse) the AIC
+  AIC(f[, "FOCUS A"])
+#>      df      AIC
+#> SFO   3 55.28197
+#> FOMC  4 57.28222
+#> DFOP  5 59.28197
+  AIC(f[, "FOCUS A"], k = 0) # If we do not penalize additional parameters, we get nearly the same
+#>      df      AIC
+#> SFO   3 49.28197
+#> FOMC  4 49.28222
+#> DFOP  5 49.28197
+  BIC(f[, "FOCUS A"])        # Comparing the BIC gives a very similar picture
+#>      df      BIC
+#> SFO   3 55.52030
+#> FOMC  4 57.59999
+#> DFOP  5 59.67918
+
+  # For FOCUS C, the more complex models fit better
+  AIC(f[, "FOCUS C"])
+#>      df      AIC
+#> SFO   3 59.29336
+#> FOMC  4 44.68652
+#> DFOP  5 29.02372
+  BIC(f[, "FOCUS C"])
+#>      df      BIC
+#> SFO   3 59.88504
+#> FOMC  4 45.47542
+#> DFOP  5 30.00984
+  
+
+
+
+
- - - + + diff --git a/docs/dev/reference/CAKE_export.html b/docs/dev/reference/CAKE_export.html index 47efd056..33ae3f74 100644 --- a/docs/dev/reference/CAKE_export.html +++ b/docs/dev/reference/CAKE_export.html @@ -18,7 +18,7 @@ specified as well."> mkin - 1.1.2 + 1.2.2 @@ -45,11 +45,14 @@ specified as well.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -57,7 +60,10 @@ specified as well.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/D24_2014.html b/docs/dev/reference/D24_2014.html index 5cf7604c..14840260 100644 --- a/docs/dev/reference/D24_2014.html +++ b/docs/dev/reference/D24_2014.html @@ -22,7 +22,7 @@ constrained by data protection regulations."> mkin - 1.1.2 + 1.2.2 @@ -49,11 +49,14 @@ constrained by data protection regulations.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -61,7 +64,10 @@ constrained by data protection regulations.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/DFOP.solution.html b/docs/dev/reference/DFOP.solution.html index f41d8e9b..c6746fe7 100644 --- a/docs/dev/reference/DFOP.solution.html +++ b/docs/dev/reference/DFOP.solution.html @@ -18,7 +18,7 @@ two exponential decline functions."> - - - - - - -Subsetting method for mmkin objects — [.mmkin • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Subsetting method for mmkin objects — [.mmkin • mkin + + - - - - -
    -
    - -
    - -
    +
    @@ -147,122 +92,127 @@

    Subsetting method for mmkin objects

    -
    # S3 method for mmkin
    -[(x, i, j, ..., drop = FALSE)
    +
    +
    # S3 method for mmkin
    +[(x, i, j, ..., drop = FALSE)
    +
    + +
    +

    Arguments

    +
    x
    +

    An mmkin object

    -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    x

    An mmkin object

    i

    Row index selecting the fits for specific models

    j

    Column index selecting the fits to specific datasets

    ...

    Not used, only there to satisfy the generic method definition

    drop

    If FALSE, the method always returns an mmkin object, otherwise -either a list of mkinfit objects or a single mkinfit object.

    -

    Value

    +
    i
    +

    Row index selecting the fits for specific models

    -

    An object of class mmkin.

    -

    Author

    +
    j
    +

    Column index selecting the fits to specific datasets

    + + +
    ...
    +

    Not used, only there to satisfy the generic method definition

    + + +
    drop
    +

    If FALSE, the method always returns an mmkin object, otherwise +either a list of mkinfit objects or a single mkinfit object.

    + +
    +
    +

    Value

    + + +

    An object of class mmkin.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    - # Only use one core, to pass R CMD check --as-cran - fits <- mmkin(c("SFO", "FOMC"), list(B = FOCUS_2006_B, C = FOCUS_2006_C), - cores = 1, quiet = TRUE) - fits["FOMC", ] -
    #> <mmkin> object -#> Status of individual fits: -#> -#> dataset -#> model B C -#> FOMC OK OK -#> -#> OK: No warnings
    fits[, "B"] -
    #> <mmkin> object -#> Status of individual fits: -#> -#> dataset -#> model B -#> SFO OK -#> FOMC OK -#> -#> OK: No warnings
    fits["SFO", "B"] -
    #> <mmkin> object -#> Status of individual fits: -#> -#> dataset -#> model B -#> SFO OK -#> -#> OK: No warnings
    - head( - # This extracts an mkinfit object with lots of components - fits[["FOMC", "B"]] - ) -
    #> $par -#> parent_0 log_alpha log_beta sigma -#> 99.666192 2.549850 5.050586 1.890202 -#> -#> $objective -#> [1] 28.58291 -#> -#> $convergence -#> [1] 0 -#> -#> $iterations -#> [1] 21 -#> -#> $evaluations -#> function gradient -#> 25 78 -#> -#> $message -#> [1] "both X-convergence and relative convergence (5)" -#>
    +
    +

    Examples

    +
    
    +  # Only use one core, to pass R CMD check --as-cran
    +  fits <- mmkin(c("SFO", "FOMC"), list(B = FOCUS_2006_B, C = FOCUS_2006_C),
    +                cores = 1, quiet = TRUE)
    +  fits["FOMC", ]
    +#> <mmkin> object
    +#> Status of individual fits:
    +#> 
    +#>       dataset
    +#> model  B  C 
    +#>   FOMC OK OK
    +#> 
    +#> OK: No warnings
    +  fits[, "B"]
    +#> <mmkin> object
    +#> Status of individual fits:
    +#> 
    +#>       dataset
    +#> model  B 
    +#>   SFO  OK
    +#>   FOMC OK
    +#> 
    +#> OK: No warnings
    +  fits["SFO", "B"]
    +#> <mmkin> object
    +#> Status of individual fits:
    +#> 
    +#>      dataset
    +#> model B 
    +#>   SFO OK
    +#> 
    +#> OK: No warnings
    +
    +  head(
    +    # This extracts an mkinfit object with lots of components
    +    fits[["FOMC", "B"]]
    +  )
    +#> $par
    +#>  parent_0 log_alpha  log_beta     sigma 
    +#> 99.666192  2.549850  5.050586  1.890202 
    +#> 
    +#> $objective
    +#> [1] 28.58291
    +#> 
    +#> $convergence
    +#> [1] 0
    +#> 
    +#> $iterations
    +#> [1] 21
    +#> 
    +#> $evaluations
    +#> function gradient 
    +#>       25       78 
    +#> 
    +#> $message
    +#> [1] "both X-convergence and relative convergence (5)"
    +#> 
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html b/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html index a188430d..8891567a 100644 --- a/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html +++ b/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html @@ -1,71 +1,16 @@ - - - - - - - -Results of fitting the DFOP model to Datasets A to B of FOCUS (2006) — FOCUS_2006_DFOP_ref_A_to_B • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Results of fitting the DFOP model to Datasets A to B of FOCUS (2006) — FOCUS_2006_DFOP_ref_A_to_B • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    FOCUS_2006_DFOP_ref_A_to_B
    +
    +
    FOCUS_2006_DFOP_ref_A_to_B
    +
    +
    +

    Format

    +

    A data frame containing the following variables.

    package
    +

    a factor giving the name of the software package

    -

    Format

    +
    M0
    +

    The fitted initial concentration of the parent compound

    -

    A data frame containing the following variables.

    -
    package

    a factor giving the name of the software package

    -
    M0

    The fitted initial concentration of the parent compound

    -
    f

    The fitted f parameter

    -
    k1

    The fitted k1 parameter

    -
    k2

    The fitted k2 parameter

    -
    DT50

    The resulting half-life of the parent compound

    -
    DT90

    The resulting DT90 of the parent compound

    -
    dataset

    The FOCUS dataset that was used

    - -
    +
    f
    +

    The fitted f parameter

    + +
    k1
    +

    The fitted k1 parameter

    + +
    k2
    +

    The fitted k2 parameter

    + +
    DT50
    +

    The resulting half-life of the parent compound

    + +
    DT90
    +

    The resulting DT90 of the parent compound

    -

    Source

    +
    dataset
    +

    The FOCUS dataset that was used

    -

    FOCUS (2006) “Guidance Document on Estimating Persistence and + +

    +
    +

    Source

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    -

    Examples

    -
    data(FOCUS_2006_DFOP_ref_A_to_B) -
    +
    +

    Examples

    +
    data(FOCUS_2006_DFOP_ref_A_to_B)
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html index 0bee1c16..a725ada7 100644 --- a/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html +++ b/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html @@ -1,71 +1,16 @@ - - - - - - - -Results of fitting the FOMC model to Datasets A to F of FOCUS (2006) — FOCUS_2006_FOMC_ref_A_to_F • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Results of fitting the FOMC model to Datasets A to F of FOCUS (2006) — FOCUS_2006_FOMC_ref_A_to_F • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    FOCUS_2006_FOMC_ref_A_to_F
    +
    +
    FOCUS_2006_FOMC_ref_A_to_F
    +
    +
    +

    Format

    +

    A data frame containing the following variables.

    package
    +

    a factor giving the name of the software package

    -

    Format

    +
    M0
    +

    The fitted initial concentration of the parent compound

    -

    A data frame containing the following variables.

    -
    package

    a factor giving the name of the software package

    -
    M0

    The fitted initial concentration of the parent compound

    -
    alpha

    The fitted alpha parameter

    -
    beta

    The fitted beta parameter

    -
    DT50

    The resulting half-life of the parent compound

    -
    DT90

    The resulting DT90 of the parent compound

    -
    dataset

    The FOCUS dataset that was used

    - -
    +
    alpha
    +

    The fitted alpha parameter

    + +
    beta
    +

    The fitted beta parameter

    + +
    DT50
    +

    The resulting half-life of the parent compound

    + +
    DT90
    +

    The resulting DT90 of the parent compound

    -

    Source

    +
    dataset
    +

    The FOCUS dataset that was used

    -

    FOCUS (2006) “Guidance Document on Estimating Persistence and + +

    +
    +

    Source

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    -

    Examples

    -
    data(FOCUS_2006_FOMC_ref_A_to_F) -
    +
    +

    Examples

    +
    data(FOCUS_2006_FOMC_ref_A_to_F)
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html index 460fdf0d..d6758f62 100644 --- a/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html +++ b/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html @@ -1,71 +1,16 @@ - - - - - - - -Results of fitting the HS model to Datasets A to F of FOCUS (2006) — FOCUS_2006_HS_ref_A_to_F • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Results of fitting the HS model to Datasets A to F of FOCUS (2006) — FOCUS_2006_HS_ref_A_to_F • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    FOCUS_2006_HS_ref_A_to_F
    +
    +
    FOCUS_2006_HS_ref_A_to_F
    +
    +
    +

    Format

    +

    A data frame containing the following variables.

    package
    +

    a factor giving the name of the software package

    -

    Format

    +
    M0
    +

    The fitted initial concentration of the parent compound

    -

    A data frame containing the following variables.

    -
    package

    a factor giving the name of the software package

    -
    M0

    The fitted initial concentration of the parent compound

    -
    tb

    The fitted tb parameter

    -
    k1

    The fitted k1 parameter

    -
    k2

    The fitted k2 parameter

    -
    DT50

    The resulting half-life of the parent compound

    -
    DT90

    The resulting DT90 of the parent compound

    -
    dataset

    The FOCUS dataset that was used

    - -
    +
    tb
    +

    The fitted tb parameter

    + +
    k1
    +

    The fitted k1 parameter

    + +
    k2
    +

    The fitted k2 parameter

    + +
    DT50
    +

    The resulting half-life of the parent compound

    + +
    DT90
    +

    The resulting DT90 of the parent compound

    -

    Source

    +
    dataset
    +

    The FOCUS dataset that was used

    -

    FOCUS (2006) “Guidance Document on Estimating Persistence and + +

    +
    +

    Source

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    -

    Examples

    -
    data(FOCUS_2006_HS_ref_A_to_F) -
    +
    +

    Examples

    +
    data(FOCUS_2006_HS_ref_A_to_F)
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html index c1a5fdff..445ed2d6 100644 --- a/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html +++ b/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html @@ -1,71 +1,16 @@ - - - - - - - -Results of fitting the SFO model to Datasets A to F of FOCUS (2006) — FOCUS_2006_SFO_ref_A_to_F • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Results of fitting the SFO model to Datasets A to F of FOCUS (2006) — FOCUS_2006_SFO_ref_A_to_F • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    FOCUS_2006_SFO_ref_A_to_F
    +
    +
    FOCUS_2006_SFO_ref_A_to_F
    +
    +
    +

    Format

    +

    A data frame containing the following variables.

    package
    +

    a factor giving the name of the software package

    -

    Format

    +
    M0
    +

    The fitted initial concentration of the parent compound

    -

    A data frame containing the following variables.

    -
    package

    a factor giving the name of the software package

    -
    M0

    The fitted initial concentration of the parent compound

    -
    k

    The fitted first-order degradation rate constant

    -
    DT50

    The resulting half-life of the parent compound

    -
    DT90

    The resulting DT90 of the parent compound

    -
    dataset

    The FOCUS dataset that was used

    - -
    +
    k
    +

    The fitted first-order degradation rate constant

    + +
    DT50
    +

    The resulting half-life of the parent compound

    + +
    DT90
    +

    The resulting DT90 of the parent compound

    -

    Source

    +
    dataset
    +

    The FOCUS dataset that was used

    -

    FOCUS (2006) “Guidance Document on Estimating Persistence and + +

    +
    +

    Source

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    -

    Examples

    -
    data(FOCUS_2006_SFO_ref_A_to_F) -
    +
    +

    Examples

    +
    data(FOCUS_2006_SFO_ref_A_to_F)
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOCUS_2006_datasets.html b/docs/dev/reference/FOCUS_2006_datasets.html index fb3a8f17..955b9188 100644 --- a/docs/dev/reference/FOCUS_2006_datasets.html +++ b/docs/dev/reference/FOCUS_2006_datasets.html @@ -1,67 +1,12 @@ - - - - - - - -Datasets A to F from the FOCUS Kinetics report from 2006 — FOCUS_2006_datasets • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Datasets A to F from the FOCUS Kinetics report from 2006 — FOCUS_2006_datasets • mkin - - - - + + -
    -
    - -
    - -
    +
    -
    FOCUS_2006_A
    -  FOCUS_2006_B
    -  FOCUS_2006_C
    -  FOCUS_2006_D
    -  FOCUS_2006_E
    -  FOCUS_2006_F
    +
    +
    FOCUS_2006_A
    +  FOCUS_2006_B
    +  FOCUS_2006_C
    +  FOCUS_2006_D
    +  FOCUS_2006_E
    +  FOCUS_2006_F
    +
    +
    +

    Format

    +

    6 datasets with observations on the following variables.

    name
    +

    a factor containing the name of the observed variable

    -

    Format

    +
    time
    +

    a numeric vector containing time points

    -

    6 datasets with observations on the following variables.

    -
    name

    a factor containing the name of the observed variable

    -
    time

    a numeric vector containing time points

    -
    value

    a numeric vector containing concentrations in percent of applied radioactivity

    - -
    +
    value
    +

    a numeric vector containing concentrations in percent of applied radioactivity

    -

    Source

    - -

    FOCUS (2006) “Guidance Document on Estimating Persistence and + +

    +
    +

    Source

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    - -

    Examples

    -
    FOCUS_2006_C -
    #> name time value -#> 1 parent 0 85.1 -#> 2 parent 1 57.9 -#> 3 parent 3 29.9 -#> 4 parent 7 14.6 -#> 5 parent 14 9.7 -#> 6 parent 28 6.6 -#> 7 parent 63 4.0 -#> 8 parent 91 3.9 -#> 9 parent 119 0.6
    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    + +
    +

    Examples

    +
    FOCUS_2006_C
    +#>     name time value
    +#> 1 parent    0  85.1
    +#> 2 parent    1  57.9
    +#> 3 parent    3  29.9
    +#> 4 parent    7  14.6
    +#> 5 parent   14   9.7
    +#> 6 parent   28   6.6
    +#> 7 parent   63   4.0
    +#> 8 parent   91   3.9
    +#> 9 parent  119   0.6
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/FOMC.solution.html b/docs/dev/reference/FOMC.solution.html index f64e759c..e1f19dc1 100644 --- a/docs/dev/reference/FOMC.solution.html +++ b/docs/dev/reference/FOMC.solution.html @@ -18,7 +18,7 @@ a decreasing rate constant."> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Example datasets from the NAFTA SOP published 2015 — NAFTA_SOP_2015 • mkin - - - - + + -
    -
    - -
    - -
    +
    -
    NAFTA_SOP_Appendix_B
    -  NAFTA_SOP_Appendix_D
    +
    +
    NAFTA_SOP_Appendix_B
    +  NAFTA_SOP_Appendix_D
    +
    +
    +

    Format

    +

    2 datasets with observations on the following variables.

    name
    +

    a factor containing the name of the observed variable

    -

    Format

    +
    time
    +

    a numeric vector containing time points

    -

    2 datasets with observations on the following variables.

    -
    name

    a factor containing the name of the observed variable

    -
    time

    a numeric vector containing time points

    -
    value

    a numeric vector containing concentrations

    - -
    - -

    Source

    +
    value
    +

    a numeric vector containing concentrations

    + +
    +
    +

    Source

    NAFTA (2011) Guidance for evaluating and calculating degradation kinetics in environmental media. NAFTA Technical Working Group on Pesticides - https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation accessed 2019-02-22

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to Calculate Representative Half-life Values and Characterizing Pesticide Degradation - https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    - -

    Examples

    -
    nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1) -
    #> 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
    print(nafta_evaluation) -
    #> Sums of squares: -#> SFO IORE DFOP -#> 1378.6832 615.7730 517.8836 -#> -#> Critical sum of squares for checking the SFO model: -#> [1] 717.4598 -#> -#> Parameters: -#> $SFO -#> Estimate Pr(>t) Lower Upper -#> parent_0 83.7558 1.80e-14 77.18268 90.3288 -#> k_parent 0.0017 7.43e-05 0.00112 0.0026 -#> sigma 8.7518 1.22e-05 5.64278 11.8608 -#> -#> $IORE -#> Estimate Pr(>t) Lower Upper -#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 -#> k__iore_parent 8.40e-14 NA 1.79e-18 3.94e-09 -#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 -#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 -#> -#> $DFOP -#> Estimate Pr(>t) Lower Upper -#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02 -#> k1 4.24e-02 5.92e-03 2.03e-02 8.88e-02 -#> k2 8.24e-04 6.48e-03 3.89e-04 1.75e-03 -#> g 2.88e-01 2.47e-05 1.95e-01 4.03e-01 -#> sigma 5.36e+00 2.22e-05 3.43e+00 7.30e+00 -#> -#> -#> DTx values: -#> DT50 DT90 DT50_rep -#> SFO 407 1350 407 -#> IORE 541 5190000 1560000 -#> DFOP 429 2380 841 -#> -#> Representative half-life: -#> [1] 841.41
    plot(nafta_evaluation) -
    + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    +
    + +
    +

    Examples

    +
      nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1)
    +#> 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
    +  print(nafta_evaluation)
    +#> Sums of squares:
    +#>       SFO      IORE      DFOP 
    +#> 1378.6832  615.7730  517.8836 
    +#> 
    +#> Critical sum of squares for checking the SFO model:
    +#> [1] 717.4598
    +#> 
    +#> Parameters:
    +#> $SFO
    +#>          Estimate   Pr(>t)    Lower   Upper
    +#> parent_0  83.7558 1.80e-14 77.18268 90.3288
    +#> k_parent   0.0017 7.43e-05  0.00112  0.0026
    +#> sigma      8.7518 1.22e-05  5.64278 11.8608
    +#> 
    +#> $IORE
    +#>                Estimate Pr(>t)    Lower    Upper
    +#> parent_0       9.69e+01     NA 8.88e+01 1.05e+02
    +#> k__iore_parent 8.40e-14     NA 1.79e-18 3.94e-09
    +#> N_parent       6.68e+00     NA 4.19e+00 9.17e+00
    +#> sigma          5.85e+00     NA 3.76e+00 7.94e+00
    +#> 
    +#> $DFOP
    +#>          Estimate   Pr(>t)    Lower    Upper
    +#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02
    +#> k1       4.24e-02 5.92e-03 2.03e-02 8.88e-02
    +#> k2       8.24e-04 6.48e-03 3.89e-04 1.75e-03
    +#> g        2.88e-01 2.47e-05 1.95e-01 4.03e-01
    +#> sigma    5.36e+00 2.22e-05 3.43e+00 7.30e+00
    +#> 
    +#> 
    +#> DTx values:
    +#>      DT50    DT90 DT50_rep
    +#> SFO   407    1350      407
    +#> IORE  541 5190000  1560000
    +#> DFOP  429    2380      841
    +#> 
    +#> Representative half-life:
    +#> [1] 841.41
    +  plot(nafta_evaluation)
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/NAFTA_SOP_Attachment-1.png b/docs/dev/reference/NAFTA_SOP_Attachment-1.png index 9417685e..d8951fc3 100644 Binary files a/docs/dev/reference/NAFTA_SOP_Attachment-1.png and b/docs/dev/reference/NAFTA_SOP_Attachment-1.png differ diff --git a/docs/dev/reference/NAFTA_SOP_Attachment.html b/docs/dev/reference/NAFTA_SOP_Attachment.html index 311a7c61..9d878a49 100644 --- a/docs/dev/reference/NAFTA_SOP_Attachment.html +++ b/docs/dev/reference/NAFTA_SOP_Attachment.html @@ -1,67 +1,12 @@ - - - - - - - -Example datasets from Attachment 1 to the NAFTA SOP published 2015 — NAFTA_SOP_Attachment • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Example datasets from Attachment 1 to the NAFTA SOP published 2015 — NAFTA_SOP_Attachment • mkin - - - - + + -
    -
    - -
    - -
    +
    -
    NAFTA_SOP_Attachment
    - - -

    Format

    +
    +
    NAFTA_SOP_Attachment
    +
    +
    +

    Format

    A list (NAFTA_SOP_Attachment) containing 16 datasets suitable - for the evaluation with nafta

    -

    Source

    - + for the evaluation with nafta

    +
    +
    +

    Source

    NAFTA (2011) Guidance for evaluating and calculating degradation kinetics in environmental media. NAFTA Technical Working Group on Pesticides - https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation accessed 2019-02-22

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to Calculate Representative Half-life Values and Characterizing Pesticide Degradation - https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    - -

    Examples

    -
    nafta_att_p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]], cores = 1) -
    #> 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
    print(nafta_att_p5a) -
    #> Sums of squares: -#> SFO IORE DFOP -#> 465.21753 56.27506 32.06401 -#> -#> Critical sum of squares for checking the SFO model: -#> [1] 64.4304 -#> -#> Parameters: -#> $SFO -#> Estimate Pr(>t) Lower Upper -#> parent_0 95.8401 4.67e-21 92.245 99.4357 -#> k_parent 0.0102 3.92e-12 0.009 0.0117 -#> sigma 4.8230 3.81e-06 3.214 6.4318 -#> -#> $IORE -#> Estimate Pr(>t) Lower Upper -#> parent_0 1.01e+02 NA 9.91e+01 1.02e+02 -#> k__iore_parent 1.54e-05 NA 4.08e-06 5.84e-05 -#> N_parent 2.57e+00 NA 2.25e+00 2.89e+00 -#> sigma 1.68e+00 NA 1.12e+00 2.24e+00 -#> -#> $DFOP -#> 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.26e-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 -#> -#> -#> DTx values: -#> 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 5.59e+11 3.07e+11 -#> -#> Representative half-life: -#> [1] 321.51
    plot(nafta_att_p5a) -
    + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    +
    + +
    +

    Examples

    +
      nafta_att_p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]], cores = 1)
    +#> 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
    +  print(nafta_att_p5a)
    +#> Sums of squares:
    +#>       SFO      IORE      DFOP 
    +#> 465.21753  56.27506  32.06401 
    +#> 
    +#> Critical sum of squares for checking the SFO model:
    +#> [1] 64.4304
    +#> 
    +#> Parameters:
    +#> $SFO
    +#>          Estimate   Pr(>t)  Lower   Upper
    +#> parent_0  95.8401 4.67e-21 92.245 99.4357
    +#> k_parent   0.0102 3.92e-12  0.009  0.0117
    +#> sigma      4.8230 3.81e-06  3.214  6.4318
    +#> 
    +#> $IORE
    +#>                Estimate Pr(>t)    Lower    Upper
    +#> parent_0       1.01e+02     NA 9.91e+01 1.02e+02
    +#> k__iore_parent 1.54e-05     NA 4.08e-06 5.84e-05
    +#> N_parent       2.57e+00     NA 2.25e+00 2.89e+00
    +#> sigma          1.68e+00     NA 1.12e+00 2.24e+00
    +#> 
    +#> $DFOP
    +#>          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.26e-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
    +#> 
    +#> 
    +#> DTx values:
    +#>      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 5.59e+11 3.07e+11
    +#> 
    +#> Representative half-life:
    +#> [1] 321.51
    +  plot(nafta_att_p5a)
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png index b3448db0..ca982688 100644 Binary files a/docs/dev/reference/Rplot001.png and b/docs/dev/reference/Rplot001.png differ diff --git a/docs/dev/reference/Rplot002.png b/docs/dev/reference/Rplot002.png index 27feab09..de2d61aa 100644 Binary files a/docs/dev/reference/Rplot002.png and b/docs/dev/reference/Rplot002.png differ diff --git a/docs/dev/reference/Rplot005.png b/docs/dev/reference/Rplot005.png index cb419daa..76f25647 100644 Binary files a/docs/dev/reference/Rplot005.png and b/docs/dev/reference/Rplot005.png differ diff --git a/docs/dev/reference/SFO.solution.html b/docs/dev/reference/SFO.solution.html index 970a62c5..a0bb999c 100644 --- a/docs/dev/reference/SFO.solution.html +++ b/docs/dev/reference/SFO.solution.html @@ -17,7 +17,7 @@ mkin - 1.2.0 + 1.2.2 @@ -59,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/SFORB.solution.html b/docs/dev/reference/SFORB.solution.html index e3e43557..c14d3a32 100644 --- a/docs/dev/reference/SFORB.solution.html +++ b/docs/dev/reference/SFORB.solution.html @@ -21,7 +21,7 @@ and no substance in the bound fraction.">< mkin - 1.2.0 + 1.2.2 @@ -63,7 +63,10 @@ and no substance in the bound fraction.">< Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/add_err-1.png b/docs/dev/reference/add_err-1.png index 9ba106db..4a3b4062 100644 Binary files a/docs/dev/reference/add_err-1.png and b/docs/dev/reference/add_err-1.png differ diff --git a/docs/dev/reference/add_err-2.png b/docs/dev/reference/add_err-2.png index 3088c40e..5aec1744 100644 Binary files a/docs/dev/reference/add_err-2.png and b/docs/dev/reference/add_err-2.png differ diff --git a/docs/dev/reference/add_err-3.png b/docs/dev/reference/add_err-3.png index 493a761a..2e71f02f 100644 Binary files a/docs/dev/reference/add_err-3.png and b/docs/dev/reference/add_err-3.png differ diff --git a/docs/dev/reference/add_err.html b/docs/dev/reference/add_err.html index b94cef29..c70d43a0 100644 --- a/docs/dev/reference/add_err.html +++ b/docs/dev/reference/add_err.html @@ -1,69 +1,14 @@ - - - - - - - -Add normally distributed errors to simulated kinetic degradation data — add_err • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Add normally distributed errors to simulated kinetic degradation data — add_err • mkin - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +

    Normally distributed errors are added to data predicted for a specific -degradation model using mkinpredict. The variance of the error +degradation model using mkinpredict. The variance of the error may depend on the predicted value and is specified as a standard deviation.

    -
    add_err(
    -  prediction,
    -  sdfunc,
    -  secondary = c("M1", "M2"),
    -  n = 10,
    -  LOD = 0.1,
    -  reps = 2,
    -  digits = 1,
    -  seed = NA
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    prediction

    A prediction from a kinetic model as produced by -mkinpredict.

    sdfunc

    A function taking the predicted value as its only argument and +

    +
    add_err(
    +  prediction,
    +  sdfunc,
    +  secondary = c("M1", "M2"),
    +  n = 10,
    +  LOD = 0.1,
    +  reps = 2,
    +  digits = 1,
    +  seed = NA
    +)
    +
    + +
    +

    Arguments

    +
    prediction
    +

    A prediction from a kinetic model as produced by +mkinpredict.

    + + +
    sdfunc
    +

    A function taking the predicted value as its only argument and returning a standard deviation that should be used for generating the -random error terms for this value.

    secondary

    The names of state variables that should have an initial -value of zero

    n

    The number of datasets to be generated.

    LOD

    The limit of detection (LOD). Values that are below the LOD after -adding the random error will be set to NA.

    reps

    The number of replicates to be generated within the datasets.

    digits

    The number of digits to which the values will be rounded.

    seed

    The seed used for the generation of random numbers. If NA, the -seed is not set.

    - -

    Value

    - -

    A list of datasets compatible with mmkin, i.e. the -components of the list are datasets compatible with mkinfit.

    -

    References

    +random error terms for this value.

    + + +
    secondary
    +

    The names of state variables that should have an initial +value of zero

    + + +
    n
    +

    The number of datasets to be generated.

    + + +
    LOD
    +

    The limit of detection (LOD). Values that are below the LOD after +adding the random error will be set to NA.

    + +
    reps
    +

    The number of replicates to be generated within the datasets.

    + + +
    digits
    +

    The number of digits to which the values will be rounded.

    + + +
    seed
    +

    The seed used for the generation of random numbers. If NA, the +seed is not set.

    + +
    +
    +

    Value

    + + +

    A list of datasets compatible with mmkin, i.e. the +components of the list are datasets compatible with mkinfit.

    +
    +
    +

    References

    Ranke J and Lehmann R (2015) To t-test or not to t-test, that is the question. XV Symposium on Pesticide Chemistry 2-4 September 2015, Piacenza, Italy https://jrwb.de/posters/piacenza_2015.pdf

    -

    Author

    - +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    -# The kinetic model -m_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"), - M1 = mkinsub("SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -# Generate a prediction for a specific set of parameters -sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) - -# This is the prediction used for the "Type 2 datasets" on the Piacenza poster -# from 2015 -d_SFO_SFO <- mkinpredict(m_SFO_SFO, - c(k_parent = 0.1, f_parent_to_M1 = 0.5, - k_M1 = log(2)/1000), - c(parent = 100, M1 = 0), - sampling_times) - -# Add an error term with a constant (independent of the value) standard deviation -# of 10, and generate three datasets -d_SFO_SFO_err <- add_err(d_SFO_SFO, function(x) 10, n = 3, seed = 123456789 ) - -# Name the datasets for nicer plotting -names(d_SFO_SFO_err) <- paste("Dataset", 1:3) - -# Name the model in the list of models (with only one member in this case) for -# nicer plotting later on. Be quiet and use only one core not to offend CRAN -# checks -# \dontrun{ -f_SFO_SFO <- mmkin(list("SFO-SFO" = m_SFO_SFO), - d_SFO_SFO_err, cores = 1, - quiet = TRUE) - -plot(f_SFO_SFO) -
    -# We would like to inspect the fit for dataset 3 more closely -# Using double brackets makes the returned object an mkinfit object -# instead of a list of mkinfit objects, so plot.mkinfit is used -plot(f_SFO_SFO[[3]], show_residuals = TRUE) -
    -# If we use single brackets, we should give two indices (model and dataset), -# and plot.mmkin is used -plot(f_SFO_SFO[1, 3]) -
    # } - -
    +
    +

    Examples

    +
    
    +# The kinetic model
    +m_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
    +                     M1 = mkinsub("SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +# Generate a prediction for a specific set of parameters
    +sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +
    +# This is the prediction used for the "Type 2 datasets" on the Piacenza poster
    +# from 2015
    +d_SFO_SFO <- mkinpredict(m_SFO_SFO,
    +                         c(k_parent = 0.1, f_parent_to_M1 = 0.5,
    +                           k_M1 = log(2)/1000),
    +                         c(parent = 100, M1 = 0),
    +                         sampling_times)
    +
    +# Add an error term with a constant (independent of the value) standard deviation
    +# of 10, and generate three datasets
    +d_SFO_SFO_err <- add_err(d_SFO_SFO, function(x) 10, n = 3, seed = 123456789 )
    +
    +# Name the datasets for nicer plotting
    +names(d_SFO_SFO_err) <- paste("Dataset", 1:3)
    +
    +# Name the model in the list of models (with only one member in this case) for
    +# nicer plotting later on.  Be quiet and use only one core not to offend CRAN
    +# checks
    +# \dontrun{
    +f_SFO_SFO <- mmkin(list("SFO-SFO" = m_SFO_SFO),
    +                   d_SFO_SFO_err, cores = 1,
    +                   quiet = TRUE)
    +
    +plot(f_SFO_SFO)
    +
    +
    +# We would like to inspect the fit for dataset 3 more closely
    +# Using double brackets makes the returned object an mkinfit object
    +# instead of a list of mkinfit objects, so plot.mkinfit is used
    +plot(f_SFO_SFO[[3]], show_residuals = TRUE)
    +
    +
    +# If we use single brackets, we should give two indices (model and dataset),
    +# and plot.mmkin is used
    +plot(f_SFO_SFO[1, 3])
    +
    +# }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/anova.saem.mmkin.html b/docs/dev/reference/anova.saem.mmkin.html index 2c109cc2..1689e436 100644 --- a/docs/dev/reference/anova.saem.mmkin.html +++ b/docs/dev/reference/anova.saem.mmkin.html @@ -20,7 +20,7 @@ the model on the previous line."> - - - - - - -Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    @@ -161,279 +106,301 @@ platforms. The speed of the method could likely be improved by using the method of Venzon and Moolgavkar (1988).

    -
    # S3 method for mkinfit
    -confint(
    -  object,
    -  parm,
    -  level = 0.95,
    -  alpha = 1 - level,
    -  cutoff,
    -  method = c("quadratic", "profile"),
    -  transformed = TRUE,
    -  backtransform = TRUE,
    -  cores = parallel::detectCores(),
    -  rel_tol = 0.01,
    -  quiet = FALSE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    object

    An mkinfit object

    parm

    A vector of names of the parameters which are to be given -confidence intervals. If missing, all parameters are considered.

    level

    The confidence level required

    alpha

    The allowed error probability, overrides 'level' if specified.

    cutoff

    Possibility to specify an alternative cutoff for the difference +

    +
    # S3 method for mkinfit
    +confint(
    +  object,
    +  parm,
    +  level = 0.95,
    +  alpha = 1 - level,
    +  cutoff,
    +  method = c("quadratic", "profile"),
    +  transformed = TRUE,
    +  backtransform = TRUE,
    +  cores = parallel::detectCores(),
    +  rel_tol = 0.01,
    +  quiet = FALSE,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    object
    +

    An mkinfit object

    + + +
    parm
    +

    A vector of names of the parameters which are to be given +confidence intervals. If missing, all parameters are considered.

    + + +
    level
    +

    The confidence level required

    + + +
    alpha
    +

    The allowed error probability, overrides 'level' if specified.

    + + +
    cutoff
    +

    Possibility to specify an alternative cutoff for the difference in the log-likelihoods at the confidence boundary. Specifying an explicit -cutoff value overrides arguments 'level' and 'alpha'

    method

    The 'quadratic' method approximates the likelihood function at +cutoff value overrides arguments 'level' and 'alpha'

    + + +
    method
    +

    The 'quadratic' method approximates the likelihood function at the optimised parameters using the second term of the Taylor expansion, using a second derivative (hessian) contained in the object. The 'profile' method searches the parameter space for the -cutoff of the confidence intervals by means of a likelihood ratio test.

    transformed

    If the quadratic approximation is used, should it be -applied to the likelihood based on the transformed parameters?

    backtransform

    If we approximate the likelihood in terms of the +cutoff of the confidence intervals by means of a likelihood ratio test.

    + + +
    transformed
    +

    If the quadratic approximation is used, should it be +applied to the likelihood based on the transformed parameters?

    + + +
    backtransform
    +

    If we approximate the likelihood in terms of the transformed parameters, should we backtransform the parameters with -their confidence intervals?

    cores

    The number of cores to be used for multicore processing. -On Windows machines, cores > 1 is currently not supported.

    rel_tol

    If the method is 'profile', what should be the accuracy +their confidence intervals?

    + + +
    cores
    +

    The number of cores to be used for multicore processing. +On Windows machines, cores > 1 is currently not supported.

    + + +
    rel_tol
    +

    If the method is 'profile', what should be the accuracy of the lower and upper bounds, relative to the estimate obtained from -the quadratic method?

    quiet

    Should we suppress the message "Profiling the likelihood"

    ...

    Not used

    - -

    Value

    - -

    A matrix with columns giving lower and upper confidence limits for -each parameter.

    -

    References

    +the quadratic method?

    + + +
    quiet
    +

    Should we suppress the message "Profiling the likelihood"

    + +
    ...
    +

    Not used

    + +
    +
    +

    Value

    + + +

    A matrix with columns giving lower and upper confidence limits for +each parameter.

    +
    +
    +

    References

    Bates DM and Watts GW (1988) Nonlinear regression analysis & its applications

    Pawitan Y (2013) In all likelihood - Statistical modelling and inference using likelihood. Clarendon Press, Oxford.

    Venzon DJ and Moolgavkar SH (1988) A Method for Computing Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, 87–94.

    +
    -

    Examples

    -
    f <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE) -confint(f, method = "quadratic") -
    #> 2.5% 97.5% -#> parent_0 71.8242430 93.1600766 -#> k_parent 0.2109541 0.4440528 -#> sigma 1.9778868 7.3681380
    -# \dontrun{ -confint(f, method = "profile") -
    #> Profiling the likelihood
    #> 2.5% 97.5% -#> parent_0 73.0641834 92.1392181 -#> k_parent 0.2170293 0.4235348 -#> sigma 3.1307772 8.0628314
    -# Set the number of cores for the profiling method for further examples -if (identical(Sys.getenv("NOT_CRAN"), "true")) { - n_cores <- parallel::detectCores() - 1 -} else { - n_cores <- 1 -} -if (Sys.getenv("TRAVIS") != "") n_cores = 1 -if (Sys.info()["sysname"] == "Windows") n_cores = 1 - -SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), - use_of_ff = "min", quiet = TRUE) -SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), - use_of_ff = "max", quiet = TRUE) -f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE) -system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE)) -
    #> user system elapsed -#> 4.295 1.008 3.959
    # Using more cores does not save much time here, as parent_0 takes up most of the time -# If we additionally exclude parent_0 (the confidence of which is often of -# minor interest), we get a nice performance improvement if we use at least 4 cores -system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile", - c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores)) -
    #> Profiling the likelihood
    #> user system elapsed -#> 1.451 0.126 0.923
    ci_profile -
    #> 2.5% 97.5% -#> parent_0 96.456003640 1.027703e+02 -#> k_parent_sink 0.040762501 5.549764e-02 -#> k_parent_m1 0.046786482 5.500879e-02 -#> k_m1_sink 0.003892605 6.702778e-03 -#> sigma 2.535612399 3.985263e+00
    ci_quadratic_transformed <- confint(f_d_1, method = "quadratic") -ci_quadratic_transformed -
    #> 2.5% 97.5% -#> parent_0 96.403841640 1.027931e+02 -#> k_parent_sink 0.041033378 5.596269e-02 -#> k_parent_m1 0.046777902 5.511931e-02 -#> k_m1_sink 0.004012217 6.897547e-03 -#> sigma 2.396089689 3.854918e+00
    ci_quadratic_untransformed <- confint(f_d_1, method = "quadratic", transformed = FALSE) -ci_quadratic_untransformed -
    #> 2.5% 97.5% -#> parent_0 96.403841645 102.79312449 -#> k_parent_sink 0.040485331 0.05535491 -#> k_parent_m1 0.046611582 0.05494364 -#> k_m1_sink 0.003835483 0.00668582 -#> sigma 2.396089689 3.85491806
    # Against the expectation based on Bates and Watts (1988), the confidence -# intervals based on the internal parameter transformation are less -# congruent with the likelihood based intervals. Note the superiority of the -# interval based on the untransformed fit for k_m1_sink -rel_diffs_transformed <- abs((ci_quadratic_transformed - ci_profile)/ci_profile) -rel_diffs_untransformed <- abs((ci_quadratic_untransformed - ci_profile)/ci_profile) -rel_diffs_transformed < rel_diffs_untransformed -
    #> 2.5% 97.5% -#> parent_0 FALSE FALSE -#> k_parent_sink TRUE FALSE -#> k_parent_m1 TRUE FALSE -#> k_m1_sink FALSE FALSE -#> sigma FALSE FALSE
    signif(rel_diffs_transformed, 3) -
    #> 2.5% 97.5% -#> parent_0 0.000541 0.000222 -#> k_parent_sink 0.006650 0.008380 -#> k_parent_m1 0.000183 0.002010 -#> k_m1_sink 0.030700 0.029100 -#> sigma 0.055000 0.032700
    signif(rel_diffs_untransformed, 3) -
    #> 2.5% 97.5% -#> parent_0 0.000541 0.000222 -#> k_parent_sink 0.006800 0.002570 -#> k_parent_m1 0.003740 0.001180 -#> k_m1_sink 0.014700 0.002530 -#> sigma 0.055000 0.032700
    - -# Investigate a case with formation fractions -f_d_2 <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), quiet = TRUE) -ci_profile_ff <- confint(f_d_2, method = "profile", cores = n_cores) -
    #> Profiling the likelihood
    ci_profile_ff -
    #> 2.5% 97.5% -#> parent_0 96.456003640 1.027703e+02 -#> k_parent 0.090911032 1.071578e-01 -#> k_m1 0.003892606 6.702775e-03 -#> f_parent_to_m1 0.471328495 5.611550e-01 -#> sigma 2.535612399 3.985263e+00
    ci_quadratic_transformed_ff <- confint(f_d_2, method = "quadratic") -ci_quadratic_transformed_ff -
    #> 2.5% 97.5% -#> parent_0 96.403833578 102.79311649 -#> k_parent 0.090823771 0.10725430 -#> k_m1 0.004012219 0.00689755 -#> f_parent_to_m1 0.469118824 0.55959615 -#> sigma 2.396089689 3.85491806
    ci_quadratic_untransformed_ff <- confint(f_d_2, method = "quadratic", transformed = FALSE) -ci_quadratic_untransformed_ff -
    #> 2.5% 97.5% -#> parent_0 96.403833583 1.027931e+02 -#> k_parent 0.090491913 1.069035e-01 -#> k_m1 0.003835485 6.685823e-03 -#> f_parent_to_m1 0.469113477 5.598387e-01 -#> sigma 2.396089689 3.854918e+00
    rel_diffs_transformed_ff <- abs((ci_quadratic_transformed_ff - ci_profile_ff)/ci_profile_ff) -rel_diffs_untransformed_ff <- abs((ci_quadratic_untransformed_ff - ci_profile_ff)/ci_profile_ff) -# While the confidence interval for the parent rate constant is closer to -# the profile based interval when using the internal parameter -# transformation, the interval for the metabolite rate constant is 'better -# without internal parameter transformation. -rel_diffs_transformed_ff < rel_diffs_untransformed_ff -
    #> 2.5% 97.5% -#> parent_0 FALSE FALSE -#> k_parent TRUE TRUE -#> k_m1 FALSE FALSE -#> f_parent_to_m1 TRUE FALSE -#> sigma TRUE FALSE
    rel_diffs_transformed_ff -
    #> 2.5% 97.5% -#> parent_0 0.0005408690 0.0002217233 -#> k_parent 0.0009598532 0.0009001864 -#> k_m1 0.0307283041 0.0290588361 -#> f_parent_to_m1 0.0046881769 0.0027780063 -#> sigma 0.0550252516 0.0327066836
    rel_diffs_untransformed_ff -
    #> 2.5% 97.5% -#> parent_0 0.0005408689 0.0002217232 -#> k_parent 0.0046102156 0.0023732281 -#> k_m1 0.0146740690 0.0025291820 -#> f_parent_to_m1 0.0046995211 0.0023457712 -#> sigma 0.0550252516 0.0327066836
    -# The profiling for the following fit does not finish in a reasonable time, -# therefore we use the quadratic approximation -m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), - M1 = mkinsub("SFO"), - M2 = mkinsub("SFO"), - use_of_ff = "max", quiet = TRUE) -DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data -f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", - error_model_algorithm = "direct", quiet = TRUE) -confint(f_tc_2, method = "quadratic") -
    #> 2.5% 97.5% -#> parent_0 94.596039609 106.19954892 -#> k_M1 0.037605368 0.04490762 -#> k_M2 0.008568731 0.01087676 -#> f_parent_to_M1 0.021462489 0.62023882 -#> f_parent_to_M2 0.015165617 0.37975348 -#> k1 0.273897348 0.33388101 -#> k2 0.018614554 0.02250378 -#> g 0.671943411 0.73583305 -#> sigma_low 0.251283495 0.83992077 -#> rsd_high 0.040411024 0.07662008
    confint(f_tc_2, "parent_0", method = "quadratic") -
    #> 2.5% 97.5% -#> parent_0 94.59604 106.1995
    # } -
    +
    +

    Examples

    +
    f <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE)
    +confint(f, method = "quadratic")
    +#>                2.5%      97.5%
    +#> parent_0 71.8242430 93.1600766
    +#> k_parent  0.2109541  0.4440528
    +#> sigma     1.9778868  7.3681380
    +
    +# \dontrun{
    +confint(f, method = "profile")
    +#> Profiling the likelihood
    +#>                2.5%      97.5%
    +#> parent_0 73.0641834 92.1392181
    +#> k_parent  0.2170293  0.4235348
    +#> sigma     3.1307772  8.0628314
    +
    +# Set the number of cores for the profiling method for further examples
    +if (identical(Sys.getenv("NOT_CRAN"), "true")) {
    +  n_cores <- parallel::detectCores() - 1
    +} else {
    +  n_cores <- 1
    +}
    +if (Sys.getenv("TRAVIS") != "") n_cores = 1
    +if (Sys.info()["sysname"] == "Windows") n_cores = 1
    +
    +SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
    +  use_of_ff = "min", quiet = TRUE)
    +SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"),
    +  use_of_ff = "max", quiet = TRUE)
    +f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
    +system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE))
    +#>    user  system elapsed 
    +#>   3.811   0.004   3.815 
    +# Using more cores does not save much time here, as parent_0 takes up most of the time
    +# If we additionally exclude parent_0 (the confidence of which is often of
    +# minor interest), we get a nice performance improvement if we use at least 4 cores
    +system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile",
    +  c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
    +#> Profiling the likelihood
    +#>    user  system elapsed 
    +#>   2.313   0.004   2.318 
    +ci_profile
    +#>                       2.5%        97.5%
    +#> parent_0      96.456003640 1.027703e+02
    +#> k_parent_sink  0.040762501 5.549764e-02
    +#> k_parent_m1    0.046786482 5.500879e-02
    +#> k_m1_sink      0.003892605 6.702778e-03
    +#> sigma          2.535612399 3.985263e+00
    +ci_quadratic_transformed <- confint(f_d_1, method = "quadratic")
    +ci_quadratic_transformed
    +#>                       2.5%        97.5%
    +#> parent_0      96.403841640 1.027931e+02
    +#> k_parent_sink  0.041033378 5.596269e-02
    +#> k_parent_m1    0.046777902 5.511931e-02
    +#> k_m1_sink      0.004012217 6.897547e-03
    +#> sigma          2.396089689 3.854918e+00
    +ci_quadratic_untransformed <- confint(f_d_1, method = "quadratic", transformed = FALSE)
    +ci_quadratic_untransformed
    +#>                       2.5%        97.5%
    +#> parent_0      96.403841645 102.79312449
    +#> k_parent_sink  0.040485331   0.05535491
    +#> k_parent_m1    0.046611582   0.05494364
    +#> k_m1_sink      0.003835483   0.00668582
    +#> sigma          2.396089689   3.85491806
    +# Against the expectation based on Bates and Watts (1988), the confidence
    +# intervals based on the internal parameter transformation are less
    +# congruent with the likelihood based intervals. Note the superiority of the
    +# interval based on the untransformed fit for k_m1_sink
    +rel_diffs_transformed <- abs((ci_quadratic_transformed - ci_profile)/ci_profile)
    +rel_diffs_untransformed <- abs((ci_quadratic_untransformed - ci_profile)/ci_profile)
    +rel_diffs_transformed < rel_diffs_untransformed
    +#>                2.5% 97.5%
    +#> parent_0      FALSE FALSE
    +#> k_parent_sink  TRUE FALSE
    +#> k_parent_m1    TRUE FALSE
    +#> k_m1_sink     FALSE FALSE
    +#> sigma         FALSE FALSE
    +signif(rel_diffs_transformed, 3)
    +#>                   2.5%    97.5%
    +#> parent_0      0.000541 0.000222
    +#> k_parent_sink 0.006650 0.008380
    +#> k_parent_m1   0.000183 0.002010
    +#> k_m1_sink     0.030700 0.029100
    +#> sigma         0.055000 0.032700
    +signif(rel_diffs_untransformed, 3)
    +#>                   2.5%    97.5%
    +#> parent_0      0.000541 0.000222
    +#> k_parent_sink 0.006800 0.002570
    +#> k_parent_m1   0.003740 0.001180
    +#> k_m1_sink     0.014700 0.002530
    +#> sigma         0.055000 0.032700
    +
    +
    +# Investigate a case with formation fractions
    +f_d_2 <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
    +ci_profile_ff <- confint(f_d_2, method = "profile", cores = n_cores)
    +#> Profiling the likelihood
    +ci_profile_ff
    +#>                        2.5%        97.5%
    +#> parent_0       96.456003640 1.027703e+02
    +#> k_parent        0.090911032 1.071578e-01
    +#> k_m1            0.003892606 6.702775e-03
    +#> f_parent_to_m1  0.471328495 5.611550e-01
    +#> sigma           2.535612399 3.985263e+00
    +ci_quadratic_transformed_ff <- confint(f_d_2, method = "quadratic")
    +ci_quadratic_transformed_ff
    +#>                        2.5%        97.5%
    +#> parent_0       96.403833578 102.79311649
    +#> k_parent        0.090823771   0.10725430
    +#> k_m1            0.004012219   0.00689755
    +#> f_parent_to_m1  0.469118824   0.55959615
    +#> sigma           2.396089689   3.85491806
    +ci_quadratic_untransformed_ff <- confint(f_d_2, method = "quadratic", transformed = FALSE)
    +ci_quadratic_untransformed_ff
    +#>                        2.5%        97.5%
    +#> parent_0       96.403833583 1.027931e+02
    +#> k_parent        0.090491913 1.069035e-01
    +#> k_m1            0.003835485 6.685823e-03
    +#> f_parent_to_m1  0.469113477 5.598387e-01
    +#> sigma           2.396089689 3.854918e+00
    +rel_diffs_transformed_ff <- abs((ci_quadratic_transformed_ff - ci_profile_ff)/ci_profile_ff)
    +rel_diffs_untransformed_ff <- abs((ci_quadratic_untransformed_ff - ci_profile_ff)/ci_profile_ff)
    +# While the confidence interval for the parent rate constant is closer to
    +# the profile based interval when using the internal parameter
    +# transformation, the interval for the metabolite rate constant is 'better
    +# without internal parameter transformation.
    +rel_diffs_transformed_ff < rel_diffs_untransformed_ff
    +#>                 2.5% 97.5%
    +#> parent_0       FALSE FALSE
    +#> k_parent        TRUE  TRUE
    +#> k_m1           FALSE FALSE
    +#> f_parent_to_m1  TRUE FALSE
    +#> sigma           TRUE FALSE
    +rel_diffs_transformed_ff
    +#>                        2.5%        97.5%
    +#> parent_0       0.0005408690 0.0002217233
    +#> k_parent       0.0009598532 0.0009001864
    +#> k_m1           0.0307283041 0.0290588361
    +#> f_parent_to_m1 0.0046881769 0.0027780063
    +#> sigma          0.0550252516 0.0327066836
    +rel_diffs_untransformed_ff
    +#>                        2.5%        97.5%
    +#> parent_0       0.0005408689 0.0002217232
    +#> k_parent       0.0046102156 0.0023732281
    +#> k_m1           0.0146740690 0.0025291820
    +#> f_parent_to_m1 0.0046995211 0.0023457712
    +#> sigma          0.0550252516 0.0327066836
    +
    +# The profiling for the following fit does not finish in a reasonable time,
    +# therefore we use the quadratic approximation
    +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")),
    +  M1 = mkinsub("SFO"),
    +  M2 = mkinsub("SFO"),
    +  use_of_ff = "max", quiet = TRUE)
    +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data
    +f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc",
    +  error_model_algorithm = "direct", quiet = TRUE)
    +confint(f_tc_2, method = "quadratic")
    +#>                        2.5%        97.5%
    +#> parent_0       94.596039609 106.19954892
    +#> k_M1            0.037605368   0.04490762
    +#> k_M2            0.008568731   0.01087676
    +#> f_parent_to_M1  0.021462489   0.62023882
    +#> f_parent_to_M2  0.015165617   0.37975348
    +#> k1              0.273897348   0.33388101
    +#> k2              0.018614554   0.02250378
    +#> g               0.671943411   0.73583305
    +#> sigma_low       0.251283495   0.83992077
    +#> rsd_high        0.040411024   0.07662008
    +confint(f_tc_2, "parent_0", method = "quadratic")
    +#>              2.5%    97.5%
    +#> parent_0 94.59604 106.1995
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/create_deg_func.html b/docs/dev/reference/create_deg_func.html index 5d5870fe..e2a42873 100644 --- a/docs/dev/reference/create_deg_func.html +++ b/docs/dev/reference/create_deg_func.html @@ -17,7 +17,7 @@ mkin - 1.1.2 + 1.2.2 @@ -44,11 +44,14 @@ Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -56,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -125,8 +131,8 @@ replications = 2) #> Loading required package: rbenchmark #> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.401 1.000 0.401 0 0 -#> 2 deSolve 2 0.654 1.631 0.654 0 0 +#> 1 analytical 2 0.458 1.000 0.458 0 0 +#> 2 deSolve 2 0.713 1.557 0.713 0 0 #> sys.child #> 1 0 #> 2 0 @@ -139,8 +145,8 @@ deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), replications = 2) #> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.843 1.000 0.843 0 0 -#> 2 deSolve 2 1.445 1.714 1.445 0 0 +#> 1 analytical 2 0.884 1.000 0.883 0.000 0 +#> 2 deSolve 2 1.526 1.726 1.522 0.004 0 #> sys.child #> 1 0 #> 2 0 diff --git a/docs/dev/reference/dimethenamid_2018-1.png b/docs/dev/reference/dimethenamid_2018-1.png index 4300b0c0..c8b05bf5 100644 Binary files a/docs/dev/reference/dimethenamid_2018-1.png and b/docs/dev/reference/dimethenamid_2018-1.png differ diff --git a/docs/dev/reference/dimethenamid_2018.html b/docs/dev/reference/dimethenamid_2018.html index 2454a609..96ec73c6 100644 --- a/docs/dev/reference/dimethenamid_2018.html +++ b/docs/dev/reference/dimethenamid_2018.html @@ -22,7 +22,7 @@ constrained by data protection regulations."> mkin - 1.1.2 + 1.2.2 @@ -49,11 +49,14 @@ constrained by data protection regulations.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -61,7 +64,10 @@ constrained by data protection regulations.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -180,17 +186,15 @@ specific pieces of information in the comments.

    # influence of ill-defined rate constants that have # extremely small values: plot(mixed(dmta_sfo_sfo3p_tc), test_log_parms = FALSE) - # If we disregards ill-defined rate constants, the results # look more plausible, but the truth is likely to be in # between these variants plot(mixed(dmta_sfo_sfo3p_tc), test_log_parms = TRUE) - + # We can also specify a default value for the failing # log parameters, to mimic FOCUS guidance plot(mixed(dmta_sfo_sfo3p_tc), test_log_parms = TRUE, default_log_parms = log(2)/1000) - # As these attempts are not satisfying, we use nonlinear mixed-effects models # f_dmta_nlme_tc <- nlme(dmta_sfo_sfo3p_tc) # nlme reaches maxIter = 50 without convergence @@ -200,11 +204,11 @@ specific pieces of information in the comments.

    # graphics device used) #saemix::plot(f_dmta_saem_tc$so, plot.type = "convergence") summary(f_dmta_saem_tc) -#> saemix version used for fitting: 3.1 -#> mkin version used for pre-fitting: 1.1.2 -#> R version used for fitting: 4.2.1 -#> Date of fit: Fri Sep 16 10:29:07 2022 -#> Date of summary: Fri Sep 16 10:29:07 2022 +#> saemix version used for fitting: 3.2 +#> mkin version used for pre-fitting: 1.2.2 +#> R version used for fitting: 4.2.2 +#> Date of fit: Thu Nov 24 08:05:16 2022 +#> Date of summary: Thu Nov 24 08:05:16 2022 #> #> Equations: #> d_DMTA/dt = - k_DMTA * DMTA @@ -217,7 +221,7 @@ specific pieces of information in the comments.

    #> #> Model predictions using solution type deSolve #> -#> Fitted in 797.539 s +#> Fitted in 819.725 s #> Using 300, 100 iterations and 9 chains #> #> Variance model: Two-component variance function @@ -235,69 +239,79 @@ specific pieces of information in the comments.

    #> #> Likelihood computed by importance sampling #> AIC BIC logLik -#> 2276 2272 -1120 +#> 2276 2273 -1120 #> #> Optimised parameters: -#> est. lower upper -#> DMTA_0 88.5943 84.3961 92.7925 -#> log_k_DMTA -3.0466 -3.5609 -2.5322 -#> log_k_M23 -4.0684 -4.9340 -3.2029 -#> log_k_M27 -3.8628 -4.2627 -3.4628 -#> log_k_M31 -3.9803 -4.4804 -3.4801 -#> f_DMTA_ilr_1 0.1304 -0.2186 0.4795 -#> f_DMTA_ilr_2 0.1490 -0.2559 0.5540 -#> f_DMTA_ilr_3 -1.3970 -1.6976 -1.0964 +#> est. lower upper +#> DMTA_0 88.3192 83.8656 92.7729 +#> log_k_DMTA -3.0530 -3.5686 -2.5373 +#> log_k_M23 -4.0620 -4.9202 -3.2038 +#> log_k_M27 -3.8633 -4.2668 -3.4598 +#> log_k_M31 -3.9731 -4.4763 -3.4699 +#> f_DMTA_ilr_1 0.1346 -0.2150 0.4841 +#> f_DMTA_ilr_2 0.1449 -0.2593 0.5491 +#> f_DMTA_ilr_3 -1.3882 -1.7011 -1.0753 +#> a.1 0.9156 0.8229 1.0084 +#> b.1 0.1383 0.1215 0.1551 +#> SD.DMTA_0 3.7280 -0.6951 8.1511 +#> SD.log_k_DMTA 0.6431 0.2781 1.0080 +#> SD.log_k_M23 1.0096 0.3782 1.6409 +#> SD.log_k_M27 0.4583 0.1541 0.7625 +#> SD.log_k_M31 0.5738 0.1942 0.9533 +#> SD.f_DMTA_ilr_1 0.4119 0.1528 0.6709 +#> SD.f_DMTA_ilr_2 0.4780 0.1806 0.7754 +#> SD.f_DMTA_ilr_3 0.3657 0.1383 0.5931 #> #> Correlation: #> DMTA_0 l__DMTA lg__M23 lg__M27 lg__M31 f_DMTA__1 f_DMTA__2 -#> log_k_DMTA 0.0309 -#> log_k_M23 -0.0231 -0.0031 -#> log_k_M27 -0.0381 -0.0048 0.0039 -#> log_k_M31 -0.0251 -0.0031 0.0021 0.0830 -#> f_DMTA_ilr_1 -0.0046 -0.0006 0.0417 -0.0437 0.0328 -#> f_DMTA_ilr_2 -0.0008 -0.0002 0.0214 -0.0270 -0.0909 -0.0361 -#> f_DMTA_ilr_3 -0.1832 -0.0135 0.0434 0.0804 0.0395 -0.0070 0.0059 +#> log_k_DMTA 0.0303 +#> log_k_M23 -0.0229 -0.0032 +#> log_k_M27 -0.0372 -0.0049 0.0041 +#> log_k_M31 -0.0245 -0.0032 0.0022 0.0815 +#> f_DMTA_ilr_1 -0.0046 -0.0006 0.0415 -0.0433 0.0324 +#> f_DMTA_ilr_2 -0.0008 -0.0002 0.0214 -0.0267 -0.0893 -0.0361 +#> f_DMTA_ilr_3 -0.1755 -0.0135 0.0423 0.0775 0.0377 -0.0066 0.0060 #> #> Random effects: #> est. lower upper -#> SD.DMTA_0 3.3651 -0.9649 7.6951 -#> SD.log_k_DMTA 0.6415 0.2774 1.0055 -#> SD.log_k_M23 1.0176 0.3809 1.6543 -#> SD.log_k_M27 0.4538 0.1522 0.7554 -#> SD.log_k_M31 0.5684 0.1905 0.9464 -#> SD.f_DMTA_ilr_1 0.4111 0.1524 0.6699 -#> SD.f_DMTA_ilr_2 0.4788 0.1808 0.7768 -#> SD.f_DMTA_ilr_3 0.3501 0.1316 0.5685 +#> SD.DMTA_0 3.7280 -0.6951 8.1511 +#> SD.log_k_DMTA 0.6431 0.2781 1.0080 +#> SD.log_k_M23 1.0096 0.3782 1.6409 +#> SD.log_k_M27 0.4583 0.1541 0.7625 +#> SD.log_k_M31 0.5738 0.1942 0.9533 +#> SD.f_DMTA_ilr_1 0.4119 0.1528 0.6709 +#> SD.f_DMTA_ilr_2 0.4780 0.1806 0.7754 +#> SD.f_DMTA_ilr_3 0.3657 0.1383 0.5931 #> #> Variance model: -#> est. lower upper -#> a.1 0.9349 0.8409 1.029 -#> b.1 0.1344 0.1178 0.151 +#> est. lower upper +#> a.1 0.9156 0.8229 1.0084 +#> b.1 0.1383 0.1215 0.1551 #> #> Backtransformed parameters: #> est. lower upper -#> DMTA_0 88.59431 84.396147 92.79246 -#> k_DMTA 0.04752 0.028413 0.07948 -#> k_M23 0.01710 0.007198 0.04064 -#> k_M27 0.02101 0.014084 0.03134 -#> k_M31 0.01868 0.011329 0.03080 -#> f_DMTA_to_M23 0.14498 NA NA -#> f_DMTA_to_M27 0.12056 NA NA -#> f_DMTA_to_M31 0.11015 NA NA +#> DMTA_0 88.31924 83.865625 92.77286 +#> k_DMTA 0.04722 0.028196 0.07908 +#> k_M23 0.01721 0.007298 0.04061 +#> k_M27 0.02100 0.014027 0.03144 +#> k_M31 0.01882 0.011375 0.03112 +#> f_DMTA_to_M23 0.14608 NA NA +#> f_DMTA_to_M27 0.12077 NA NA +#> f_DMTA_to_M31 0.11123 NA NA #> #> Resulting formation fractions: #> ff -#> DMTA_M23 0.1450 -#> DMTA_M27 0.1206 -#> DMTA_M31 0.1101 -#> DMTA_sink 0.6243 +#> DMTA_M23 0.1461 +#> DMTA_M27 0.1208 +#> DMTA_M31 0.1112 +#> DMTA_sink 0.6219 #> #> Estimated disappearance times: #> DT50 DT90 -#> DMTA 14.59 48.45 -#> M23 40.52 134.62 -#> M27 32.99 109.60 -#> M31 37.11 123.26 +#> DMTA 14.68 48.76 +#> M23 40.27 133.76 +#> M27 33.01 109.65 +#> M31 36.84 122.38 # As the confidence interval for the random effects of DMTA_0 # includes zero, we could try an alternative model without # such random effects diff --git a/docs/dev/reference/ds_mixed-1.png b/docs/dev/reference/ds_mixed-1.png new file mode 100644 index 00000000..a7f5c395 Binary files /dev/null and b/docs/dev/reference/ds_mixed-1.png differ diff --git a/docs/dev/reference/ds_mixed.html b/docs/dev/reference/ds_mixed.html new file mode 100644 index 00000000..09a6cc8c --- /dev/null +++ b/docs/dev/reference/ds_mixed.html @@ -0,0 +1,240 @@ + +Synthetic data for hierarchical kinetic degradation models — ds_mixed • mkin + + +
    +
    + + + +
    +
    + + +
    +

    The R code used to create this data object is installed with this package in +the 'dataset_generation' directory.

    +
    + + + +
    +

    Examples

    +
    # \dontrun{
    +  sfo_mmkin <- mmkin("SFO", ds_sfo, quiet = TRUE, error_model = "tc", cores = 15)
    +  sfo_saem <- saem(sfo_mmkin, no_random_effect = "parent_0")
    +  plot(sfo_saem)
    +
    +# }
    +
    +# This is the code used to generate the datasets
    +cat(readLines(system.file("dataset_generation/ds_mixed.R", package = "mkin")), sep = "\n")
    +#> # Synthetic data for hierarchical kinetic models
    +#> # Refactored version of the code previously in tests/testthat/setup_script.R
    +#> # The number of datasets was 3 for FOMC, and 10 for HS in that script, now it
    +#> # is always 15 for consistency
    +#> 
    +#> library(mkin)  # We use mkinmod and mkinpredict
    +#> sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +#> n <- 15
    +#> log_sd <- 0.3
    +#> err_1 = list(const = 1, prop = 0.05)
    +#> tc <- function(value) sigma_twocomp(value, err_1$const, err_1$prop)
    +#> const <- function(value) 2
    +#> 
    +#> set.seed(123456)
    +#> SFO <- mkinmod(parent = mkinsub("SFO"))
    +#> sfo_pop <- list(parent_0 = 100, k_parent = 0.03)
    +#> sfo_parms <- as.matrix(data.frame(
    +#>     k_parent = rlnorm(n, log(sfo_pop$k_parent), log_sd)))
    +#> set.seed(123456)
    +#> ds_sfo <- lapply(1:n, function(i) {
    +#>   ds_mean <- mkinpredict(SFO, sfo_parms[i, ],
    +#>     c(parent = sfo_pop$parent_0), sampling_times)
    +#>   add_err(ds_mean, tc, n = 1)[[1]]
    +#> })
    +#> attr(ds_sfo, "pop") <- sfo_pop
    +#> attr(ds_sfo, "parms") <- sfo_parms
    +#> 
    +#> set.seed(123456)
    +#> FOMC <- mkinmod(parent = mkinsub("FOMC"))
    +#> fomc_pop <- list(parent_0 = 100, alpha = 2, beta = 8)
    +#> fomc_parms <- as.matrix(data.frame(
    +#>     alpha = rlnorm(n, log(fomc_pop$alpha), 0.4),
    +#>     beta = rlnorm(n, log(fomc_pop$beta), 0.2)))
    +#> set.seed(123456)
    +#> ds_fomc <- lapply(1:n, function(i) {
    +#>   ds_mean <- mkinpredict(FOMC, fomc_parms[i, ],
    +#>     c(parent = fomc_pop$parent_0), sampling_times)
    +#>   add_err(ds_mean, tc, n = 1)[[1]]
    +#> })
    +#> attr(ds_fomc, "pop") <- fomc_pop
    +#> attr(ds_fomc, "parms") <- fomc_parms
    +#> 
    +#> set.seed(123456)
    +#> DFOP <- mkinmod(parent = mkinsub("DFOP"))
    +#> dfop_pop <- list(parent_0 = 100, k1 = 0.06, k2 = 0.015, g = 0.4)
    +#> dfop_parms <- as.matrix(data.frame(
    +#>   k1 = rlnorm(n, log(dfop_pop$k1), log_sd),
    +#>   k2 = rlnorm(n, log(dfop_pop$k2), log_sd),
    +#>   g = plogis(rnorm(n, qlogis(dfop_pop$g), log_sd))))
    +#> set.seed(123456)
    +#> ds_dfop <- lapply(1:n, function(i) {
    +#>   ds_mean <- mkinpredict(DFOP, dfop_parms[i, ],
    +#>     c(parent = dfop_pop$parent_0), sampling_times)
    +#>   add_err(ds_mean, tc, n = 1)[[1]]
    +#> })
    +#> attr(ds_dfop, "pop") <- dfop_pop
    +#> attr(ds_dfop, "parms") <- dfop_parms
    +#> 
    +#> set.seed(123456)
    +#> HS <- mkinmod(parent = mkinsub("HS"))
    +#> hs_pop <- list(parent_0 = 100, k1 = 0.08, k2 = 0.01, tb = 15)
    +#> hs_parms <- as.matrix(data.frame(
    +#>   k1 = rlnorm(n, log(hs_pop$k1), log_sd),
    +#>   k2 = rlnorm(n, log(hs_pop$k2), log_sd),
    +#>   tb = rlnorm(n, log(hs_pop$tb), 0.1)))
    +#> set.seed(123456)
    +#> ds_hs <- lapply(1:n, function(i) {
    +#>   ds_mean <- mkinpredict(HS, hs_parms[i, ],
    +#>     c(parent = hs_pop$parent_0), sampling_times)
    +#>   add_err(ds_mean, const, n = 1)[[1]]
    +#> })
    +#> attr(ds_hs, "pop") <- hs_pop
    +#> attr(ds_hs, "parms") <- hs_parms
    +#> 
    +#> set.seed(123456)
    +#> DFOP_SFO <- mkinmod(
    +#>   parent = mkinsub("DFOP", "m1"),
    +#>   m1 = mkinsub("SFO"),
    +#>   quiet = TRUE)
    +#> dfop_sfo_pop <- list(parent_0 = 100,
    +#>   k_m1 = 0.007, f_parent_to_m1 = 0.5,
    +#>   k1 = 0.1, k2 = 0.02, g = 0.5)
    +#> dfop_sfo_parms <- as.matrix(data.frame(
    +#>   k1 = rlnorm(n, log(dfop_sfo_pop$k1), log_sd),
    +#>   k2 = rlnorm(n, log(dfop_sfo_pop$k2), log_sd),
    +#>   g = plogis(rnorm(n, qlogis(dfop_sfo_pop$g), log_sd)),
    +#>   f_parent_to_m1 = plogis(rnorm(n,
    +#>       qlogis(dfop_sfo_pop$f_parent_to_m1), log_sd)),
    +#>   k_m1 = rlnorm(n, log(dfop_sfo_pop$k_m1), log_sd)))
    +#> ds_dfop_sfo_mean <- lapply(1:n,
    +#>   function(i) {
    +#>     mkinpredict(DFOP_SFO, dfop_sfo_parms[i, ],
    +#>       c(parent = dfop_sfo_pop$parent_0, m1 = 0), sampling_times)
    +#>   }
    +#> )
    +#> set.seed(123456)
    +#> ds_dfop_sfo <- lapply(ds_dfop_sfo_mean, function(ds) {
    +#>   add_err(ds,
    +#>     sdfunc = function(value) sqrt(err_1$const^2 + value^2 * err_1$prop^2),
    +#>     n = 1, secondary = "m1")[[1]]
    +#> })
    +#> attr(ds_dfop_sfo, "pop") <- dfop_sfo_pop
    +#> attr(ds_dfop_sfo, "parms") <- dfop_sfo_parms
    +#> 
    +#> #save(ds_sfo, ds_fomc, ds_dfop, ds_hs, ds_dfop_sfo, file = "data/ds_mixed.rda", version = 2)
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.0.6.

    +
    + +
    + + + + + + + + diff --git a/docs/dev/reference/endpoints.html b/docs/dev/reference/endpoints.html index e8198521..f8064098 100644 --- a/docs/dev/reference/endpoints.html +++ b/docs/dev/reference/endpoints.html @@ -23,7 +23,7 @@ advantage that the SFORB model can also be used for metabolites."> mkin - 1.2.0 + 1.2.2 @@ -65,7 +65,10 @@ advantage that the SFORB model can also be used for metabolites.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/experimental_data_for_UBA-1.png b/docs/dev/reference/experimental_data_for_UBA-1.png index 33946ded..b7b4d63b 100644 Binary files a/docs/dev/reference/experimental_data_for_UBA-1.png and b/docs/dev/reference/experimental_data_for_UBA-1.png differ diff --git a/docs/dev/reference/experimental_data_for_UBA.html b/docs/dev/reference/experimental_data_for_UBA.html index 9904370f..a51ace27 100644 --- a/docs/dev/reference/experimental_data_for_UBA.html +++ b/docs/dev/reference/experimental_data_for_UBA.html @@ -1,46 +1,5 @@ - - - - - - - -Experimental datasets used for development and testing of error models — experimental_data_for_UBA_2019 • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Experimental datasets used for development and testing of error models — experimental_data_for_UBA_2019 • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    experimental_data_for_UBA_2019
    +
    +
    experimental_data_for_UBA_2019
    +
    +
    +

    Format

    +

    A list containing twelve datasets as an R6 class defined by mkinds, + each containing, among others, the following components

    title
    +

    The name of the dataset, e.g. Soil 1

    -

    Format

    +
    data
    +

    A data frame with the data in the form expected by mkinfit

    -

    A list containing twelve datasets as an R6 class defined by mkinds, - each containing, among others, the following components

    -
    title

    The name of the dataset, e.g. Soil 1

    -
    data

    A data frame with the data in the form expected by mkinfit

    -
    - -

    Source

    - +
    +
    +

    Source

    Austria (2015). Ethofumesate Renewal Assessment Report Volume 3 Annex B.8 (AS)

    Belgium (2014). Isofetamid (IKF-5411) Draft Assessment Report Volume 3 Annex B.8 (AS)

    France (2015). Imazamox Draft Renewal Assessment Report Volume 3 Annex B.8 (AS)

    -

    FOCUS (2014) “Generic guidance for Estimating Persistence and +

    FOCUS (2014) “Generic guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU - Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Registration” Report of the FOCUS Work Group on Degradation Kinetics, Version 1.1, 18 December 2014 - http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    Germany (2013). Renewal Assessment Report Glyphosate Volume 3 Annex B.8: Environmental Fate and Behaviour

    Hellas (2013). Renewal Assessment Report 2,4-D Volume 3 Annex B.8: Fate and behaviour in the @@ -236,70 +184,75 @@ Dataset 12 is from the Renewal Assessment Report (RAR) for thifensulfuron-methyl

    United Kingdom (2014). Thifensulfuron-methyl - Annex B.8 (Volume 3) to the Report and Proposed Decision of the United Kingdom made to the European Commission under Regulation (EC) No. 1141/2010 for renewal of an active substance

    +
    -

    Examples

    -
    # \dontrun{ - -# Model definitions -sfo_sfo <- mkinmod( - parent = mkinsub("SFO", to = "A1"), - A1 = mkinsub("SFO"), - use_of_ff = "max" -) -
    #> Temporary DLL for differentials generated and loaded
    -dfop_sfo <- mkinmod( - parent = mkinsub("DFOP", to = "A1"), - A1 = mkinsub("SFO"), - use_of_ff = "max" -) -
    #> Temporary DLL for differentials generated and loaded
    -sfo_sfo_sfo <- mkinmod( - parent = mkinsub("SFO", to = "A1"), - A1 = mkinsub("SFO", to = "A2"), - A2 = mkinsub("SFO"), - use_of_ff = "max" -) -
    #> Temporary DLL for differentials generated and loaded
    -dfop_sfo_sfo <- mkinmod( - parent = mkinsub("DFOP", to = "A1"), - A1 = mkinsub("SFO", to = "A2"), - A2 = mkinsub("SFO"), - use_of_ff = "max" -) -
    #> Temporary DLL for differentials generated and loaded
    d_1_2 <- lapply(experimental_data_for_UBA_2019[1:2], function(x) x$data) -names(d_1_2) <- paste("Soil", 1:2) - - -f_1_2_tc <- mmkin(list("DFOP-SFO-SFO" = dfop_sfo_sfo), d_1_2, error_model = "tc") - -plot(f_1_2_tc, resplot = "errmod") -
    -# }
    +
    +

    Examples

    +
    # \dontrun{
    +
    +# Model definitions
    +sfo_sfo <- mkinmod(
    +  parent = mkinsub("SFO", to = "A1"),
    +  A1 = mkinsub("SFO"),
    +  use_of_ff = "max"
    +)
    +#> Temporary DLL for differentials generated and loaded
    +
    +dfop_sfo <- mkinmod(
    +  parent = mkinsub("DFOP", to = "A1"),
    +  A1 = mkinsub("SFO"),
    +  use_of_ff = "max"
    +)
    +#> Temporary DLL for differentials generated and loaded
    +
    +sfo_sfo_sfo <- mkinmod(
    +  parent = mkinsub("SFO", to = "A1"),
    +  A1 = mkinsub("SFO", to = "A2"),
    +  A2 = mkinsub("SFO"),
    +  use_of_ff = "max"
    +)
    +#> Temporary DLL for differentials generated and loaded
    +
    +dfop_sfo_sfo <- mkinmod(
    +  parent = mkinsub("DFOP", to = "A1"),
    +  A1 = mkinsub("SFO", to = "A2"),
    +  A2 = mkinsub("SFO"),
    +  use_of_ff = "max"
    +)
    +#> Temporary DLL for differentials generated and loaded
    +d_1_2 <- lapply(experimental_data_for_UBA_2019[1:2], function(x) x$data)
    +names(d_1_2) <- paste("Soil", 1:2)
    +
    +
    +f_1_2_tc <- mmkin(list("DFOP-SFO-SFO" = dfop_sfo_sfo), d_1_2, error_model = "tc")
    +
    +plot(f_1_2_tc, resplot = "errmod")
    +
    +
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/f_time_norm_focus.html b/docs/dev/reference/f_time_norm_focus.html index 852e00a0..b556df04 100644 --- a/docs/dev/reference/f_time_norm_focus.html +++ b/docs/dev/reference/f_time_norm_focus.html @@ -1,68 +1,13 @@ - - - - - - - -Normalisation factors for aerobic soil degradation according to FOCUS guidance — f_time_norm_focus • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Normalisation factors for aerobic soil degradation according to FOCUS guidance — f_time_norm_focus • mkin - + + - - - -
    -
    - -
    - -
    +
    @@ -149,137 +94,138 @@ in Appendix 8 to the FOCUS kinetics guidance (FOCUS 2014, p. 369)." /> in Appendix 8 to the FOCUS kinetics guidance (FOCUS 2014, p. 369).

    -
    f_time_norm_focus(object, ...)
    -
    -# S3 method for numeric
    -f_time_norm_focus(
    -  object,
    -  moisture = NA,
    -  field_moisture = NA,
    -  temperature = object,
    -  Q10 = 2.58,
    -  walker = 0.7,
    -  f_na = NA,
    -  ...
    -)
    -
    -# S3 method for mkindsg
    -f_time_norm_focus(
    -  object,
    -  study_moisture_ref_source = c("auto", "meta", "focus"),
    -  Q10 = 2.58,
    -  walker = 0.7,
    -  f_na = NA,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    object

    An object containing information used for the calculations

    ...

    Currently not used

    moisture

    Numeric vector of moisture contents in \% w/w

    field_moisture

    Numeric vector of moisture contents at field capacity -(pF2) in \% w/w

    temperature

    Numeric vector of temperatures in °C

    Q10

    The Q10 value used for temperature normalisation

    walker

    The Walker exponent used for moisture normalisation

    f_na

    The factor to use for NA values. If set to NA, only factors -for complete cases will be returned.

    study_moisture_ref_source

    Source for the reference value +

    +
    f_time_norm_focus(object, ...)
    +
    +# S3 method for numeric
    +f_time_norm_focus(
    +  object,
    +  moisture = NA,
    +  field_moisture = NA,
    +  temperature = object,
    +  Q10 = 2.58,
    +  walker = 0.7,
    +  f_na = NA,
    +  ...
    +)
    +
    +# S3 method for mkindsg
    +f_time_norm_focus(
    +  object,
    +  study_moisture_ref_source = c("auto", "meta", "focus"),
    +  Q10 = 2.58,
    +  walker = 0.7,
    +  f_na = NA,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    object
    +

    An object containing information used for the calculations

    + + +
    ...
    +

    Currently not used

    + + +
    moisture
    +

    Numeric vector of moisture contents in \% w/w

    + + +
    field_moisture
    +

    Numeric vector of moisture contents at field capacity +(pF2) in \% w/w

    + + +
    temperature
    +

    Numeric vector of temperatures in °C

    + + +
    Q10
    +

    The Q10 value used for temperature normalisation

    + + +
    walker
    +

    The Walker exponent used for moisture normalisation

    + + +
    f_na
    +

    The factor to use for NA values. If set to NA, only factors +for complete cases will be returned.

    + + +
    study_moisture_ref_source
    +

    Source for the reference value used to calculate the study moisture. If 'auto', preference is given to a reference moisture given in the meta information, otherwise -the focus soil moisture for the soil class is used

    +the focus soil moisture for the soil class is used

    -

    References

    - -

    FOCUS (2006) “Guidance Document on Estimating Persistence +

    +
    +

    References

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in -EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, +EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics -FOCUS (2014) “Generic guidance for Estimating Persistence +http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics +FOCUS (2014) “Generic guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in -EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, +EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, Version 1.1, 18 December 2014 -http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    -

    See also

    - - - -

    Examples

    -
    f_time_norm_focus(25, 20, 25) # 1.37, compare FOCUS 2014 p. 184 -
    #> [1] 1.373956
    -D24_2014$meta -
    #> study usda_soil_type study_moisture_ref_type -#> Mississippi Cohen 1991 Silt loam <NA> -#> Fayette Liu and Adelfinskaya 2011 Silt loam pF1 -#> RefSol 03-G Liu and Adelfinskaya 2011 Loam pF1 -#> Site E1 Liu and Adelfinskaya 2011 Loam pF1 -#> Site I2 Liu and Adelfinskaya 2011 Loamy sand pF1 -#> rel_moisture temperature -#> Mississippi NA 25 -#> Fayette 0.5 20 -#> RefSol 03-G 0.5 20 -#> Site E1 0.5 20 -#> Site I2 0.5 20
    # No moisture normalisation in the first dataset, so we use f_na = 1 to get -# temperature only normalisation as in the EU evaluation -f_time_norm_focus(D24_2014, study_moisture_ref_source = "focus", f_na = 1) -
    #> $time_norm was set to -#> [1] 1.6062378 0.7118732 0.7156063 0.7156063 0.8977124
    +http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    +
    +

    See also

    + +
    + +
    +

    Examples

    +
    f_time_norm_focus(25, 20, 25) # 1.37, compare FOCUS 2014 p. 184
    +#> [1] 1.373956
    +
    +D24_2014$meta
    +#>                                 study usda_soil_type study_moisture_ref_type
    +#> Mississippi                Cohen 1991      Silt loam                    <NA>
    +#> Fayette     Liu and Adelfinskaya 2011      Silt loam                     pF1
    +#> RefSol 03-G Liu and Adelfinskaya 2011           Loam                     pF1
    +#> Site E1     Liu and Adelfinskaya 2011           Loam                     pF1
    +#> Site I2     Liu and Adelfinskaya 2011     Loamy sand                     pF1
    +#>             rel_moisture temperature
    +#> Mississippi           NA          25
    +#> Fayette              0.5          20
    +#> RefSol 03-G          0.5          20
    +#> Site E1              0.5          20
    +#> Site I2              0.5          20
    +# No moisture normalisation in the first dataset, so we use f_na = 1 to get
    +# temperature only normalisation as in the EU evaluation
    +f_time_norm_focus(D24_2014, study_moisture_ref_source = "focus", f_na = 1)
    +#> $f_time_norm was (re)set to normalised values
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/focus_soil_moisture.html b/docs/dev/reference/focus_soil_moisture.html index 0e6fea28..99b4735a 100644 --- a/docs/dev/reference/focus_soil_moisture.html +++ b/docs/dev/reference/focus_soil_moisture.html @@ -1,68 +1,13 @@ - - - - - - - -FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar — focus_soil_moisture • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar — focus_soil_moisture • mkin - - + + - - -
    -
    - -
    - -
    +
    @@ -149,58 +94,60 @@ corresponds to pF2, MWHC to pF 1 and 1/3 bar to pF 2.5." /> corresponds to pF2, MWHC to pF 1 and 1/3 bar to pF 2.5.

    -
    focus_soil_moisture
    - - -

    Format

    +
    +
    focus_soil_moisture
    +
    +
    +

    Format

    A matrix with upper case USDA soil classes as row names, and water tension ('pF1', 'pF2', 'pF 2.5') as column names

    -

    Source

    - +
    +
    +

    Source

    Anonymous (2014) Generic Guidance for Tier 1 FOCUS Ground Water Assessment -Version 2.2, May 2014 https://esdac.jrc.ec.europa.eu/projects/ground-water

    - -

    Examples

    -
    focus_soil_moisture -
    #> pF1 pF2 pF2.5 -#> Sand 24 12 7 -#> Loamy sand 24 14 9 -#> Sandy loam 27 19 15 -#> Sandy clay loam 28 22 18 -#> Clay loam 32 28 25 -#> Loam 31 25 21 -#> Silt loam 32 26 21 -#> Silty clay loam 34 30 27 -#> Silt 31 27 21 -#> Sandy clay 41 35 31 -#> Silty clay 44 40 36 -#> Clay 53 48 43
    +Version 2.2, May 2014 https://esdac.jrc.ec.europa.eu/projects/ground-water

    +
    + +
    +

    Examples

    +
    focus_soil_moisture
    +#>                 pF1 pF2 pF2.5
    +#> Sand             24  12     7
    +#> Loamy sand       24  14     9
    +#> Sandy loam       27  19    15
    +#> Sandy clay loam  28  22    18
    +#> Clay loam        32  28    25
    +#> Loam             31  25    21
    +#> Silt loam        32  26    21
    +#> Silty clay loam  34  30    27
    +#> Silt             31  27    21
    +#> Sandy clay       41  35    31
    +#> Silty clay       44  40    36
    +#> Clay             53  48    43
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/get_deg_func.html b/docs/dev/reference/get_deg_func.html index fb661085..a5a77f37 100644 --- a/docs/dev/reference/get_deg_func.html +++ b/docs/dev/reference/get_deg_func.html @@ -1,67 +1,12 @@ - - - - - - - -Retrieve a degradation function from the mmkin namespace — get_deg_func • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Retrieve a degradation function from the mmkin namespace — get_deg_func • mkin - + + - - - -
    -
    - -
    - -
    +
    @@ -147,39 +92,39 @@

    Retrieve a degradation function from the mmkin namespace

    -
    get_deg_func()
    - +
    +
    get_deg_func()
    +
    -

    Value

    +
    +

    Value

    + -

    A function that was likely previously assigned from within +

    A function that was likely previously assigned from within nlme.mmkin

    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/illparms.html b/docs/dev/reference/illparms.html index c0de4115..8fe71568 100644 --- a/docs/dev/reference/illparms.html +++ b/docs/dev/reference/illparms.html @@ -21,7 +21,7 @@ without parameter transformations is used."> mkin - 1.2.0 + 1.2.2 @@ -63,7 +63,10 @@ without parameter transformations is used.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/ilr.html b/docs/dev/reference/ilr.html index 452647d6..c1396303 100644 --- a/docs/dev/reference/ilr.html +++ b/docs/dev/reference/ilr.html @@ -1,68 +1,13 @@ - - - - - - - -Function to perform isometric log-ratio transformation — ilr • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function to perform isometric log-ratio transformation — ilr • mkin + + - - - - -
    -
    - -
    - -
    +
    @@ -149,86 +94,100 @@ transformations." /> transformations.

    -
    ilr(x)
    -
    -invilr(x)
    +
    +
    ilr(x)
    +
    +invilr(x)
    +
    -

    Arguments

    - - - - - - -
    x

    A numeric vector. Naturally, the forward transformation is only -sensible for vectors with all elements being greater than zero.

    +
    +

    Arguments

    +
    x
    +

    A numeric vector. Naturally, the forward transformation is only +sensible for vectors with all elements being greater than zero.

    -

    Value

    +
    +
    +

    Value

    + -

    The result of the forward or backward transformation. The returned +

    The result of the forward or backward transformation. The returned components always sum to 1 for the case of the inverse log-ratio transformation.

    -

    References

    - +
    +
    +

    References

    Peter Filzmoser, Karel Hron (2008) Outlier Detection for Compositional Data Using Robust Methods. Math Geosci 40 233-248

    -

    See also

    - -

    Another implementation can be found in R package +

    +
    +

    See also

    +

    Another implementation can be found in R package robCompositions.

    -

    Author

    - +
    +
    +

    Author

    René Lehmann and Johannes Ranke

    +
    -

    Examples

    -
    -# Order matters -ilr(c(0.1, 1, 10)) -
    #> [1] -1.628174 -2.820079
    ilr(c(10, 1, 0.1)) -
    #> [1] 1.628174 2.820079
    # Equal entries give ilr transformations with zeros as elements -ilr(c(3, 3, 3)) -
    #> [1] 0 0
    # Almost equal entries give small numbers -ilr(c(0.3, 0.4, 0.3)) -
    #> [1] -0.2034219 0.1174457
    # Only the ratio between the numbers counts, not their sum -invilr(ilr(c(0.7, 0.29, 0.01))) -
    #> [1] 0.70 0.29 0.01
    invilr(ilr(2.1 * c(0.7, 0.29, 0.01))) -
    #> [1] 0.70 0.29 0.01
    # Inverse transformation of larger numbers gives unequal elements -invilr(-10) -
    #> [1] 7.213536e-07 9.999993e-01
    invilr(c(-10, 0)) -
    #> [1] 7.207415e-07 9.991507e-01 8.486044e-04
    # The sum of the elements of the inverse ilr is 1 -sum(invilr(c(-10, 0))) -
    #> [1] 1
    # This is why we do not need all elements of the inverse transformation to go back: -a <- c(0.1, 0.3, 0.5) -b <- invilr(a) -length(b) # Four elements -
    #> [1] 4
    ilr(c(b[1:3], 1 - sum(b[1:3]))) # Gives c(0.1, 0.3, 0.5) -
    #> [1] 0.1 0.3 0.5
    -
    +
    +

    Examples

    +
    
    +# Order matters
    +ilr(c(0.1, 1, 10))
    +#> [1] -1.628174 -2.820079
    +ilr(c(10, 1, 0.1))
    +#> [1] 1.628174 2.820079
    +# Equal entries give ilr transformations with zeros as elements
    +ilr(c(3, 3, 3))
    +#> [1] 0 0
    +# Almost equal entries give small numbers
    +ilr(c(0.3, 0.4, 0.3))
    +#> [1] -0.2034219  0.1174457
    +# Only the ratio between the numbers counts, not their sum
    +invilr(ilr(c(0.7, 0.29, 0.01)))
    +#> [1] 0.70 0.29 0.01
    +invilr(ilr(2.1 * c(0.7, 0.29, 0.01)))
    +#> [1] 0.70 0.29 0.01
    +# Inverse transformation of larger numbers gives unequal elements
    +invilr(-10)
    +#> [1] 7.213536e-07 9.999993e-01
    +invilr(c(-10, 0))
    +#> [1] 7.207415e-07 9.991507e-01 8.486044e-04
    +# The sum of the elements of the inverse ilr is 1
    +sum(invilr(c(-10, 0)))
    +#> [1] 1
    +# This is why we do not need all elements of the inverse transformation to go back:
    +a <- c(0.1, 0.3, 0.5)
    +b <- invilr(a)
    +length(b) # Four elements
    +#> [1] 4
    +ilr(c(b[1:3], 1 - sum(b[1:3]))) # Gives c(0.1, 0.3, 0.5)
    +#> [1] 0.1 0.3 0.5
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index 5a0ec596..794126cf 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -17,7 +17,7 @@ mkin - 1.2.0 + 1.2.2 @@ -268,9 +268,9 @@ degradation models and one or more error models

    -

    focus_soil_moisture

    +

    ds_mixed ds_sfo ds_fomc ds_dfop ds_hs ds_dfop_sfo

    -

    FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar

    +

    Synthetic data for hierarchical kinetic degradation models

    D24_2014

    @@ -327,6 +327,10 @@ degradation models and one or more error models

    test_data_from_UBA_2014

    Three experimental datasets from two water sediment systems and one soil

    + +

    focus_soil_moisture

    + +

    FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar

    print(<mkinds>)

    diff --git a/docs/dev/reference/intervals.saem.mmkin.html b/docs/dev/reference/intervals.saem.mmkin.html index ee714ad0..e67d8da0 100644 --- a/docs/dev/reference/intervals.saem.mmkin.html +++ b/docs/dev/reference/intervals.saem.mmkin.html @@ -17,7 +17,7 @@ mkin - 1.1.2 + 1.2.2 @@ -44,11 +44,14 @@ Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -56,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/llhist.html b/docs/dev/reference/llhist.html index 314cb923..27e55455 100644 --- a/docs/dev/reference/llhist.html +++ b/docs/dev/reference/llhist.html @@ -18,7 +18,7 @@ original fit is shown as a red vertical line."> mkin - 1.2.0 + 1.2.2 @@ -60,7 +60,10 @@ original fit is shown as a red vertical line.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/loftest-1.png b/docs/dev/reference/loftest-1.png index d6006ecc..f1dc5fa7 100644 Binary files a/docs/dev/reference/loftest-1.png and b/docs/dev/reference/loftest-1.png differ diff --git a/docs/dev/reference/loftest-2.png b/docs/dev/reference/loftest-2.png index 4d0dc551..3f1015a9 100644 Binary files a/docs/dev/reference/loftest-2.png and b/docs/dev/reference/loftest-2.png differ diff --git a/docs/dev/reference/loftest-3.png b/docs/dev/reference/loftest-3.png index 6afd084b..d897c363 100644 Binary files a/docs/dev/reference/loftest-3.png and b/docs/dev/reference/loftest-3.png differ diff --git a/docs/dev/reference/loftest-4.png b/docs/dev/reference/loftest-4.png index f94eede1..ac44c162 100644 Binary files a/docs/dev/reference/loftest-4.png and b/docs/dev/reference/loftest-4.png differ diff --git a/docs/dev/reference/loftest-5.png b/docs/dev/reference/loftest-5.png index 43460a65..0847bbec 100644 Binary files a/docs/dev/reference/loftest-5.png and b/docs/dev/reference/loftest-5.png differ diff --git a/docs/dev/reference/loftest.html b/docs/dev/reference/loftest.html index 9dbd547d..57bd3ee5 100644 --- a/docs/dev/reference/loftest.html +++ b/docs/dev/reference/loftest.html @@ -1,70 +1,15 @@ - - - - - - - -Lack-of-fit test for models fitted to data with replicates — loftest • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Lack-of-fit test for models fitted to data with replicates — loftest • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -150,216 +95,231 @@ lrtest.default from the lmtest package." />

    This is a generic function with a method currently only defined for mkinfit objects. It fits an anova model to the data contained in the object and compares the likelihoods using the likelihood ratio test -lrtest.default from the lmtest package.

    +lrtest.default from the lmtest package.

    -
    loftest(object, ...)
    +    
    +
    loftest(object, ...)
    +
    +# S3 method for mkinfit
    +loftest(object, ...)
    +
    -# S3 method for mkinfit -loftest(object, ...)
    +
    +

    Arguments

    +
    object
    +

    A model object with a defined loftest method

    -

    Arguments

    - - - - - - - - - - -
    object

    A model object with a defined loftest method

    ...

    Not used

    -

    Details

    +
    ...
    +

    Not used

    +
    +
    +

    Details

    The anova model is interpreted as the simplest form of an mkinfit model, assuming only a constant variance about the means, but not enforcing any structure of the means, so we have one model parameter for every mean of replicate samples.

    -

    See also

    - -

    lrtest

    +
    +
    +

    See also

    +

    lrtest

    +
    -

    Examples

    -
    # \dontrun{ -test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent") -sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE) -plot_res(sfo_fit) # We see a clear pattern in the residuals -
    loftest(sfo_fit) # We have a clear lack of fit -
    #> Likelihood ratio test -#> -#> Model 1: ANOVA with error model const -#> Model 2: SFO with error model const -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 10 -40.710 -#> 2 3 -63.954 -7 46.487 7.027e-08 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # -# We try a different model (the one that was used to generate the data) -dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE) -plot_res(dfop_fit) # We don't see systematic deviations, but heteroscedastic residuals -
    # therefore we should consider adapting the error model, although we have -loftest(dfop_fit) # no lack of fit -
    #> Likelihood ratio test -#> -#> Model 1: ANOVA with error model const -#> Model 2: DFOP with error model const -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 10 -40.710 -#> 2 5 -42.453 -5 3.485 0.6257
    # -# This is the anova model used internally for the comparison -test_data_anova <- test_data -test_data_anova$time <- as.factor(test_data_anova$time) -anova_fit <- lm(value ~ time, data = test_data_anova) -summary(anova_fit) -
    #> -#> Call: -#> lm(formula = value ~ time, data = test_data_anova) -#> -#> Residuals: -#> Min 1Q Median 3Q Max -#> -6.1000 -0.5625 0.0000 0.5625 6.1000 -#> -#> Coefficients: -#> Estimate Std. Error t value Pr(>|t|) -#> (Intercept) 103.150 2.323 44.409 7.44e-12 *** -#> time1 -19.950 3.285 -6.073 0.000185 *** -#> time3 -50.800 3.285 -15.465 8.65e-08 *** -#> time7 -68.500 3.285 -20.854 6.28e-09 *** -#> time14 -79.750 3.285 -24.278 1.63e-09 *** -#> time28 -86.000 3.285 -26.181 8.35e-10 *** -#> time60 -94.900 3.285 -28.891 3.48e-10 *** -#> time90 -98.500 3.285 -29.986 2.49e-10 *** -#> time120 -100.450 3.285 -30.580 2.09e-10 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -#> -#> Residual standard error: 3.285 on 9 degrees of freedom -#> Multiple R-squared: 0.9953, Adjusted R-squared: 0.9912 -#> F-statistic: 240.5 on 8 and 9 DF, p-value: 1.417e-09 -#>
    logLik(anova_fit) # We get the same likelihood and degrees of freedom -
    #> 'log Lik.' -40.71015 (df=10)
    # -test_data_2 <- synthetic_data_for_UBA_2014[[12]]$data -m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    sfo_lin_fit <- mkinfit(m_synth_SFO_lin, test_data_2, quiet = TRUE) -plot_res(sfo_lin_fit) # not a good model, we try parallel formation -
    loftest(sfo_lin_fit) -
    #> Likelihood ratio test -#> -#> Model 1: ANOVA with error model const -#> Model 2: m_synth_SFO_lin with error model const and fixed parameter(s) M1_0, M2_0 -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 28 -93.606 -#> 2 7 -171.927 -21 156.64 < 2.2e-16 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # -m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2")), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    sfo_par_fit <- mkinfit(m_synth_SFO_par, test_data_2, quiet = TRUE) -plot_res(sfo_par_fit) # much better for metabolites -
    loftest(sfo_par_fit) -
    #> Likelihood ratio test -#> -#> Model 1: ANOVA with error model const -#> Model 2: m_synth_SFO_par with error model const and fixed parameter(s) M1_0, M2_0 -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 28 -93.606 -#> 2 7 -156.331 -21 125.45 < 2.2e-16 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # -m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2")), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    dfop_par_fit <- mkinfit(m_synth_DFOP_par, test_data_2, quiet = TRUE) -plot_res(dfop_par_fit) # No visual lack of fit -
    loftest(dfop_par_fit) # no lack of fit found by the test -
    #> Likelihood ratio test -#> -#> Model 1: ANOVA with error model const -#> Model 2: m_synth_DFOP_par with error model const and fixed parameter(s) M1_0, M2_0 -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 28 -93.606 -#> 2 9 -102.763 -19 18.313 0.5016
    # -# The anova model used for comparison in the case of transformation products -test_data_anova_2 <- dfop_par_fit$data -test_data_anova_2$variable <- as.factor(test_data_anova_2$variable) -test_data_anova_2$time <- as.factor(test_data_anova_2$time) -anova_fit_2 <- lm(observed ~ time:variable - 1, data = test_data_anova_2) -summary(anova_fit_2) -
    #> -#> Call: -#> lm(formula = observed ~ time:variable - 1, data = test_data_anova_2) -#> -#> Residuals: -#> Min 1Q Median 3Q Max -#> -6.1000 -0.5875 0.0000 0.5875 6.1000 -#> -#> Coefficients: (2 not defined because of singularities) -#> Estimate Std. Error t value Pr(>|t|) -#> time0:variableparent 103.150 1.573 65.562 < 2e-16 *** -#> time1:variableparent 83.200 1.573 52.882 < 2e-16 *** -#> time3:variableparent 52.350 1.573 33.274 < 2e-16 *** -#> time7:variableparent 34.650 1.573 22.024 < 2e-16 *** -#> time14:variableparent 23.400 1.573 14.873 6.35e-14 *** -#> time28:variableparent 17.150 1.573 10.901 5.47e-11 *** -#> time60:variableparent 8.250 1.573 5.244 1.99e-05 *** -#> time90:variableparent 4.650 1.573 2.956 0.006717 ** -#> time120:variableparent 2.700 1.573 1.716 0.098507 . -#> time0:variableM1 NA NA NA NA -#> time1:variableM1 11.850 1.573 7.532 6.93e-08 *** -#> time3:variableM1 22.700 1.573 14.428 1.26e-13 *** -#> time7:variableM1 33.050 1.573 21.007 < 2e-16 *** -#> time14:variableM1 31.250 1.573 19.863 < 2e-16 *** -#> time28:variableM1 18.900 1.573 12.013 7.02e-12 *** -#> time60:variableM1 7.550 1.573 4.799 6.28e-05 *** -#> time90:variableM1 3.850 1.573 2.447 0.021772 * -#> time120:variableM1 2.050 1.573 1.303 0.204454 -#> time0:variableM2 NA NA NA NA -#> time1:variableM2 6.700 1.573 4.259 0.000254 *** -#> time3:variableM2 16.750 1.573 10.646 8.93e-11 *** -#> time7:variableM2 25.800 1.573 16.399 6.89e-15 *** -#> time14:variableM2 28.600 1.573 18.178 6.35e-16 *** -#> time28:variableM2 25.400 1.573 16.144 9.85e-15 *** -#> time60:variableM2 21.600 1.573 13.729 3.81e-13 *** -#> time90:variableM2 17.800 1.573 11.314 2.51e-11 *** -#> time120:variableM2 14.100 1.573 8.962 2.79e-09 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -#> -#> Residual standard error: 2.225 on 25 degrees of freedom -#> Multiple R-squared: 0.9979, Adjusted R-squared: 0.9957 -#> F-statistic: 469.2 on 25 and 25 DF, p-value: < 2.2e-16 -#>
    # } -
    +
    +

    Examples

    +
    # \dontrun{
    +test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent")
    +sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE)
    +plot_res(sfo_fit) # We see a clear pattern in the residuals
    +
    +loftest(sfo_fit)  # We have a clear lack of fit
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: ANOVA with error model const
    +#> Model 2: SFO with error model const
    +#>   #Df  LogLik Df  Chisq Pr(>Chisq)    
    +#> 1  10 -40.710                         
    +#> 2   3 -63.954 -7 46.487  7.027e-08 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +#
    +# We try a different model (the one that was used to generate the data)
    +dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE)
    +plot_res(dfop_fit) # We don't see systematic deviations, but heteroscedastic residuals
    +
    +# therefore we should consider adapting the error model, although we have
    +loftest(dfop_fit) # no lack of fit
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: ANOVA with error model const
    +#> Model 2: DFOP with error model const
    +#>   #Df  LogLik Df Chisq Pr(>Chisq)
    +#> 1  10 -40.710                    
    +#> 2   5 -42.453 -5 3.485     0.6257
    +#
    +# This is the anova model used internally for the comparison
    +test_data_anova <- test_data
    +test_data_anova$time <- as.factor(test_data_anova$time)
    +anova_fit <- lm(value ~ time, data = test_data_anova)
    +summary(anova_fit)
    +#> 
    +#> Call:
    +#> lm(formula = value ~ time, data = test_data_anova)
    +#> 
    +#> Residuals:
    +#>     Min      1Q  Median      3Q     Max 
    +#> -6.1000 -0.5625  0.0000  0.5625  6.1000 
    +#> 
    +#> Coefficients:
    +#>             Estimate Std. Error t value Pr(>|t|)    
    +#> (Intercept)  103.150      2.323  44.409 7.44e-12 ***
    +#> time1        -19.950      3.285  -6.073 0.000185 ***
    +#> time3        -50.800      3.285 -15.465 8.65e-08 ***
    +#> time7        -68.500      3.285 -20.854 6.28e-09 ***
    +#> time14       -79.750      3.285 -24.278 1.63e-09 ***
    +#> time28       -86.000      3.285 -26.181 8.35e-10 ***
    +#> time60       -94.900      3.285 -28.891 3.48e-10 ***
    +#> time90       -98.500      3.285 -29.986 2.49e-10 ***
    +#> time120     -100.450      3.285 -30.580 2.09e-10 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +#> 
    +#> Residual standard error: 3.285 on 9 degrees of freedom
    +#> Multiple R-squared:  0.9953,	Adjusted R-squared:  0.9912 
    +#> F-statistic: 240.5 on 8 and 9 DF,  p-value: 1.417e-09
    +#> 
    +logLik(anova_fit) # We get the same likelihood and degrees of freedom
    +#> 'log Lik.' -40.71015 (df=10)
    +#
    +test_data_2 <- synthetic_data_for_UBA_2014[[12]]$data
    +m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"),
    +  M1 = list(type = "SFO", to = "M2"),
    +  M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +sfo_lin_fit <- mkinfit(m_synth_SFO_lin, test_data_2, quiet = TRUE)
    +plot_res(sfo_lin_fit) # not a good model, we try parallel formation
    +
    +loftest(sfo_lin_fit)
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: ANOVA with error model const
    +#> Model 2: m_synth_SFO_lin with error model const and fixed parameter(s) M1_0, M2_0
    +#>   #Df   LogLik  Df  Chisq Pr(>Chisq)    
    +#> 1  28  -93.606                          
    +#> 2   7 -171.927 -21 156.64  < 2.2e-16 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +#
    +m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2")),
    +  M1 = list(type = "SFO"),
    +  M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +sfo_par_fit <- mkinfit(m_synth_SFO_par, test_data_2, quiet = TRUE)
    +plot_res(sfo_par_fit) # much better for metabolites
    +
    +loftest(sfo_par_fit)
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: ANOVA with error model const
    +#> Model 2: m_synth_SFO_par with error model const and fixed parameter(s) M1_0, M2_0
    +#>   #Df   LogLik  Df  Chisq Pr(>Chisq)    
    +#> 1  28  -93.606                          
    +#> 2   7 -156.331 -21 125.45  < 2.2e-16 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +#
    +m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2")),
    +  M1 = list(type = "SFO"),
    +  M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +dfop_par_fit <- mkinfit(m_synth_DFOP_par, test_data_2, quiet = TRUE)
    +plot_res(dfop_par_fit) # No visual lack of fit
    +
    +loftest(dfop_par_fit)  # no lack of fit found by the test
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: ANOVA with error model const
    +#> Model 2: m_synth_DFOP_par with error model const and fixed parameter(s) M1_0, M2_0
    +#>   #Df   LogLik  Df  Chisq Pr(>Chisq)
    +#> 1  28  -93.606                      
    +#> 2   9 -102.763 -19 18.313     0.5016
    +#
    +# The anova model used for comparison in the case of transformation products
    +test_data_anova_2 <- dfop_par_fit$data
    +test_data_anova_2$variable <- as.factor(test_data_anova_2$variable)
    +test_data_anova_2$time <- as.factor(test_data_anova_2$time)
    +anova_fit_2 <- lm(observed ~ time:variable - 1, data = test_data_anova_2)
    +summary(anova_fit_2)
    +#> 
    +#> Call:
    +#> lm(formula = observed ~ time:variable - 1, data = test_data_anova_2)
    +#> 
    +#> Residuals:
    +#>     Min      1Q  Median      3Q     Max 
    +#> -6.1000 -0.5875  0.0000  0.5875  6.1000 
    +#> 
    +#> Coefficients: (2 not defined because of singularities)
    +#>                        Estimate Std. Error t value Pr(>|t|)    
    +#> time0:variableparent    103.150      1.573  65.562  < 2e-16 ***
    +#> time1:variableparent     83.200      1.573  52.882  < 2e-16 ***
    +#> time3:variableparent     52.350      1.573  33.274  < 2e-16 ***
    +#> time7:variableparent     34.650      1.573  22.024  < 2e-16 ***
    +#> time14:variableparent    23.400      1.573  14.873 6.35e-14 ***
    +#> time28:variableparent    17.150      1.573  10.901 5.47e-11 ***
    +#> time60:variableparent     8.250      1.573   5.244 1.99e-05 ***
    +#> time90:variableparent     4.650      1.573   2.956 0.006717 ** 
    +#> time120:variableparent    2.700      1.573   1.716 0.098507 .  
    +#> time0:variableM1             NA         NA      NA       NA    
    +#> time1:variableM1         11.850      1.573   7.532 6.93e-08 ***
    +#> time3:variableM1         22.700      1.573  14.428 1.26e-13 ***
    +#> time7:variableM1         33.050      1.573  21.007  < 2e-16 ***
    +#> time14:variableM1        31.250      1.573  19.863  < 2e-16 ***
    +#> time28:variableM1        18.900      1.573  12.013 7.02e-12 ***
    +#> time60:variableM1         7.550      1.573   4.799 6.28e-05 ***
    +#> time90:variableM1         3.850      1.573   2.447 0.021772 *  
    +#> time120:variableM1        2.050      1.573   1.303 0.204454    
    +#> time0:variableM2             NA         NA      NA       NA    
    +#> time1:variableM2          6.700      1.573   4.259 0.000254 ***
    +#> time3:variableM2         16.750      1.573  10.646 8.93e-11 ***
    +#> time7:variableM2         25.800      1.573  16.399 6.89e-15 ***
    +#> time14:variableM2        28.600      1.573  18.178 6.35e-16 ***
    +#> time28:variableM2        25.400      1.573  16.144 9.85e-15 ***
    +#> time60:variableM2        21.600      1.573  13.729 3.81e-13 ***
    +#> time90:variableM2        17.800      1.573  11.314 2.51e-11 ***
    +#> time120:variableM2       14.100      1.573   8.962 2.79e-09 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +#> 
    +#> Residual standard error: 2.225 on 25 degrees of freedom
    +#> Multiple R-squared:  0.9979,	Adjusted R-squared:  0.9957 
    +#> F-statistic: 469.2 on 25 and 25 DF,  p-value: < 2.2e-16
    +#> 
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/logLik.mkinfit.html b/docs/dev/reference/logLik.mkinfit.html index 3e9452c6..e77121d1 100644 --- a/docs/dev/reference/logLik.mkinfit.html +++ b/docs/dev/reference/logLik.mkinfit.html @@ -1,71 +1,16 @@ - - - - - - - -Calculated the log-likelihood of a fitted mkinfit object — logLik.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calculated the log-likelihood of a fitted mkinfit object — logLik.mkinfit • mkin - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +

    This function returns the product of the likelihood densities of each observed value, as calculated as part of the fitting procedure using -dnorm, i.e. assuming normal distribution, and with the means +dnorm, i.e. assuming normal distribution, and with the means predicted by the degradation model, and the standard deviations predicted by the error model.

    -
    # S3 method for mkinfit
    -logLik(object, ...)
    - -

    Arguments

    - - - - - - - - - - -
    object

    An object of class mkinfit.

    ...

    For compatibility with the generic method

    - -

    Value

    - -

    An object of class logLik with the number of estimated +

    +
    # S3 method for mkinfit
    +logLik(object, ...)
    +
    + +
    +

    Arguments

    +
    object
    +

    An object of class mkinfit.

    + + +
    ...
    +

    For compatibility with the generic method

    + +
    +
    +

    Value

    + + +

    An object of class logLik with the number of estimated parameters (degradation model parameters plus variance model parameters) as attribute.

    -

    Details

    - +
    +
    +

    Details

    The total number of estimated parameters returned with the value of the likelihood is calculated as the sum of fitted degradation model parameters and the fitted error model parameters.

    -

    See also

    - -

    Compare the AIC of columns of mmkin objects using -AIC.mmkin.

    -

    Author

    - +
    +
    +

    See also

    +

    Compare the AIC of columns of mmkin objects using +AIC.mmkin.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    - # \dontrun{ - sfo_sfo <- mkinmod( - parent = mkinsub("SFO", to = "m1"), - m1 = mkinsub("SFO") - ) -
    #> Temporary DLL for differentials generated and loaded
    d_t <- subset(FOCUS_2006_D, value != 0) - f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity) - f_obs <- update(f_nw, error_model = "obs") - f_tc <- update(f_nw, error_model = "tc") - AIC(f_nw, f_obs, f_tc) -
    #> df AIC -#> f_nw 5 204.4486 -#> f_obs 6 205.8727 -#> f_tc 6 141.9656
    # } - -
    +
    +

    Examples

    +
    
    +  # \dontrun{
    +  sfo_sfo <- mkinmod(
    +    parent = mkinsub("SFO", to = "m1"),
    +    m1 = mkinsub("SFO")
    +  )
    +#> Temporary DLL for differentials generated and loaded
    +  d_t <- subset(FOCUS_2006_D, value != 0)
    +  f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
    +  f_obs <- update(f_nw, error_model = "obs")
    +  f_tc <- update(f_nw, error_model = "tc")
    +  AIC(f_nw, f_obs, f_tc)
    +#>       df      AIC
    +#> f_nw   5 204.4486
    +#> f_obs  6 205.8727
    +#> f_tc   6 141.9656
    +  # }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/logLik.saem.mmkin.html b/docs/dev/reference/logLik.saem.mmkin.html index ebef3b10..fc06b36f 100644 --- a/docs/dev/reference/logLik.saem.mmkin.html +++ b/docs/dev/reference/logLik.saem.mmkin.html @@ -17,7 +17,7 @@ mkin - 1.2.0 + 1.2.2 diff --git a/docs/dev/reference/logistic.solution.html b/docs/dev/reference/logistic.solution.html index 1d1880fd..ac4961bc 100644 --- a/docs/dev/reference/logistic.solution.html +++ b/docs/dev/reference/logistic.solution.html @@ -18,7 +18,7 @@ an increasing rate constant, supposedly caused by microbial growth"> mkin - 1.2.0 + 1.2.2 @@ -60,7 +60,10 @@ an increasing rate constant, supposedly caused by microbial growth">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/lrtest.mkinfit.html b/docs/dev/reference/lrtest.mkinfit.html index f2d8472e..a7198474 100644 --- a/docs/dev/reference/lrtest.mkinfit.html +++ b/docs/dev/reference/lrtest.mkinfit.html @@ -1,71 +1,16 @@ - - - - - - - -Likelihood ratio test for mkinfit models — lrtest.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Likelihood ratio test for mkinfit models — lrtest.mkinfit • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    @@ -155,115 +100,117 @@ that the models are nested, i.e. one of them has less degrees of freedom and can be expressed by fixing the parameters of the other.

    -
    # S3 method for mkinfit
    -lrtest(object, object_2 = NULL, ...)
    +    
    +
    # S3 method for mkinfit
    +lrtest(object, object_2 = NULL, ...)
    +
    +# S3 method for mmkin
    +lrtest(object, ...)
    +
    + +
    +

    Arguments

    +
    object
    +

    An mkinfit object, or an mmkin column +object containing two fits to the same data.

    + -# S3 method for mmkin -lrtest(object, ...)
    +
    object_2
    +

    Optionally, another mkinfit object fitted to the same data.

    -

    Arguments

    - - - - - - - - - - - - - - -
    object

    An mkinfit object, or an mmkin column -object containing two fits to the same data.

    object_2

    Optionally, another mkinfit object fitted to the same data.

    ...

    Argument to mkinfit, passed to -update.mkinfit for creating the alternative fitted object.

    -

    Details

    +
    ...
    +

    Argument to mkinfit, passed to +update.mkinfit for creating the alternative fitted object.

    +
    +
    +

    Details

    Alternatively, an argument to mkinfit can be given which is then passed -to update.mkinfit to obtain the alternative model.

    -

    The comparison is then made by the lrtest.default +to update.mkinfit to obtain the alternative model.

    +

    The comparison is then made by the lrtest.default method from the lmtest package. The model with the higher number of fitted parameters (alternative hypothesis) is listed first, then the model with the lower number of fitted parameters (null hypothesis).

    +
    -

    Examples

    -
    # \dontrun{ -test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent") -sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE) -dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE) -lrtest(dfop_fit, sfo_fit) -
    #> Likelihood ratio test -#> -#> Model 1: DFOP with error model const -#> Model 2: SFO with error model const -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 5 -42.453 -#> 2 3 -63.954 -2 43.002 4.594e-10 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    lrtest(sfo_fit, dfop_fit) -
    #> Likelihood ratio test -#> -#> Model 1: DFOP with error model const -#> Model 2: SFO with error model const -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 5 -42.453 -#> 2 3 -63.954 -2 43.002 4.594e-10 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    -# The following two examples are commented out as they fail during -# generation of the static help pages by pkgdown -#lrtest(dfop_fit, error_model = "tc") -#lrtest(dfop_fit, fixed_parms = c(k2 = 0)) - -# However, this equivalent syntax also works for static help pages -lrtest(dfop_fit, update(dfop_fit, error_model = "tc")) -
    #> Likelihood ratio test -#> -#> Model 1: DFOP with error model tc -#> Model 2: DFOP with error model const -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 6 -34.587 -#> 2 5 -42.453 -1 15.731 7.302e-05 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    lrtest(dfop_fit, update(dfop_fit, fixed_parms = c(k2 = 0))) -
    #> Likelihood ratio test -#> -#> Model 1: DFOP with error model const -#> Model 2: DFOP with error model const and fixed parameter(s) k2 -#> #Df LogLik Df Chisq Pr(>Chisq) -#> 1 5 -42.453 -#> 2 4 -57.340 -1 29.776 4.851e-08 *** -#> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # } -
    +
    +

    Examples

    +
    # \dontrun{
    +test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent")
    +sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE)
    +dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE)
    +lrtest(dfop_fit, sfo_fit)
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: DFOP with error model const
    +#> Model 2: SFO with error model const
    +#>   #Df  LogLik Df  Chisq Pr(>Chisq)    
    +#> 1   5 -42.453                         
    +#> 2   3 -63.954 -2 43.002  4.594e-10 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +lrtest(sfo_fit, dfop_fit)
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: DFOP with error model const
    +#> Model 2: SFO with error model const
    +#>   #Df  LogLik Df  Chisq Pr(>Chisq)    
    +#> 1   5 -42.453                         
    +#> 2   3 -63.954 -2 43.002  4.594e-10 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +
    +# The following two examples are commented out as they fail during
    +# generation of the static help pages by pkgdown
    +#lrtest(dfop_fit, error_model = "tc")
    +#lrtest(dfop_fit, fixed_parms = c(k2 = 0))
    +
    +# However, this equivalent syntax also works for static help pages
    +lrtest(dfop_fit, update(dfop_fit, error_model = "tc"))
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: DFOP with error model tc
    +#> Model 2: DFOP with error model const
    +#>   #Df  LogLik Df  Chisq Pr(>Chisq)    
    +#> 1   6 -34.587                         
    +#> 2   5 -42.453 -1 15.731  7.302e-05 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +lrtest(dfop_fit, update(dfop_fit, fixed_parms = c(k2 = 0)))
    +#> Likelihood ratio test
    +#> 
    +#> Model 1: DFOP with error model const
    +#> Model 2: DFOP with error model const and fixed parameter(s) k2
    +#>   #Df  LogLik Df  Chisq Pr(>Chisq)    
    +#> 1   5 -42.453                         
    +#> 2   4 -57.340 -1 29.776  4.851e-08 ***
    +#> ---
    +#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/max_twa_parent.html b/docs/dev/reference/max_twa_parent.html index a358568a..32ffaf6d 100644 --- a/docs/dev/reference/max_twa_parent.html +++ b/docs/dev/reference/max_twa_parent.html @@ -1,73 +1,18 @@ - - - - - - - -Function to calculate maximum time weighted average concentrations from -kinetic models fitted with mkinfit — max_twa_parent • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function to calculate maximum time weighted average concentrations from +kinetic models fitted with mkinfit — max_twa_parent • mkin - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +

    This function calculates maximum moving window time weighted average -concentrations (TWAs) for kinetic models fitted with mkinfit. +concentrations (TWAs) for kinetic models fitted with mkinfit. Currently, only calculations for the parent are implemented for the SFO, FOMC, DFOP and HS models, using the analytical formulas given in the PEC soil section of the FOCUS guidance.

    -
    max_twa_parent(fit, windows)
    +    
    +
    max_twa_parent(fit, windows)
    +
    +max_twa_sfo(M0 = 1, k, t)
    +
    +max_twa_fomc(M0 = 1, alpha, beta, t)
    +
    +max_twa_dfop(M0 = 1, k1, k2, g, t)
    +
    +max_twa_hs(M0 = 1, k1, k2, tb, t)
    +
    -max_twa_sfo(M0 = 1, k, t) +
    +

    Arguments

    +
    fit
    +

    An object of class mkinfit.

    -max_twa_fomc(M0 = 1, alpha, beta, t) -max_twa_dfop(M0 = 1, k1, k2, g, t) +
    windows
    +

    The width of the time windows for which the TWAs should be +calculated.

    -max_twa_hs(M0 = 1, k1, k2, tb, t)
    -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    An object of class mkinfit.

    windows

    The width of the time windows for which the TWAs should be -calculated.

    M0

    The initial concentration for which the maximum time weighted +

    M0
    +

    The initial concentration for which the maximum time weighted average over the decline curve should be calculated. The default is to use a value of 1, which means that a relative maximum time weighted average -factor (f_twa) is calculated.

    k

    The rate constant in the case of SFO kinetics.

    t

    The width of the time window.

    alpha

    Parameter of the FOMC model.

    beta

    Parameter of the FOMC model.

    k1

    The first rate constant of the DFOP or the HS kinetics.

    k2

    The second rate constant of the DFOP or the HS kinetics.

    g

    Parameter of the DFOP model.

    tb

    Parameter of the HS model.

    - -

    Value

    - -

    For max_twa_parent, a numeric vector, named using the +factor (f_twa) is calculated.

    + + +
    k
    +

    The rate constant in the case of SFO kinetics.

    + + +
    t
    +

    The width of the time window.

    + + +
    alpha
    +

    Parameter of the FOMC model.

    + + +
    beta
    +

    Parameter of the FOMC model.

    + + +
    k1
    +

    The first rate constant of the DFOP or the HS kinetics.

    + + +
    k2
    +

    The second rate constant of the DFOP or the HS kinetics.

    + + +
    g
    +

    Parameter of the DFOP model.

    + + +
    tb
    +

    Parameter of the HS model.

    + +
    +
    +

    Value

    + + +

    For max_twa_parent, a numeric vector, named using the windows argument. For the other functions, a numeric vector of length one (also known as 'a number').

    -

    References

    - -

    FOCUS (2006) “Guidance Document on Estimating Persistence +

    +
    +

    References

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in -EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, +EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    -

    Author

    - +http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    - fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) - max_twa_parent(fit, c(7, 21)) -
    #> 7 21 -#> 34.71343 18.22124
    -
    +
    +

    Examples

    +
    
    +  fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)
    +  max_twa_parent(fit, c(7, 21))
    +#>        7       21 
    +#> 34.71343 18.22124 
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mccall81_245T-1.png b/docs/dev/reference/mccall81_245T-1.png index 91fe060e..79c45fe6 100644 Binary files a/docs/dev/reference/mccall81_245T-1.png and b/docs/dev/reference/mccall81_245T-1.png differ diff --git a/docs/dev/reference/mccall81_245T.html b/docs/dev/reference/mccall81_245T.html index f79137be..26173c65 100644 --- a/docs/dev/reference/mccall81_245T.html +++ b/docs/dev/reference/mccall81_245T.html @@ -1,69 +1,14 @@ - - - - - - - -Datasets on aerobic soil metabolism of 2,4,5-T in six soils — mccall81_245T • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Datasets on aerobic soil metabolism of 2,4,5-T in six soils — mccall81_245T • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    mccall81_245T
    - - -

    Format

    +
    +
    mccall81_245T
    +
    -

    A dataframe containing the following variables.

    -
    name

    the name of the compound observed. Note that T245 is used as +

    +

    Format

    +

    A dataframe containing the following variables.

    name
    +

    the name of the compound observed. Note that T245 is used as an acronym for 2,4,5-T. T245 is a legitimate object name in R, which is necessary for specifying models using - mkinmod.

    -
    time

    a numeric vector containing sampling times in days after + mkinmod.

    + +
    time
    +

    a numeric vector containing sampling times in days after treatment

    -
    value

    a numeric vector containing concentrations in percent of applied radioactivity

    -
    soil

    a factor containing the name of the soil

    - -
    -

    Source

    +
    value
    +

    a numeric vector containing concentrations in percent of applied radioactivity

    + +
    soil
    +

    a factor containing the name of the soil

    + +
    +
    +

    Source

    McCall P, Vrona SA, Kelley SS (1981) Fate of uniformly carbon-14 ring labelled 2,4,5-Trichlorophenoxyacetic acid and 2,4-dichlorophenoxyacetic acid. J Agric Chem 29, 100-107 - doi: 10.1021/jf00103a026

    + doi:10.1021/jf00103a026

    +
    -

    Examples

    -
    SFO_SFO_SFO <- mkinmod(T245 = list(type = "SFO", to = "phenol"), - phenol = list(type = "SFO", to = "anisole"), - anisole = list(type = "SFO")) -
    #> Temporary DLL for differentials generated and loaded
    # \dontrun{ - fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    summary(fit.1)$bpar -
    #> Estimate se_notrans t value Pr(>t) -#> T245_0 1.038550e+02 2.1847074945 47.537272 4.472189e-18 -#> k_T245 4.337042e-02 0.0018983965 22.845818 2.276911e-13 -#> k_phenol 4.050581e-01 0.2986993563 1.356073 9.756989e-02 -#> k_anisole 6.678742e-03 0.0008021439 8.326114 2.623177e-07 -#> f_T245_to_phenol 6.227599e-01 0.3985340558 1.562627 6.949413e-02 -#> f_phenol_to_anisole 1.000000e+00 0.6718439825 1.488441 7.867789e-02 -#> sigma 2.514628e+00 0.4907558883 5.123989 6.233157e-05 -#> Lower Upper -#> T245_0 99.246061385 1.084640e+02 -#> k_T245 0.039631621 4.746194e-02 -#> k_phenol 0.218013879 7.525762e-01 -#> k_anisole 0.005370739 8.305299e-03 -#> f_T245_to_phenol 0.547559081 6.924813e-01 -#> f_phenol_to_anisole 0.000000000 1.000000e+00 -#> sigma 1.706607296 3.322649e+00
    endpoints(fit.1) -
    #> $ff -#> T245_phenol T245_sink phenol_anisole phenol_sink -#> 6.227599e-01 3.772401e-01 1.000000e+00 3.773626e-10 -#> -#> $distimes -#> DT50 DT90 -#> T245 15.982025 53.09114 -#> phenol 1.711229 5.68458 -#> anisole 103.784093 344.76329 -#>
    # formation fraction from phenol to anisol is practically 1. As we cannot - # fix formation fractions when using the ilr transformation, we can turn of - # the sink in the model generation - SFO_SFO_SFO_2 <- mkinmod(T245 = list(type = "SFO", to = "phenol"), - phenol = list(type = "SFO", to = "anisole", sink = FALSE), - anisole = list(type = "SFO")) -
    #> Temporary DLL for differentials generated and loaded
    fit.2 <- mkinfit(SFO_SFO_SFO_2, subset(mccall81_245T, soil == "Commerce"), - quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    summary(fit.2)$bpar -
    #> Estimate se_notrans t value Pr(>t) Lower -#> T245_0 1.038550e+02 2.1623653066 48.028439 4.993108e-19 99.271020284 -#> k_T245 4.337042e-02 0.0018343666 23.643268 3.573556e-14 0.039650976 -#> k_phenol 4.050582e-01 0.1177237473 3.440752 1.679254e-03 0.218746587 -#> k_anisole 6.678742e-03 0.0006829745 9.778903 1.872894e-08 0.005377083 -#> f_T245_to_phenol 6.227599e-01 0.0342197875 18.198824 2.039411e-12 0.547975637 -#> sigma 2.514628e+00 0.3790944250 6.633250 2.875782e-06 1.710983655 -#> Upper -#> T245_0 108.43904074 -#> k_T245 0.04743877 -#> k_phenol 0.75005585 -#> k_anisole 0.00829550 -#> f_T245_to_phenol 0.69212308 -#> sigma 3.31827222
    endpoints(fit.1) -
    #> $ff -#> T245_phenol T245_sink phenol_anisole phenol_sink -#> 6.227599e-01 3.772401e-01 1.000000e+00 3.773626e-10 -#> -#> $distimes -#> DT50 DT90 -#> T245 15.982025 53.09114 -#> phenol 1.711229 5.68458 -#> anisole 103.784093 344.76329 -#>
    plot_sep(fit.2) -
    # } -
    +
    +

    Examples

    +
      SFO_SFO_SFO <- mkinmod(T245 = list(type = "SFO", to = "phenol"),
    +    phenol = list(type = "SFO", to = "anisole"),
    +    anisole = list(type = "SFO"))
    +#> Temporary DLL for differentials generated and loaded
    +  # \dontrun{
    +    fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +    summary(fit.1)$bpar
    +#>                         Estimate   se_notrans   t value       Pr(>t)
    +#> T245_0              1.038550e+02 2.1847074945 47.537272 4.472189e-18
    +#> k_T245              4.337042e-02 0.0018983965 22.845818 2.276911e-13
    +#> k_phenol            4.050581e-01 0.2986993563  1.356073 9.756989e-02
    +#> k_anisole           6.678742e-03 0.0008021439  8.326114 2.623177e-07
    +#> f_T245_to_phenol    6.227599e-01 0.3985340558  1.562627 6.949413e-02
    +#> f_phenol_to_anisole 1.000000e+00 0.6718439825  1.488441 7.867789e-02
    +#> sigma               2.514628e+00 0.4907558883  5.123989 6.233157e-05
    +#>                            Lower        Upper
    +#> T245_0              99.246061385 1.084640e+02
    +#> k_T245               0.039631621 4.746194e-02
    +#> k_phenol             0.218013879 7.525762e-01
    +#> k_anisole            0.005370739 8.305299e-03
    +#> f_T245_to_phenol     0.547559081 6.924813e-01
    +#> f_phenol_to_anisole  0.000000000 1.000000e+00
    +#> sigma                1.706607296 3.322649e+00
    +    endpoints(fit.1)
    +#> $ff
    +#>    T245_phenol      T245_sink phenol_anisole    phenol_sink 
    +#>   6.227599e-01   3.772401e-01   1.000000e+00   3.773626e-10 
    +#> 
    +#> $distimes
    +#>               DT50      DT90
    +#> T245     15.982025  53.09114
    +#> phenol    1.711229   5.68458
    +#> anisole 103.784093 344.76329
    +#> 
    +    # formation fraction from phenol to anisol is practically 1. As we cannot
    +    # fix formation fractions when using the ilr transformation, we can turn of
    +    # the sink in the model generation
    +    SFO_SFO_SFO_2 <- mkinmod(T245 = list(type = "SFO", to = "phenol"),
    +      phenol = list(type = "SFO", to = "anisole", sink = FALSE),
    +      anisole = list(type = "SFO"))
    +#> Temporary DLL for differentials generated and loaded
    +    fit.2 <- mkinfit(SFO_SFO_SFO_2, subset(mccall81_245T, soil == "Commerce"),
    +      quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +    summary(fit.2)$bpar
    +#>                      Estimate   se_notrans   t value       Pr(>t)        Lower
    +#> T245_0           1.038550e+02 2.1623653066 48.028439 4.993108e-19 99.271020284
    +#> k_T245           4.337042e-02 0.0018343666 23.643268 3.573556e-14  0.039650976
    +#> k_phenol         4.050582e-01 0.1177237473  3.440752 1.679254e-03  0.218746587
    +#> k_anisole        6.678742e-03 0.0006829745  9.778903 1.872894e-08  0.005377083
    +#> f_T245_to_phenol 6.227599e-01 0.0342197875 18.198824 2.039411e-12  0.547975637
    +#> sigma            2.514628e+00 0.3790944250  6.633250 2.875782e-06  1.710983655
    +#>                         Upper
    +#> T245_0           108.43904074
    +#> k_T245             0.04743877
    +#> k_phenol           0.75005585
    +#> k_anisole          0.00829550
    +#> f_T245_to_phenol   0.69212308
    +#> sigma              3.31827222
    +    endpoints(fit.1)
    +#> $ff
    +#>    T245_phenol      T245_sink phenol_anisole    phenol_sink 
    +#>   6.227599e-01   3.772401e-01   1.000000e+00   3.773626e-10 
    +#> 
    +#> $distimes
    +#>               DT50      DT90
    +#> T245     15.982025  53.09114
    +#> phenol    1.711229   5.68458
    +#> anisole 103.784093 344.76329
    +#> 
    +    plot_sep(fit.2)
    +
    +  # }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mean_degparms.html b/docs/dev/reference/mean_degparms.html index 67db1868..feb37a1d 100644 --- a/docs/dev/reference/mean_degparms.html +++ b/docs/dev/reference/mean_degparms.html @@ -17,7 +17,7 @@ mkin - 1.1.2 + 1.2.2 @@ -44,11 +44,14 @@ Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -56,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/mhmkin.html b/docs/dev/reference/mhmkin.html index e87e20a1..e72d17f9 100644 --- a/docs/dev/reference/mhmkin.html +++ b/docs/dev/reference/mhmkin.html @@ -22,7 +22,7 @@ mixed-effects model fitting functions."> mkin - 1.2.0 + 1.2.2 @@ -64,7 +64,10 @@ mixed-effects model fitting functions.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/mixed-1.png b/docs/dev/reference/mixed-1.png index 54b81b70..dbba1b03 100644 Binary files a/docs/dev/reference/mixed-1.png and b/docs/dev/reference/mixed-1.png differ diff --git a/docs/dev/reference/mixed.html b/docs/dev/reference/mixed.html index b2b83312..01a0614b 100644 --- a/docs/dev/reference/mixed.html +++ b/docs/dev/reference/mixed.html @@ -17,7 +17,7 @@ mkin - 1.1.0 + 1.2.2 @@ -26,7 +26,7 @@ Functions and data
  • - Example evaluation of FOCUS Example Dataset Z + Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models +
  • +
  • + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -53,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -84,73 +93,84 @@
    -
    mixed(object, ...)
    -
    -# S3 method for mmkin
    -mixed(object, method = c("none"), ...)
    -
    -# S3 method for mixed.mmkin
    -print(x, digits = max(3, getOption("digits") - 3), ...)
    +
    mixed(object, ...)
    +
    +# S3 method for mmkin
    +mixed(object, method = c("none"), ...)
    +
    +# S3 method for mixed.mmkin
    +print(x, digits = max(3, getOption("digits") - 3), ...)

    Arguments

    object

    An mmkin row object

    + +
    ...

    Currently not used

    + +
    method

    The method to be used

    + +
    x

    A mixed.mmkin object to print

    + +
    digits

    Number of digits to use for printing.

    +

    Value

    -

    An object of class 'mixed.mmkin' which has the observed data in a + + +

    An object of class 'mixed.mmkin' which has the observed data in a single dataframe which is convenient for plotting

    Examples

    -
    sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    -n_biphasic <- 8
    -err_1 = list(const = 1, prop = 0.07)
    -
    -DFOP_SFO <- mkinmod(
    -  parent = mkinsub("DFOP", "m1"),
    -  m1 = mkinsub("SFO"),
    -  quiet = TRUE)
    -
    -set.seed(123456)
    -log_sd <- 0.3
    -syn_biphasic_parms <- as.matrix(data.frame(
    -  k1 = rlnorm(n_biphasic, log(0.05), log_sd),
    -  k2 = rlnorm(n_biphasic, log(0.01), log_sd),
    -  g = plogis(rnorm(n_biphasic, 0, log_sd)),
    -  f_parent_to_m1 = plogis(rnorm(n_biphasic, 0, log_sd)),
    -  k_m1 = rlnorm(n_biphasic, log(0.002), log_sd)))
    -
    -ds_biphasic_mean <- lapply(1:n_biphasic,
    -  function(i) {
    -    mkinpredict(DFOP_SFO, syn_biphasic_parms[i, ],
    -      c(parent = 100, m1 = 0), sampling_times)
    -  }
    -)
    -
    -set.seed(123456L)
    -ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
    -  add_err(ds,
    -    sdfunc = function(value) sqrt(err_1$const^2 + value^2 * err_1$prop^2),
    -    n = 1, secondary = "m1")[[1]]
    -})
    -
    -# \dontrun{
    -f_mmkin <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, error_model = "tc", quiet = TRUE)
    -
    -f_mixed <- mixed(f_mmkin)
    -print(f_mixed)
    +    
    sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +n_biphasic <- 8
    +err_1 = list(const = 1, prop = 0.07)
    +
    +DFOP_SFO <- mkinmod(
    +  parent = mkinsub("DFOP", "m1"),
    +  m1 = mkinsub("SFO"),
    +  quiet = TRUE)
    +
    +set.seed(123456)
    +log_sd <- 0.3
    +syn_biphasic_parms <- as.matrix(data.frame(
    +  k1 = rlnorm(n_biphasic, log(0.05), log_sd),
    +  k2 = rlnorm(n_biphasic, log(0.01), log_sd),
    +  g = plogis(rnorm(n_biphasic, 0, log_sd)),
    +  f_parent_to_m1 = plogis(rnorm(n_biphasic, 0, log_sd)),
    +  k_m1 = rlnorm(n_biphasic, log(0.002), log_sd)))
    +
    +ds_biphasic_mean <- lapply(1:n_biphasic,
    +  function(i) {
    +    mkinpredict(DFOP_SFO, syn_biphasic_parms[i, ],
    +      c(parent = 100, m1 = 0), sampling_times)
    +  }
    +)
    +
    +set.seed(123456L)
    +ds_biphasic <- lapply(ds_biphasic_mean, function(ds) {
    +  add_err(ds,
    +    sdfunc = function(value) sqrt(err_1$const^2 + value^2 * err_1$prop^2),
    +    n = 1, secondary = "m1")[[1]]
    +})
    +
    +# \dontrun{
    +f_mmkin <- mmkin(list("DFOP-SFO" = DFOP_SFO), ds_biphasic, error_model = "tc", quiet = TRUE)
    +
    +f_mixed <- mixed(f_mmkin)
    +print(f_mixed)
     #> Kinetic model fitted by nonlinear regression to each dataset
     #> Structural model:
     #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
    @@ -177,9 +197,9 @@ single dataframe which is convenient for plotting

    #> 100.674757 -8.761916 -0.004347 -3.348812 -3.986853 #> g_qlogis #> -0.087392 -plot(f_mixed) +plot(f_mixed) -# } +# }
    @@ -194,7 +214,7 @@ single dataframe which is convenient for plotting

    -

    Site built with pkgdown 2.0.2.

    +

    Site built with pkgdown 2.0.6.

    diff --git a/docs/dev/reference/mkin_long_to_wide.html b/docs/dev/reference/mkin_long_to_wide.html index 6246fbe2..3e55885f 100644 --- a/docs/dev/reference/mkin_long_to_wide.html +++ b/docs/dev/reference/mkin_long_to_wide.html @@ -1,69 +1,14 @@ - - - - - - - -Convert a dataframe from long to wide format — mkin_long_to_wide • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert a dataframe from long to wide format — mkin_long_to_wide • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -151,87 +96,89 @@ observed value, and converts it into a dataframe with one independent variable and several dependent variables as columns.

    -
    mkin_long_to_wide(long_data, time = "time", outtime = "time")
    +
    +
    mkin_long_to_wide(long_data, time = "time", outtime = "time")
    +
    -

    Arguments

    - - - - - - - - - - - - - - -
    long_data

    The dataframe must contain one variable called "time" with +

    +

    Arguments

    +
    long_data
    +

    The dataframe must contain one variable called "time" with the time values specified by the time argument, one column called "name" with the grouping of the observed values, and finally one column of -observed values called "value".

    time

    The name of the time variable in the long input data.

    outtime

    The name of the time variable in the wide output data.

    - -

    Value

    - -

    Dataframe in wide format.

    -

    Author

    +observed values called "value".

    + + +
    time
    +

    The name of the time variable in the long input data.

    + + +
    outtime
    +

    The name of the time variable in the wide output data.

    + +
    +
    +

    Value

    + +

    Dataframe in wide format.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    -mkin_long_to_wide(FOCUS_2006_D) -
    #> time parent m1 -#> 1 0 99.46 0.00 -#> 2 0 102.04 0.00 -#> 3 1 93.50 4.84 -#> 4 1 92.50 5.64 -#> 5 3 63.23 12.91 -#> 6 3 68.99 12.96 -#> 7 7 52.32 22.97 -#> 8 7 55.13 24.47 -#> 9 14 27.27 41.69 -#> 10 14 26.64 33.21 -#> 11 21 11.50 44.37 -#> 12 21 11.64 46.44 -#> 13 35 2.85 41.22 -#> 14 35 2.91 37.95 -#> 15 50 0.69 41.19 -#> 16 50 0.63 40.01 -#> 17 75 0.05 40.09 -#> 18 75 0.06 33.85 -#> 19 100 NA 31.04 -#> 20 100 NA 33.13 -#> 21 120 NA 25.15 -#> 22 120 NA 33.31
    -
    +
    +

    Examples

    +
    
    +mkin_long_to_wide(FOCUS_2006_D)
    +#>    time parent    m1
    +#> 1     0  99.46  0.00
    +#> 2     0 102.04  0.00
    +#> 3     1  93.50  4.84
    +#> 4     1  92.50  5.64
    +#> 5     3  63.23 12.91
    +#> 6     3  68.99 12.96
    +#> 7     7  52.32 22.97
    +#> 8     7  55.13 24.47
    +#> 9    14  27.27 41.69
    +#> 10   14  26.64 33.21
    +#> 11   21  11.50 44.37
    +#> 12   21  11.64 46.44
    +#> 13   35   2.85 41.22
    +#> 14   35   2.91 37.95
    +#> 15   50   0.69 41.19
    +#> 16   50   0.63 40.01
    +#> 17   75   0.05 40.09
    +#> 18   75   0.06 33.85
    +#> 19  100     NA 31.04
    +#> 20  100     NA 33.13
    +#> 21  120     NA 25.15
    +#> 22  120     NA 33.31
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkin_wide_to_long.html b/docs/dev/reference/mkin_wide_to_long.html index f2bf00c1..fb23d3dc 100644 --- a/docs/dev/reference/mkin_wide_to_long.html +++ b/docs/dev/reference/mkin_wide_to_long.html @@ -1,69 +1,14 @@ - - - - - - - -Convert a dataframe with observations over time into long format — mkin_wide_to_long • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert a dataframe with observations over time into long format — mkin_wide_to_long • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +

    This function simply takes a dataframe with one independent variable and several dependent variable and converts it into the long form as required by -mkinfit.

    +mkinfit.

    -
    mkin_wide_to_long(wide_data, time = "t")
    +
    +
    mkin_wide_to_long(wide_data, time = "t")
    +
    -

    Arguments

    - - - - - - - - - - -
    wide_data

    The dataframe must contain one variable with the time +

    +

    Arguments

    +
    wide_data
    +

    The dataframe must contain one variable with the time values specified by the time argument and usually more than one -column of observed values.

    time

    The name of the time variable.

    +column of observed values.

    + -

    Value

    +
    time
    +

    The name of the time variable.

    -

    Dataframe in long format as needed for mkinfit.

    -

    Author

    +
    +
    +

    Value

    + +

    Dataframe in long format as needed for mkinfit.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    -wide <- data.frame(t = c(1,2,3), x = c(1,4,7), y = c(3,4,5)) -mkin_wide_to_long(wide) -
    #> name time value -#> 1 x 1 1 -#> 2 x 2 4 -#> 3 x 3 7 -#> 4 y 1 3 -#> 5 y 2 4 -#> 6 y 3 5
    -
    +
    +

    Examples

    +
    
    +wide <- data.frame(t = c(1,2,3), x = c(1,4,7), y = c(3,4,5))
    +mkin_wide_to_long(wide)
    +#>   name time value
    +#> 1    x    1     1
    +#> 2    x    2     4
    +#> 3    x    3     7
    +#> 4    y    1     3
    +#> 5    y    2     4
    +#> 6    y    3     5
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkinds.html b/docs/dev/reference/mkinds.html index b571e3a0..a7fb9916 100644 --- a/docs/dev/reference/mkinds.html +++ b/docs/dev/reference/mkinds.html @@ -20,7 +20,7 @@ provided by this package come as mkinds objects nevertheless."> mkin - 1.1.2 + 1.2.2 @@ -47,11 +47,14 @@ provided by this package come as mkinds objects nevertheless.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -59,7 +62,10 @@ provided by this package come as mkinds objects nevertheless.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/mkindsg.html b/docs/dev/reference/mkindsg.html index d19a7a1d..cbf55fca 100644 --- a/docs/dev/reference/mkindsg.html +++ b/docs/dev/reference/mkindsg.html @@ -20,7 +20,7 @@ dataset if no data are supplied."> - - - - - - -Calculate the minimum error to assume in order to pass the variance test — mkinerrmin • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calculate the minimum error to assume in order to pass the variance test — mkinerrmin • mkin + + - - - - -
    -
    - -
    - -
    +
    @@ -149,89 +94,100 @@ the chi-squared test as defined in the FOCUS kinetics report from 2006." /> the chi-squared test as defined in the FOCUS kinetics report from 2006.

    -
    mkinerrmin(fit, alpha = 0.05)
    - -

    Arguments

    - - - - - - - - - - -
    fit

    an object of class mkinfit.

    alpha

    The confidence level chosen for the chi-squared test.

    - -

    Value

    - -

    A dataframe with the following components:

    -
    err.min

    The -relative error, expressed as a fraction.

    n.optim

    The number of -optimised parameters attributed to the data series.

    df

    The number of +

    +
    mkinerrmin(fit, alpha = 0.05)
    +
    + +
    +

    Arguments

    +
    fit
    +

    an object of class mkinfit.

    + + +
    alpha
    +

    The confidence level chosen for the chi-squared test.

    + +
    +
    +

    Value

    + + +

    A dataframe with the following components:

    +
    err.min
    +

    The +relative error, expressed as a fraction.

    +
    n.optim
    +

    The number of +optimised parameters attributed to the data series.

    +
    df
    +

    The number of remaining degrees of freedom for the chi2 error level calculations. Note that mean values are used for the chi2 statistic and therefore every time -point with observed values in the series only counts one time.

    The +point with observed values in the series only counts one time.

    +

    The dataframe has one row for the total dataset and one further row for each -observed state variable in the model. - -

    Details

    - -

    This function is used internally by summary.mkinfit.

    -

    References

    - -

    FOCUS (2006) “Guidance Document on Estimating Persistence +observed state variable in the model.

    +
    +
    +

    Details

    +

    This function is used internally by summary.mkinfit.

    +
    +
    +

    References

    +

    FOCUS (2006) “Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in EU -Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC +Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, -http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    - -

    Examples

    -
    -SFO_SFO = mkinmod(parent = mkinsub("SFO", to = "m1"), - m1 = mkinsub("SFO"), - use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    round(mkinerrmin(fit_FOCUS_D), 4) -
    #> err.min n.optim df -#> All data 0.0640 4 15 -#> parent 0.0646 2 7 -#> m1 0.0469 2 8
    # \dontrun{ - fit_FOCUS_E = mkinfit(SFO_SFO, FOCUS_2006_E, quiet = TRUE) - round(mkinerrmin(fit_FOCUS_E), 4) -
    #> err.min n.optim df -#> All data 0.1544 4 13 -#> parent 0.1659 2 7 -#> m1 0.1095 2 6
    # } - -
    +http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

    +
    + +
    +

    Examples

    +
    
    +SFO_SFO = mkinmod(parent = mkinsub("SFO", to = "m1"),
    +                  m1 = mkinsub("SFO"),
    +                  use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +round(mkinerrmin(fit_FOCUS_D), 4)
    +#>          err.min n.optim df
    +#> All data  0.0640       4 15
    +#> parent    0.0646       2  7
    +#> m1        0.0469       2  8
    +# \dontrun{
    +  fit_FOCUS_E = mkinfit(SFO_SFO, FOCUS_2006_E, quiet = TRUE)
    +  round(mkinerrmin(fit_FOCUS_E), 4)
    +#>          err.min n.optim df
    +#> All data  0.1544       4 13
    +#> parent    0.1659       2  7
    +#> m1        0.1095       2  6
    +# }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkinerrplot-1.png b/docs/dev/reference/mkinerrplot-1.png index bae6071d..49bb1c0e 100644 Binary files a/docs/dev/reference/mkinerrplot-1.png and b/docs/dev/reference/mkinerrplot-1.png differ diff --git a/docs/dev/reference/mkinerrplot.html b/docs/dev/reference/mkinerrplot.html index 7f1fd048..66bfb508 100644 --- a/docs/dev/reference/mkinerrplot.html +++ b/docs/dev/reference/mkinerrplot.html @@ -1,71 +1,16 @@ - - - - - - - -Function to plot squared residuals and the error model for an mkin object — mkinerrplot • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function to plot squared residuals and the error model for an mkin object — mkinerrplot • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -151,128 +96,133 @@ using the argument show_errplot = TRUE." />

    This function plots the squared residuals for the specified subset of the observed variables from an mkinfit object. In addition, one or more dashed line(s) show the fitted error model. A combined plot of the fitted model -and this error model plot can be obtained with plot.mkinfit +and this error model plot can be obtained with plot.mkinfit using the argument show_errplot = TRUE.

    -
    mkinerrplot(
    -  object,
    -  obs_vars = names(object$mkinmod$map),
    -  xlim = c(0, 1.1 * max(object$data$predicted)),
    -  xlab = "Predicted",
    -  ylab = "Squared residual",
    -  maxy = "auto",
    -  legend = TRUE,
    -  lpos = "topright",
    -  col_obs = "auto",
    -  pch_obs = "auto",
    -  frame = TRUE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    object

    A fit represented in an mkinfit object.

    obs_vars

    A character vector of names of the observed variables for +

    +
    mkinerrplot(
    +  object,
    +  obs_vars = names(object$mkinmod$map),
    +  xlim = c(0, 1.1 * max(object$data$predicted)),
    +  xlab = "Predicted",
    +  ylab = "Squared residual",
    +  maxy = "auto",
    +  legend = TRUE,
    +  lpos = "topright",
    +  col_obs = "auto",
    +  pch_obs = "auto",
    +  frame = TRUE,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    object
    +

    A fit represented in an mkinfit object.

    + + +
    obs_vars
    +

    A character vector of names of the observed variables for which residuals should be plotted. Defaults to all observed variables in -the model

    xlim

    plot range in x direction.

    xlab

    Label for the x axis.

    ylab

    Label for the y axis.

    maxy

    Maximum value of the residuals. This is used for the scaling of -the y axis and defaults to "auto".

    legend

    Should a legend be plotted?

    lpos

    Where should the legend be placed? Default is "topright". Will -be passed on to legend.

    col_obs

    Colors for the observed variables.

    pch_obs

    Symbols to be used for the observed variables.

    frame

    Should a frame be drawn around the plots?

    ...

    further arguments passed to plot.

    - -

    Value

    - -

    Nothing is returned by this function, as it is called for its side -effect, namely to produce a plot.

    -

    See also

    +the model

    -

    mkinplot, for a way to plot the data and the fitted -lines of the mkinfit object.

    -

    Author

    -

    Johannes Ranke

    +
    xlim
    +

    plot range in x direction.

    + + +
    xlab
    +

    Label for the x axis.

    + + +
    ylab
    +

    Label for the y axis.

    + + +
    maxy
    +

    Maximum value of the residuals. This is used for the scaling of +the y axis and defaults to "auto".

    + + +
    legend
    +

    Should a legend be plotted?

    + + +
    lpos
    +

    Where should the legend be placed? Default is "topright". Will +be passed on to legend.

    + -

    Examples

    -
    -# \dontrun{ -model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -
    #> Temporary DLL for differentials generated and loaded
    fit <- mkinfit(model, FOCUS_2006_D, error_model = "tc", quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    mkinerrplot(fit) -
    # } +
    col_obs
    +

    Colors for the observed variables.

    -
    + +
    pch_obs
    +

    Symbols to be used for the observed variables.

    + + +
    frame
    +

    Should a frame be drawn around the plots?

    + + +
    ...
    +

    further arguments passed to plot.

    + +
    +
    +

    Value

    + + +

    Nothing is returned by this function, as it is called for its side +effect, namely to produce a plot.

    +
    +
    +

    See also

    +

    mkinplot, for a way to plot the data and the fitted +lines of the mkinfit object.

    +
    +
    +

    Author

    +

    Johannes Ranke

    +
    + +
    +

    Examples

    +
    
    +# \dontrun{
    +model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
    +#> Temporary DLL for differentials generated and loaded
    +fit <- mkinfit(model, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +mkinerrplot(fit)
    +
    +# }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkinfit.html b/docs/dev/reference/mkinfit.html index 17da44cb..ee596e89 100644 --- a/docs/dev/reference/mkinfit.html +++ b/docs/dev/reference/mkinfit.html @@ -25,7 +25,7 @@ likelihood function."> mkin - 1.2.0 + 1.2.2 @@ -67,7 +67,10 @@ likelihood function.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -381,17 +384,17 @@ Degradation Data. Environments 6(12) 124 # Use shorthand notation for parent only degradation fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) summary(fit) -#> mkin version used for fitting: 1.2.0 +#> mkin version used for fitting: 1.2.2 #> R version used for fitting: 4.2.2 -#> Date of fit: Tue Nov 1 14:09:26 2022 -#> Date of summary: Tue Nov 1 14:09:26 2022 +#> Date of fit: Thu Nov 24 08:05:53 2022 +#> Date of summary: Thu Nov 24 08:05:53 2022 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent #> #> Model predictions using solution type analytical #> -#> Fitted using 222 model solutions performed in 0.049 s +#> Fitted using 222 model solutions performed in 0.045 s #> #> Error model: Constant variance #> @@ -531,11 +534,10 @@ Degradation Data. Environments 6(12) 124 analytical = mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "tc", solution_type = "analytical")) } -#> Loading required package: rbenchmark #> test relative elapsed -#> 3 analytical 1.000 0.559 -#> 1 deSolve_compiled 1.556 0.870 -#> 2 eigen 2.603 1.455 +#> 3 analytical 1.000 0.616 +#> 1 deSolve_compiled 1.505 0.927 +#> 2 eigen 2.455 1.512 # } # Use stepwise fitting, using optimised parameters from parent only fit, FOMC-SFO @@ -562,10 +564,10 @@ Degradation Data. Environments 6(12) 124 #> Warning: NaNs produced #> Warning: NaNs produced #> Warning: diag(.) had 0 or NA entries; non-finite result is doubtful -#> mkin version used for fitting: 1.2.0 +#> mkin version used for fitting: 1.2.2 #> R version used for fitting: 4.2.2 -#> Date of fit: Tue Nov 1 14:09:37 2022 -#> Date of summary: Tue Nov 1 14:09:37 2022 +#> Date of fit: Thu Nov 24 08:06:05 2022 +#> Date of summary: Thu Nov 24 08:06:05 2022 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent @@ -574,7 +576,7 @@ Degradation Data. Environments 6(12) 124 #> #> Model predictions using solution type deSolve #> -#> Fitted using 3729 model solutions performed in 2.43 s +#> Fitted using 3729 model solutions performed in 2.81 s #> #> Error model: Two-component variance function #> diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html index d0e192e7..251215a7 100644 --- a/docs/dev/reference/mkinmod.html +++ b/docs/dev/reference/mkinmod.html @@ -21,7 +21,7 @@ components."> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function to plot the confidence intervals obtained using mkinfit — mkinparplot • mkin - - + + - - -
    -
    - -
    - -
    +

    This function plots the confidence intervals for the parameters fitted using -mkinfit.

    +mkinfit.

    -
    mkinparplot(object)
    +
    +
    mkinparplot(object)
    +
    -

    Arguments

    - - - - - - -
    object

    A fit represented in an mkinfit object.

    +
    +

    Arguments

    +
    object
    +

    A fit represented in an mkinfit object.

    -

    Value

    +
    +
    +

    Value

    + -

    Nothing is returned by this function, as it is called for its side +

    Nothing is returned by this function, as it is called for its side effect, namely to produce a plot.

    -

    Author

    - +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    -# \dontrun{ -model <- mkinmod( - T245 = mkinsub("SFO", to = c("phenol"), sink = FALSE), - phenol = mkinsub("SFO", to = c("anisole")), - anisole = mkinsub("SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    fit <- mkinfit(model, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    #> Warning: Optimisation did not converge: -#> false convergence (8)
    mkinparplot(fit) -
    # } -
    +
    +

    Examples

    +
    
    +# \dontrun{
    +model <- mkinmod(
    +  T245 = mkinsub("SFO", to = c("phenol"), sink = FALSE),
    +  phenol = mkinsub("SFO", to = c("anisole")),
    +  anisole = mkinsub("SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +fit <- mkinfit(model, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +#> Warning: Optimisation did not converge:
    +#> false convergence (8)
    +mkinparplot(fit)
    +
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkinplot.html b/docs/dev/reference/mkinplot.html index 120bddb3..a8430f30 100644 --- a/docs/dev/reference/mkinplot.html +++ b/docs/dev/reference/mkinplot.html @@ -1,68 +1,13 @@ - - - - - - - -Plot the observed data and the fitted model of an mkinfit object — mkinplot • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot the observed data and the fitted model of an mkinfit object — mkinplot • mkin - - + + - - -
    -
    - -
    - -
    +

    Deprecated function. It now only calls the plot method -plot.mkinfit.

    +plot.mkinfit.

    +
    + +
    +
    mkinplot(fit, ...)
    -
    mkinplot(fit, ...)
    +
    +

    Arguments

    +
    fit
    +

    an object of class mkinfit.

    -

    Arguments

    - - - - - - - - - - -
    fit

    an object of class mkinfit.

    ...

    further arguments passed to plot.mkinfit.

    -

    Value

    +
    ...
    +

    further arguments passed to plot.mkinfit.

    -

    The function is called for its side effect.

    -

    Author

    +
    +
    +

    Value

    + +

    The function is called for its side effect.

    +
    +
    +

    Author

    Johannes Ranke

    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mkinpredict.html b/docs/dev/reference/mkinpredict.html index 0e645b51..10d2c9a9 100644 --- a/docs/dev/reference/mkinpredict.html +++ b/docs/dev/reference/mkinpredict.html @@ -19,7 +19,7 @@ kinetic parameters and initial values for the state variables."> mkin - 1.2.0 + 1.2.2 @@ -372,11 +372,10 @@ as these always return mapped output.

    c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "analytical", use_compiled = FALSE)[201,]) } -#> Loading required package: rbenchmark #> test relative elapsed #> 2 deSolve_compiled 1.0 0.005 -#> 1 eigen 4.2 0.021 -#> 4 analytical 4.2 0.021 +#> 4 analytical 1.0 0.005 +#> 1 eigen 4.4 0.022 #> 3 deSolve 41.0 0.205 # \dontrun{ diff --git a/docs/dev/reference/mkinresplot-1.png b/docs/dev/reference/mkinresplot-1.png index ffd34f6f..97ccd762 100644 Binary files a/docs/dev/reference/mkinresplot-1.png and b/docs/dev/reference/mkinresplot-1.png differ diff --git a/docs/dev/reference/mkinresplot.html b/docs/dev/reference/mkinresplot.html index 30377f2c..4d99f5be 100644 --- a/docs/dev/reference/mkinresplot.html +++ b/docs/dev/reference/mkinresplot.html @@ -1,70 +1,15 @@ - - - - - - - -Function to plot residuals stored in an mkin object — mkinresplot • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function to plot residuals stored in an mkin object — mkinresplot • mkin - - - - - - - - - + + - - - - -
    -
    - -
    - -
    +

    This function plots the residuals for the specified subset of the observed variables from an mkinfit object. A combined plot of the fitted model and -the residuals can be obtained using plot.mkinfit using the +the residuals can be obtained using plot.mkinfit using the argument show_residuals = TRUE.

    -
    mkinresplot(
    -  object,
    -  obs_vars = names(object$mkinmod$map),
    -  xlim = c(0, 1.1 * max(object$data$time)),
    -  standardized = FALSE,
    -  xlab = "Time",
    -  ylab = ifelse(standardized, "Standardized residual", "Residual"),
    -  maxabs = "auto",
    -  legend = TRUE,
    -  lpos = "topright",
    -  col_obs = "auto",
    -  pch_obs = "auto",
    -  frame = TRUE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    object

    A fit represented in an mkinfit object.

    obs_vars

    A character vector of names of the observed variables for +

    +
    mkinresplot(
    +  object,
    +  obs_vars = names(object$mkinmod$map),
    +  xlim = c(0, 1.1 * max(object$data$time)),
    +  standardized = FALSE,
    +  xlab = "Time",
    +  ylab = ifelse(standardized, "Standardized residual", "Residual"),
    +  maxabs = "auto",
    +  legend = TRUE,
    +  lpos = "topright",
    +  col_obs = "auto",
    +  pch_obs = "auto",
    +  frame = TRUE,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    object
    +

    A fit represented in an mkinfit object.

    + + +
    obs_vars
    +

    A character vector of names of the observed variables for which residuals should be plotted. Defaults to all observed variables in -the model

    xlim

    plot range in x direction.

    standardized

    Should the residuals be standardized by dividing by the -standard deviation given by the error model of the fit?

    xlab

    Label for the x axis.

    ylab

    Label for the y axis.

    maxabs

    Maximum absolute value of the residuals. This is used for the -scaling of the y axis and defaults to "auto".

    legend

    Should a legend be plotted?

    lpos

    Where should the legend be placed? Default is "topright". Will -be passed on to legend.

    col_obs

    Colors for the observed variables.

    pch_obs

    Symbols to be used for the observed variables.

    frame

    Should a frame be drawn around the plots?

    ...

    further arguments passed to plot.

    - -

    Value

    - -

    Nothing is returned by this function, as it is called for its side -effect, namely to produce a plot.

    -

    See also

    +the model

    -

    mkinplot, for a way to plot the data and the fitted -lines of the mkinfit object, and plot_res for a function -combining the plot of the fit and the residual plot.

    -

    Author

    +
    xlim
    +

    plot range in x direction.

    + + +
    standardized
    +

    Should the residuals be standardized by dividing by the +standard deviation given by the error model of the fit?

    + + +
    xlab
    +

    Label for the x axis.

    + + +
    ylab
    +

    Label for the y axis.

    + + +
    maxabs
    +

    Maximum absolute value of the residuals. This is used for the +scaling of the y axis and defaults to "auto".

    + + +
    legend
    +

    Should a legend be plotted?

    + + +
    lpos
    +

    Where should the legend be placed? Default is "topright". Will +be passed on to legend.

    + + +
    col_obs
    +

    Colors for the observed variables.

    + + +
    pch_obs
    +

    Symbols to be used for the observed variables.

    + + +
    frame
    +

    Should a frame be drawn around the plots?

    + + +
    ...
    +

    further arguments passed to plot.

    + +
    +
    +

    Value

    + + +

    Nothing is returned by this function, as it is called for its side +effect, namely to produce a plot.

    +
    +
    +

    See also

    +

    mkinplot, for a way to plot the data and the fitted +lines of the mkinfit object, and plot_res for a function +combining the plot of the fit and the residual plot.

    +
    +
    +

    Author

    Johannes Ranke and Katrin Lindenberger

    +
    -

    Examples

    -
    -model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -
    #> Temporary DLL for differentials generated and loaded
    fit <- mkinfit(model, FOCUS_2006_D, quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    mkinresplot(fit, "m1") -
    -
    +
    +

    Examples

    +
    
    +model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
    +#> Temporary DLL for differentials generated and loaded
    +fit <- mkinfit(model, FOCUS_2006_D, quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +mkinresplot(fit, "m1")
    +
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/mmkin-1.png b/docs/dev/reference/mmkin-1.png index 701a6d6a..8ad9c11d 100644 Binary files a/docs/dev/reference/mmkin-1.png and b/docs/dev/reference/mmkin-1.png differ diff --git a/docs/dev/reference/mmkin-2.png b/docs/dev/reference/mmkin-2.png index 5277b389..da2a48a8 100644 Binary files a/docs/dev/reference/mmkin-2.png and b/docs/dev/reference/mmkin-2.png differ diff --git a/docs/dev/reference/mmkin-3.png b/docs/dev/reference/mmkin-3.png index 2659cd61..10d3f35b 100644 Binary files a/docs/dev/reference/mmkin-3.png and b/docs/dev/reference/mmkin-3.png differ diff --git a/docs/dev/reference/mmkin-4.png b/docs/dev/reference/mmkin-4.png index ae16ee79..132380a8 100644 Binary files a/docs/dev/reference/mmkin-4.png and b/docs/dev/reference/mmkin-4.png differ diff --git a/docs/dev/reference/mmkin-5.png b/docs/dev/reference/mmkin-5.png index 2b9dc831..4bfcc55e 100644 Binary files a/docs/dev/reference/mmkin-5.png and b/docs/dev/reference/mmkin-5.png differ diff --git a/docs/dev/reference/mmkin.html b/docs/dev/reference/mmkin.html index c385bbf6..5aa259f9 100644 --- a/docs/dev/reference/mmkin.html +++ b/docs/dev/reference/mmkin.html @@ -1,70 +1,15 @@ - - - - - - - -Fit one or more kinetic models with one or more state variables to one or -more datasets — mmkin • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Fit one or more kinetic models with one or more state variables to one or +more datasets — mmkin • mkin - - - - + + -
    -
    - -
    - -
    +
    -

    This function calls mkinfit on all combinations of models and +

    This function calls mkinfit on all combinations of models and datasets specified in its first two arguments.

    -
    mmkin(
    -  models = c("SFO", "FOMC", "DFOP"),
    -  datasets,
    -  cores = if (Sys.info()["sysname"] == "Windows") 1 else parallel::detectCores(),
    -  cluster = NULL,
    -  ...
    -)
    +    
    +
    mmkin(
    +  models = c("SFO", "FOMC", "DFOP"),
    +  datasets,
    +  cores = if (Sys.info()["sysname"] == "Windows") 1 else parallel::detectCores(),
    +  cluster = NULL,
    +  ...
    +)
    +
    +# S3 method for mmkin
    +print(x, ...)
    +
    + +
    +

    Arguments

    +
    models
    +

    Either a character vector of shorthand names like +c("SFO", "FOMC", "DFOP", "HS", "SFORB"), or an optionally named +list of mkinmod objects.

    + -# S3 method for mmkin -print(x, ...)
    +
    datasets
    +

    An optionally named list of datasets suitable as observed +data for mkinfit.

    -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    models

    Either a character vector of shorthand names like -c("SFO", "FOMC", "DFOP", "HS", "SFORB"), or an optionally named -list of mkinmod objects.

    datasets

    An optionally named list of datasets suitable as observed -data for mkinfit.

    cores

    The number of cores to be used for multicore processing. This + +

    cores
    +

    The number of cores to be used for multicore processing. This is only used when the cluster argument is NULL. On Windows machines, cores > 1 is not supported, you need to use the cluster argument to use multiple logical processors. Per default, all cores -detected by parallel::detectCores() are used, except on Windows where -the default is 1.

    cluster

    A cluster as returned by makeCluster to be used -for parallel execution.

    ...

    Not used.

    x

    An mmkin object.

    +detected by parallel::detectCores() are used, except on Windows where +the default is 1.

    -

    Value

    -

    A two-dimensional array of mkinfit -objects and/or try-errors that can be indexed using the model names for the -first index (row index) and the dataset names for the second index (column -index).

    -

    See also

    +
    cluster
    +

    A cluster as returned by makeCluster to be used +for parallel execution.

    -

    [.mmkin for subsetting, plot.mmkin for -plotting.

    -

    Author

    -

    Johannes Ranke

    +
    ...
    +

    Not used.

    -

    Examples

    -
    -# \dontrun{ -m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), - M1 = mkinsub("SFO", "M2"), - M2 = mkinsub("SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -m_synth_FOMC_lin <- mkinmod(parent = mkinsub("FOMC", "M1"), - M1 = mkinsub("SFO", "M2"), - M2 = mkinsub("SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -models <- list(SFO_lin = m_synth_SFO_lin, FOMC_lin = m_synth_FOMC_lin) -datasets <- lapply(synthetic_data_for_UBA_2014[1:3], function(x) x$data) -names(datasets) <- paste("Dataset", 1:3) -time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE)) -time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE)) +
    x
    +

    An mmkin object.

    -time_default -
    #> user system elapsed -#> 4.771 0.576 1.803
    time_1 -
    #> user system elapsed -#> 5.779 0.000 5.781
    -endpoints(fits.0[["SFO_lin", 2]]) -
    #> $ff -#> parent_M1 parent_sink M1_M2 M1_sink -#> 0.7340481 0.2659519 0.7505683 0.2494317 -#> -#> $distimes -#> DT50 DT90 -#> parent 0.877769 2.915885 -#> M1 2.325744 7.725956 -#> M2 33.720100 112.015749 -#>
    -# plot.mkinfit handles rows or columns of mmkin result objects -plot(fits.0[1, ]) -
    plot(fits.0[1, ], obs_var = c("M1", "M2")) -
    plot(fits.0[, 1]) -
    # Use double brackets to extract a single mkinfit object, which will be plotted -# by plot.mkinfit and can be plotted using plot_sep -plot(fits.0[[1, 1]], sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE) -
    plot_sep(fits.0[[1, 1]]) -# Plotting with mmkin (single brackets, extracting an mmkin object) does not -# allow to plot the observed variables separately -plot(fits.0[1, 1]) -
    -# On Windows, we can use multiple cores by making a cluster using the parallel -# package, which gets loaded with mkin, and passing it to mmkin, e.g. -cl <- makePSOCKcluster(12) -f <- mmkin(c("SFO", "FOMC", "DFOP"), - list(A = FOCUS_2006_A, B = FOCUS_2006_B, C = FOCUS_2006_C, D = FOCUS_2006_D), - cluster = cl, quiet = TRUE) -print(f) -
    #> <mmkin> object -#> Status of individual fits: -#> -#> dataset -#> model A B C D -#> SFO OK OK OK OK -#> FOMC OK OK OK OK -#> DFOP OK OK OK OK -#> -#> OK: No warnings
    # We get false convergence for the FOMC fit to FOCUS_2006_A because this -# dataset is really SFO, and the FOMC fit is overparameterised -stopCluster(cl) -# } +
    +
    +

    Value

    + -
    +

    A two-dimensional array of mkinfit

    + + +

    objects and/or try-errors that can be indexed using the model names for the +first index (row index) and the dataset names for the second index (column +index).

    +
    +
    +

    See also

    +

    [.mmkin for subsetting, plot.mmkin for +plotting.

    +
    +
    +

    Author

    +

    Johannes Ranke

    +
    + +
    +

    Examples

    +
    
    +# \dontrun{
    +m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
    +                           M1 = mkinsub("SFO", "M2"),
    +                           M2 = mkinsub("SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +m_synth_FOMC_lin <- mkinmod(parent = mkinsub("FOMC", "M1"),
    +                            M1 = mkinsub("SFO", "M2"),
    +                            M2 = mkinsub("SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +models <- list(SFO_lin = m_synth_SFO_lin, FOMC_lin = m_synth_FOMC_lin)
    +datasets <- lapply(synthetic_data_for_UBA_2014[1:3], function(x) x$data)
    +names(datasets) <- paste("Dataset", 1:3)
    +
    +time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE))
    +time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE))
    +
    +time_default
    +#>    user  system elapsed 
    +#>   7.113   0.837   2.580 
    +time_1
    +#>    user  system elapsed 
    +#>   5.617   0.008   5.626 
    +
    +endpoints(fits.0[["SFO_lin", 2]])
    +#> $ff
    +#>   parent_M1 parent_sink       M1_M2     M1_sink 
    +#>   0.7340481   0.2659519   0.7505683   0.2494317 
    +#> 
    +#> $distimes
    +#>             DT50       DT90
    +#> parent  0.877769   2.915885
    +#> M1      2.325744   7.725956
    +#> M2     33.720100 112.015749
    +#> 
    +
    +# plot.mkinfit handles rows or columns of mmkin result objects
    +plot(fits.0[1, ])
    +
    +plot(fits.0[1, ], obs_var = c("M1", "M2"))
    +
    +plot(fits.0[, 1])
    +
    +# Use double brackets to extract a single mkinfit object, which will be plotted
    +# by plot.mkinfit and can be plotted using plot_sep
    +plot(fits.0[[1, 1]], sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE)
    +
    +plot_sep(fits.0[[1, 1]])
    +# Plotting with mmkin (single brackets, extracting an mmkin object) does not
    +# allow to plot the observed variables separately
    +plot(fits.0[1, 1])
    +
    +
    +# On Windows, we can use multiple cores by making a cluster using the parallel
    +# package, which gets loaded with mkin, and passing it to mmkin, e.g.
    +cl <- makePSOCKcluster(12)
    +#> Error in makePSOCKcluster(12): could not find function "makePSOCKcluster"
    +f <- mmkin(c("SFO", "FOMC", "DFOP"),
    +  list(A = FOCUS_2006_A, B = FOCUS_2006_B, C = FOCUS_2006_C, D = FOCUS_2006_D),
    +  cluster = cl, quiet = TRUE)
    +#> Error in system.time({    if (is.null(cluster)) {        results <- parallel::mclapply(as.list(1:n.fits), fit_function,             mc.cores = cores, mc.preschedule = FALSE)    }    else {        results <- parallel::parLapply(cluster, as.list(1:n.fits),             fit_function)    }}): object 'cl' not found
    +#> Timing stopped at: 0 0 0.001
    +print(f)
    +#> Error in print(f): object 'f' not found
    +# We get false convergence for the FOMC fit to FOCUS_2006_A because this
    +# dataset is really SFO, and the FOMC fit is overparameterised
    +stopCluster(cl)
    +#> Error in stopCluster(cl): could not find function "stopCluster"
    +# }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/multistart-1.png b/docs/dev/reference/multistart-1.png index 7fc24a04..dcd493c9 100644 Binary files a/docs/dev/reference/multistart-1.png and b/docs/dev/reference/multistart-1.png differ diff --git a/docs/dev/reference/multistart-2.png b/docs/dev/reference/multistart-2.png index 7553a51a..e1983f12 100644 Binary files a/docs/dev/reference/multistart-2.png and b/docs/dev/reference/multistart-2.png differ diff --git a/docs/dev/reference/multistart.html b/docs/dev/reference/multistart.html index 3f5c4b35..0f2988bd 100644 --- a/docs/dev/reference/multistart.html +++ b/docs/dev/reference/multistart.html @@ -22,7 +22,7 @@ mixed-effects models by Duchesne et al (2021)."> mkin - 1.2.0 + 1.2.2 @@ -64,7 +64,10 @@ mixed-effects models by Duchesne et al (2021).">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/nafta-1.png b/docs/dev/reference/nafta-1.png index 4f0d7833..5d2d434b 100644 Binary files a/docs/dev/reference/nafta-1.png and b/docs/dev/reference/nafta-1.png differ diff --git a/docs/dev/reference/nafta.html b/docs/dev/reference/nafta.html index 6fb797a5..eafbca7f 100644 --- a/docs/dev/reference/nafta.html +++ b/docs/dev/reference/nafta.html @@ -1,71 +1,16 @@ - - - - - - - -Evaluate parent kinetics using the NAFTA guidance — nafta • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Evaluate parent kinetics using the NAFTA guidance — nafta • mkin - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +
    -

    The function fits the SFO, IORE and DFOP models using mmkin +

    The function fits the SFO, IORE and DFOP models using mmkin and returns an object of class nafta that has methods for printing and plotting.

    Print nafta objects. The results for the three models are printed in the order of increasing model complexity, i.e. SFO, then IORE, and finally DFOP.

    -
    nafta(ds, title = NA, quiet = FALSE, ...)
    -
    -# S3 method for nafta
    -print(x, quiet = TRUE, digits = 3, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ds

    A dataframe that must contain one variable called "time" with the -time values specified by the time argument, one column called -"name" with the grouping of the observed values, and finally one column of -observed values called "value".

    title

    Optional title of the dataset

    quiet

    Should the evaluation text be shown?

    ...

    Further arguments passed to mmkin (not for the -printing method).

    x

    An nafta object.

    digits

    Number of digits to be used for printing parameters and -dissipation times.

    - -

    Source

    +
    +
    nafta(ds, title = NA, quiet = FALSE, ...)
    +
    +# S3 method for nafta
    +print(x, quiet = TRUE, digits = 3, ...)
    +
    +
    +

    Source

    NAFTA (2011) Guidance for evaluating and calculating degradation kinetics in environmental media. NAFTA Technical Working Group on Pesticides -https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation +https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation accessed 2019-02-22

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to Calculate Representative Half-life Values and Characterizing Pesticide Degradation -https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    -

    Value

    +https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    +
    +
    +

    Arguments

    +
    ds
    +

    A dataframe that must contain one variable called "time" with the +time values specified by the time argument, one column called +"name" with the grouping of the observed values, and finally one column of +observed values called "value".

    + + +
    title
    +

    Optional title of the dataset

    + -

    An list of class nafta. The list element named "mmkin" is the -mmkin object containing the fits of the three models. The +

    quiet
    +

    Should the evaluation text be shown?

    + + +
    ...
    +

    Further arguments passed to mmkin (not for the +printing method).

    + + +
    x
    +

    An nafta object.

    + + +
    digits
    +

    Number of digits to be used for printing parameters and +dissipation times.

    + +
    +
    +

    Value

    + + +

    An list of class nafta. The list element named "mmkin" is the +mmkin object containing the fits of the three models. The list element named "title" contains the title of the dataset used. The list element "data" contains the dataset used in the fits.

    -

    Author

    - +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    - nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1) -
    #> 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
    print(nafta_evaluation) -
    #> Sums of squares: -#> SFO IORE DFOP -#> 1378.6832 615.7730 517.8836 -#> -#> Critical sum of squares for checking the SFO model: -#> [1] 717.4598 -#> -#> Parameters: -#> $SFO -#> Estimate Pr(>t) Lower Upper -#> parent_0 83.7558 1.80e-14 77.18268 90.3288 -#> k_parent 0.0017 7.43e-05 0.00112 0.0026 -#> sigma 8.7518 1.22e-05 5.64278 11.8608 -#> -#> $IORE -#> Estimate Pr(>t) Lower Upper -#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 -#> k__iore_parent 8.40e-14 NA 1.79e-18 3.94e-09 -#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 -#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 -#> -#> $DFOP -#> Estimate Pr(>t) Lower Upper -#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02 -#> k1 4.24e-02 5.92e-03 2.03e-02 8.88e-02 -#> k2 8.24e-04 6.48e-03 3.89e-04 1.75e-03 -#> g 2.88e-01 2.47e-05 1.95e-01 4.03e-01 -#> sigma 5.36e+00 2.22e-05 3.43e+00 7.30e+00 -#> -#> -#> DTx values: -#> DT50 DT90 DT50_rep -#> SFO 407 1350 407 -#> IORE 541 5190000 1560000 -#> DFOP 429 2380 841 -#> -#> Representative half-life: -#> [1] 841.41
    plot(nafta_evaluation) -
    -
    +
    +

    Examples

    +
    
    +  nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1)
    +#> 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
    +  print(nafta_evaluation)
    +#> Sums of squares:
    +#>       SFO      IORE      DFOP 
    +#> 1378.6832  615.7730  517.8836 
    +#> 
    +#> Critical sum of squares for checking the SFO model:
    +#> [1] 717.4598
    +#> 
    +#> Parameters:
    +#> $SFO
    +#>          Estimate   Pr(>t)    Lower   Upper
    +#> parent_0  83.7558 1.80e-14 77.18268 90.3288
    +#> k_parent   0.0017 7.43e-05  0.00112  0.0026
    +#> sigma      8.7518 1.22e-05  5.64278 11.8608
    +#> 
    +#> $IORE
    +#>                Estimate Pr(>t)    Lower    Upper
    +#> parent_0       9.69e+01     NA 8.88e+01 1.05e+02
    +#> k__iore_parent 8.40e-14     NA 1.79e-18 3.94e-09
    +#> N_parent       6.68e+00     NA 4.19e+00 9.17e+00
    +#> sigma          5.85e+00     NA 3.76e+00 7.94e+00
    +#> 
    +#> $DFOP
    +#>          Estimate   Pr(>t)    Lower    Upper
    +#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02
    +#> k1       4.24e-02 5.92e-03 2.03e-02 8.88e-02
    +#> k2       8.24e-04 6.48e-03 3.89e-04 1.75e-03
    +#> g        2.88e-01 2.47e-05 1.95e-01 4.03e-01
    +#> sigma    5.36e+00 2.22e-05 3.43e+00 7.30e+00
    +#> 
    +#> 
    +#> DTx values:
    +#>      DT50    DT90 DT50_rep
    +#> SFO   407    1350      407
    +#> IORE  541 5190000  1560000
    +#> DFOP  429    2380      841
    +#> 
    +#> Representative half-life:
    +#> [1] 841.41
    +  plot(nafta_evaluation)
    +
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/nlme-1.png b/docs/dev/reference/nlme-1.png index 67cc7f3c..c4fc9d31 100644 Binary files a/docs/dev/reference/nlme-1.png and b/docs/dev/reference/nlme-1.png differ diff --git a/docs/dev/reference/nlme-2.png b/docs/dev/reference/nlme-2.png index bb1e6f81..d9512f41 100644 Binary files a/docs/dev/reference/nlme-2.png and b/docs/dev/reference/nlme-2.png differ diff --git a/docs/dev/reference/nlme.html b/docs/dev/reference/nlme.html index e7844299..b8b36d56 100644 --- a/docs/dev/reference/nlme.html +++ b/docs/dev/reference/nlme.html @@ -20,7 +20,7 @@ datasets. They are used internally by the nlme.mmkin() method."> mkin - 1.1.0 + 1.2.2 @@ -29,7 +29,7 @@ datasets. They are used internally by the nlme.mmkin() method.">Functions and data
  • - Example evaluation of FOCUS Example Dataset Z + Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models +
  • +
  • + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -56,7 +62,10 @@ datasets. They are used internally by the nlme.mmkin() method.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -90,20 +99,25 @@ datasets. They are used internally by the nlme.m
    -
    nlme_function(object)
    -
    -nlme_data(object)
    +
    nlme_function(object)
    +
    +nlme_data(object)

    Arguments

    object

    An mmkin row object containing several fits of the same model to different datasets

    +

    Value

    -

    A function that can be used with nlme -A groupedData object

    + + +

    A function that can be used with nlme

    + + +

    A groupedData object

    See also

    @@ -112,78 +126,78 @@ A

    Examples

    -
    sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    -m_SFO <- mkinmod(parent = mkinsub("SFO"))
    -d_SFO_1 <- mkinpredict(m_SFO,
    -  c(k_parent = 0.1),
    -  c(parent = 98), sampling_times)
    -d_SFO_1_long <- mkin_wide_to_long(d_SFO_1, time = "time")
    -d_SFO_2 <- mkinpredict(m_SFO,
    -  c(k_parent = 0.05),
    -  c(parent = 102), sampling_times)
    -d_SFO_2_long <- mkin_wide_to_long(d_SFO_2, time = "time")
    -d_SFO_3 <- mkinpredict(m_SFO,
    -  c(k_parent = 0.02),
    -  c(parent = 103), sampling_times)
    -d_SFO_3_long <- mkin_wide_to_long(d_SFO_3, time = "time")
    -
    -d1 <- add_err(d_SFO_1, function(value) 3, n = 1)
    -d2 <- add_err(d_SFO_2, function(value) 2, n = 1)
    -d3 <- add_err(d_SFO_3, function(value) 4, n = 1)
    -ds <- c(d1 = d1, d2 = d2, d3 = d3)
    -
    -f <- mmkin("SFO", ds, cores = 1, quiet = TRUE)
    -mean_dp <- mean_degparms(f)
    -grouped_data <- nlme_data(f)
    -nlme_f <- nlme_function(f)
    -# These assignments are necessary for these objects to be
    -# visible to nlme and augPred when evaluation is done by
    -# pkgdown to generate the html docs.
    -assign("nlme_f", nlme_f, globalenv())
    -assign("grouped_data", grouped_data, globalenv())
    -
    -library(nlme)
    -m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink),
    -  data = grouped_data,
    -  fixed = parent_0 + log_k_parent_sink ~ 1,
    -  random = pdDiag(parent_0 + log_k_parent_sink ~ 1),
    -  start = mean_dp)
    -summary(m_nlme)
    +    
    sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +m_SFO <- mkinmod(parent = mkinsub("SFO"))
    +d_SFO_1 <- mkinpredict(m_SFO,
    +  c(k_parent = 0.1),
    +  c(parent = 98), sampling_times)
    +d_SFO_1_long <- mkin_wide_to_long(d_SFO_1, time = "time")
    +d_SFO_2 <- mkinpredict(m_SFO,
    +  c(k_parent = 0.05),
    +  c(parent = 102), sampling_times)
    +d_SFO_2_long <- mkin_wide_to_long(d_SFO_2, time = "time")
    +d_SFO_3 <- mkinpredict(m_SFO,
    +  c(k_parent = 0.02),
    +  c(parent = 103), sampling_times)
    +d_SFO_3_long <- mkin_wide_to_long(d_SFO_3, time = "time")
    +
    +d1 <- add_err(d_SFO_1, function(value) 3, n = 1)
    +d2 <- add_err(d_SFO_2, function(value) 2, n = 1)
    +d3 <- add_err(d_SFO_3, function(value) 4, n = 1)
    +ds <- c(d1 = d1, d2 = d2, d3 = d3)
    +
    +f <- mmkin("SFO", ds, cores = 1, quiet = TRUE)
    +mean_dp <- mean_degparms(f)
    +grouped_data <- nlme_data(f)
    +nlme_f <- nlme_function(f)
    +# These assignments are necessary for these objects to be
    +# visible to nlme and augPred when evaluation is done by
    +# pkgdown to generate the html docs.
    +assign("nlme_f", nlme_f, globalenv())
    +assign("grouped_data", grouped_data, globalenv())
    +
    +library(nlme)
    +m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink),
    +  data = grouped_data,
    +  fixed = parent_0 + log_k_parent_sink ~ 1,
    +  random = pdDiag(parent_0 + log_k_parent_sink ~ 1),
    +  start = mean_dp)
    +summary(m_nlme)
     #> Nonlinear mixed-effects model fit by maximum likelihood
     #>   Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink) 
     #>   Data: grouped_data 
     #>        AIC      BIC    logLik
    -#>   300.6824 310.2426 -145.3412
    +#>   266.6428 275.8935 -128.3214
     #> 
     #> Random effects:
     #>  Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1)
     #>  Level: ds
     #>  Structure: Diagonal
    -#>         parent_0 log_k_parent_sink Residual
    -#> StdDev: 1.697361         0.6801209 3.666073
    +#>            parent_0 log_k_parent_sink Residual
    +#> StdDev: 0.000368491         0.7058039 3.065183
     #> 
     #> Fixed effects:  parent_0 + log_k_parent_sink ~ 1 
    -#>                       Value Std.Error DF  t-value p-value
    -#> parent_0          100.99378 1.3890416 46 72.70753       0
    -#> log_k_parent_sink  -3.07521 0.4018589 46 -7.65246       0
    +#>                       Value Std.Error DF   t-value p-value
    +#> parent_0          101.18323 0.7900461 43 128.07257       0
    +#> log_k_parent_sink  -3.08708 0.4171755 43  -7.39995       0
     #>  Correlation: 
     #>                   prnt_0
    -#> log_k_parent_sink 0.027 
    +#> log_k_parent_sink 0.031 
     #> 
     #> Standardized Within-Group Residuals:
    -#>        Min         Q1        Med         Q3        Max 
    -#> -1.9942823 -0.5622565  0.1791579  0.7165038  2.0704781 
    +#>         Min          Q1         Med          Q3         Max 
    +#> -2.38427070 -0.52059848  0.03593021  0.39987268  2.73188969 
     #> 
    -#> Number of Observations: 50
    +#> Number of Observations: 47
     #> Number of Groups: 3 
    -plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
    +plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
     
    -# augPred does not work on fits with more than one state
    -# variable
    -#
    -# The procedure is greatly simplified by the nlme.mmkin function
    -f_nlme <- nlme(f)
    -plot(f_nlme)
    +# augPred does not work on fits with more than one state
    +# variable
    +#
    +# The procedure is greatly simplified by the nlme.mmkin function
    +f_nlme <- nlme(f)
    +plot(f_nlme)
     
     
    @@ -199,7 +213,7 @@ A -

    Site built with pkgdown 2.0.2.

    +

    Site built with pkgdown 2.0.6.

    diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index 2bbadb88..8c069470 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -19,7 +19,7 @@ have been obtained by fitting the same model to a list of datasets."> mkin - 1.1.2 + 1.2.2 @@ -46,11 +46,14 @@ have been obtained by fitting the same model to a list of datasets.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -58,7 +61,10 @@ have been obtained by fitting the same model to a list of datasets.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -97,7 +103,7 @@ have been obtained by fitting the same model to a list of datasets.

    data = "auto", fixed = lapply(as.list(names(mean_degparms(model))), function(el) eval(parse(text = paste(el, 1, sep = "~")))), - random = pdDiag(fixed), + random = pdDiag(fixed), groups, start = mean_degparms(model, random = TRUE, test_log_parms = TRUE), correlation = NULL, diff --git a/docs/dev/reference/nobs.mkinfit.html b/docs/dev/reference/nobs.mkinfit.html index 0b6c963c..8c2d04f0 100644 --- a/docs/dev/reference/nobs.mkinfit.html +++ b/docs/dev/reference/nobs.mkinfit.html @@ -1,67 +1,12 @@ - - - - - - - -Number of observations on which an mkinfit object was fitted — nobs.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Number of observations on which an mkinfit object was fitted — nobs.mkinfit • mkin - - + + - - -
    -
    - -
    - -
    +
    @@ -147,51 +92,49 @@

    Number of observations on which an mkinfit object was fitted

    -
    # S3 method for mkinfit
    -nobs(object, ...)
    +
    +
    # S3 method for mkinfit
    +nobs(object, ...)
    +
    + +
    +

    Arguments

    +
    object
    +

    An mkinfit object

    -

    Arguments

    - - - - - - - - - - -
    object

    An mkinfit object

    ...

    For compatibility with the generic method

    -

    Value

    +
    ...
    +

    For compatibility with the generic method

    -

    The number of rows in the data included in the mkinfit object

    +
    +
    +

    Value

    + + +

    The number of rows in the data included in the mkinfit object

    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/parms.html b/docs/dev/reference/parms.html index 95db0593..b0385c8a 100644 --- a/docs/dev/reference/parms.html +++ b/docs/dev/reference/parms.html @@ -19,7 +19,7 @@ without considering the error structure that was assumed for the fit."> mkin - 1.2.0 + 1.2.2 @@ -61,7 +61,10 @@ without considering the error structure that was assumed for the fit.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/parplot.html b/docs/dev/reference/parplot.html index ffe93e6c..9852b694 100644 --- a/docs/dev/reference/parplot.html +++ b/docs/dev/reference/parplot.html @@ -19,7 +19,7 @@ or by their medians as proposed in the paper by Duchesne et al. (2021)."> mkin - 1.2.0 + 1.2.2 @@ -61,7 +61,10 @@ or by their medians as proposed in the paper by Duchesne et al. (2021).">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • @@ -134,6 +137,12 @@ If 'median', parameters are scaled using the median parameters from all fits.

    Title of the plot

    +
    +

    Details

    +

    Starting values of degradation model parameters and error model parameters +are shown as green circles. The results obtained in the original run +are shown as red circles.

    +

    References

    Duchesne R, Guillemin A, Gandrillon O, Crauste F. Practical diff --git a/docs/dev/reference/plot.mixed.mmkin.html b/docs/dev/reference/plot.mixed.mmkin.html index b1c62721..4bd170a1 100644 --- a/docs/dev/reference/plot.mixed.mmkin.html +++ b/docs/dev/reference/plot.mixed.mmkin.html @@ -17,7 +17,7 @@ mkin - 1.2.0 + 1.2.2

    @@ -59,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/plot.mkinfit.html b/docs/dev/reference/plot.mkinfit.html index 764f0699..d125a606 100644 --- a/docs/dev/reference/plot.mkinfit.html +++ b/docs/dev/reference/plot.mkinfit.html @@ -19,7 +19,7 @@ observed data together with the solution of the fitted model."> mkin - 1.1.2 + 1.2.2 @@ -46,11 +46,14 @@ observed data together with the solution of the fitted model.">Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -58,7 +61,10 @@ observed data together with the solution of the fitted model.">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/plot.mmkin-1.png b/docs/dev/reference/plot.mmkin-1.png index 647dfb8a..235e33a7 100644 Binary files a/docs/dev/reference/plot.mmkin-1.png and b/docs/dev/reference/plot.mmkin-1.png differ diff --git a/docs/dev/reference/plot.mmkin-2.png b/docs/dev/reference/plot.mmkin-2.png index 1bc1c9db..7af84edf 100644 Binary files a/docs/dev/reference/plot.mmkin-2.png and b/docs/dev/reference/plot.mmkin-2.png differ diff --git a/docs/dev/reference/plot.mmkin-3.png b/docs/dev/reference/plot.mmkin-3.png index 50d6ffac..56bfac50 100644 Binary files a/docs/dev/reference/plot.mmkin-3.png and b/docs/dev/reference/plot.mmkin-3.png differ diff --git a/docs/dev/reference/plot.mmkin-4.png b/docs/dev/reference/plot.mmkin-4.png index e049fa16..5da05f40 100644 Binary files a/docs/dev/reference/plot.mmkin-4.png and b/docs/dev/reference/plot.mmkin-4.png differ diff --git a/docs/dev/reference/plot.mmkin-5.png b/docs/dev/reference/plot.mmkin-5.png index 2421995b..3ec224f4 100644 Binary files a/docs/dev/reference/plot.mmkin-5.png and b/docs/dev/reference/plot.mmkin-5.png differ diff --git a/docs/dev/reference/plot.mmkin.html b/docs/dev/reference/plot.mmkin.html index 9ca0df94..09f311c5 100644 --- a/docs/dev/reference/plot.mmkin.html +++ b/docs/dev/reference/plot.mmkin.html @@ -1,71 +1,16 @@ - - - - - - - -Plot model fits (observed and fitted) and the residuals for a row or column -of an mmkin object — plot.mmkin • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot model fits (observed and fitted) and the residuals for a row or column +of an mmkin object — plot.mmkin • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    -

    When x is a row selected from an mmkin object ([.mmkin), the +

    When x is a row selected from an mmkin object ([.mmkin), the same model fitted for at least one dataset is shown. When it is a column, the fit of at least one model to the same dataset is shown.

    -
    # S3 method for mmkin
    -plot(
    -  x,
    -  main = "auto",
    -  legends = 1,
    -  resplot = c("time", "errmod"),
    -  ylab = "Residue",
    -  standardized = FALSE,
    -  show_errmin = TRUE,
    -  errmin_var = "All data",
    -  errmin_digits = 3,
    -  cex = 0.7,
    -  rel.height.middle = 0.9,
    -  ymax = "auto",
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    An object of class mmkin, with either one row or one -column.

    main

    The main title placed on the outer margin of the plot.

    legends

    An index for the fits for which legends should be shown.

    resplot

    Should the residuals plotted against time, using -mkinresplot, or as squared residuals against predicted -values, with the error model, using mkinerrplot.

    ylab

    Label for the y axis.

    standardized

    Should the residuals be standardized? This option -is passed to mkinresplot, it only takes effect if -resplot = "time".

    show_errmin

    Should the chi2 error level be shown on top of the plots -to the left?

    errmin_var

    The variable for which the FOCUS chi2 error value should -be shown.

    errmin_digits

    The number of significant digits for rounding the FOCUS -chi2 error percentage.

    cex

    Passed to the plot functions and mtext.

    rel.height.middle

    The relative height of the middle plot, if more -than two rows of plots are shown.

    ymax

    Maximum y axis value for plot.mkinfit.

    ...

    Further arguments passed to plot.mkinfit and -mkinresplot.

    - -

    Value

    - -

    The function is called for its side effect.

    -

    Details

    - -

    If the current plot device is a tikz device, then -latex is being used for the formatting of the chi2 error level.

    -

    Author

    +
    +
    # S3 method for mmkin
    +plot(
    +  x,
    +  main = "auto",
    +  legends = 1,
    +  resplot = c("time", "errmod"),
    +  ylab = "Residue",
    +  standardized = FALSE,
    +  show_errmin = TRUE,
    +  errmin_var = "All data",
    +  errmin_digits = 3,
    +  cex = 0.7,
    +  rel.height.middle = 0.9,
    +  ymax = "auto",
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    x
    +

    An object of class mmkin, with either one row or one +column.

    + + +
    main
    +

    The main title placed on the outer margin of the plot.

    + + +
    legends
    +

    An index for the fits for which legends should be shown.

    + + +
    resplot
    +

    Should the residuals plotted against time, using +mkinresplot, or as squared residuals against predicted +values, with the error model, using mkinerrplot.

    + + +
    ylab
    +

    Label for the y axis.

    + + +
    standardized
    +

    Should the residuals be standardized? This option +is passed to mkinresplot, it only takes effect if +resplot = "time".

    + + +
    show_errmin
    +

    Should the chi2 error level be shown on top of the plots +to the left?

    + + +
    errmin_var
    +

    The variable for which the FOCUS chi2 error value should +be shown.

    + +
    errmin_digits
    +

    The number of significant digits for rounding the FOCUS +chi2 error percentage.

    + + +
    cex
    +

    Passed to the plot functions and mtext.

    + + +
    rel.height.middle
    +

    The relative height of the middle plot, if more +than two rows of plots are shown.

    + + +
    ymax
    +

    Maximum y axis value for plot.mkinfit.

    + + +
    ...
    +

    Further arguments passed to plot.mkinfit and +mkinresplot.

    + +
    +
    +

    Value

    + + +

    The function is called for its side effect.

    +
    +
    +

    Details

    +

    If the current plot device is a tikz device, then +latex is being used for the formatting of the chi2 error level.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    - # \dontrun{ - # Only use one core not to offend CRAN checks - fits <- mmkin(c("FOMC", "HS"), - list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles - cores = 1, quiet = TRUE, error_model = "tc") -
    #> Warning: Optimisation did not converge: -#> iteration limit reached without convergence (10)
    plot(fits[, "FOCUS C"]) -
    plot(fits["FOMC", ]) -
    plot(fits["FOMC", ], show_errmin = FALSE) -
    - # We can also plot a single fit, if we like the way plot.mmkin works, but then the plot - # height should be smaller than the plot width (this is not possible for the html pages - # generated by pkgdown, as far as I know). - plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2]) -
    - # Show the error models - plot(fits["FOMC", ], resplot = "errmod") -
    # } - -
    +
    +

    Examples

    +
    
    +  # \dontrun{
    +  # Only use one core not to offend CRAN checks
    +  fits <- mmkin(c("FOMC", "HS"),
    +                list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles
    +                cores = 1, quiet = TRUE, error_model = "tc")
    +#> Warning: Optimisation did not converge:
    +#> iteration limit reached without convergence (10)
    +  plot(fits[, "FOCUS C"])
    +
    +  plot(fits["FOMC", ])
    +
    +  plot(fits["FOMC", ], show_errmin = FALSE)
    +
    +
    +  # We can also plot a single fit, if we like the way plot.mmkin works, but then the plot
    +  # height should be smaller than the plot width (this is not possible for the html pages
    +  # generated by pkgdown, as far as I know).
    +  plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2])
    +
    +
    +  # Show the error models
    +  plot(fits["FOMC", ], resplot = "errmod")
    +
    +  # }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/plot.nafta.html b/docs/dev/reference/plot.nafta.html index c24fba99..82b46336 100644 --- a/docs/dev/reference/plot.nafta.html +++ b/docs/dev/reference/plot.nafta.html @@ -1,68 +1,13 @@ - - - - - - - -Plot the results of the three models used in the NAFTA scheme. — plot.nafta • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot the results of the three models used in the NAFTA scheme. — plot.nafta • mkin + + - - - - -
    -
    - -
    - -
    +
    @@ -149,65 +94,65 @@ function (SFO, then IORE, then DFOP)." /> function (SFO, then IORE, then DFOP).

    -
    # S3 method for nafta
    -plot(x, legend = FALSE, main = "auto", ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - -
    x

    An object of class nafta.

    legend

    Should a legend be added?

    main

    Possibility to override the main title of the plot.

    ...

    Further arguments passed to plot.mmkin.

    - -

    Value

    - -

    The function is called for its side effect.

    -

    Details

    - -

    Calls plot.mmkin.

    -

    Author

    +
    +
    # S3 method for nafta
    +plot(x, legend = FALSE, main = "auto", ...)
    +
    + +
    +

    Arguments

    +
    x
    +

    An object of class nafta.

    + +
    legend
    +

    Should a legend be added?

    + + +
    main
    +

    Possibility to override the main title of the plot.

    + + +
    ...
    +

    Further arguments passed to plot.mmkin.

    + +
    +
    +

    Value

    + + +

    The function is called for its side effect.

    +
    +
    +

    Details

    +

    Calls plot.mmkin.

    +
    +
    +

    Author

    Johannes Ranke

    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/read_spreadsheet.html b/docs/dev/reference/read_spreadsheet.html index efba012b..d0ac47d4 100644 --- a/docs/dev/reference/read_spreadsheet.html +++ b/docs/dev/reference/read_spreadsheet.html @@ -22,7 +22,7 @@ factors can be given in columns named 'Temperature' and 'Moisture'."> mkin - 1.2.0 + 1.2.2 diff --git a/docs/dev/reference/reexports.html b/docs/dev/reference/reexports.html index 0999e346..ad825391 100644 --- a/docs/dev/reference/reexports.html +++ b/docs/dev/reference/reexports.html @@ -28,7 +28,7 @@ intervals, nlme mkin - 1.1.2 + 1.2.2 @@ -55,11 +55,14 @@ intervals, nlme Example evaluations of dimethenamid data from 2018 with nonlinear mixed-effects models
  • - Example evaluation of FOCUS Example Dataset Z + Short demo of the multistart method
  • Performance benefit by using compiled model definitions in mkin
  • +
  • + Example evaluation of FOCUS Example Dataset Z +
  • Calculation of time weighted average concentrations with mkin
  • @@ -67,7 +70,10 @@ intervals, nlme Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/residuals.mkinfit.html b/docs/dev/reference/residuals.mkinfit.html index 3f518ab7..009f790f 100644 --- a/docs/dev/reference/residuals.mkinfit.html +++ b/docs/dev/reference/residuals.mkinfit.html @@ -1,67 +1,12 @@ - - - - - - - -Extract residuals from an mkinfit model — residuals.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Extract residuals from an mkinfit model — residuals.mkinfit • mkin - - + + - - -
    -
    - -
    - -
    +
    @@ -147,60 +92,59 @@

    Extract residuals from an mkinfit model

    -
    # S3 method for mkinfit
    -residuals(object, standardized = FALSE, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    object

    A mkinfit object

    standardized

    Should the residuals be standardized by dividing by the -standard deviation obtained from the fitted error model?

    ...

    Not used

    - - -

    Examples

    -
    f <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE) -residuals(f) -
    #> [1] 0.09726374 -0.13912142 -0.15351210 0.73388322 -0.08657004 -0.93204702 -#> [7] -0.03269080 1.45347823 -0.88423697
    residuals(f, standardized = TRUE) -
    #> [1] 0.13969917 -0.19981904 -0.22048826 1.05407091 -0.12433989 -1.33869208 -#> [7] -0.04695355 2.08761977 -1.27002287
    +
    +
    # S3 method for mkinfit
    +residuals(object, standardized = FALSE, ...)
    +
    + +
    +

    Arguments

    +
    object
    +

    A mkinfit object

    + + +
    standardized
    +

    Should the residuals be standardized by dividing by the +standard deviation obtained from the fitted error model?

    + + +
    ...
    +

    Not used

    + +
    + +
    +

    Examples

    +
    f <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE)
    +residuals(f)
    +#> [1]  0.09726374 -0.13912142 -0.15351210  0.73388322 -0.08657004 -0.93204702
    +#> [7] -0.03269080  1.45347823 -0.88423697
    +residuals(f, standardized = TRUE)
    +#> [1]  0.13969917 -0.19981904 -0.22048826  1.05407091 -0.12433989 -1.33869208
    +#> [7] -0.04695355  2.08761977 -1.27002287
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/saem.html b/docs/dev/reference/saem.html index d2e930e1..d18cb848 100644 --- a/docs/dev/reference/saem.html +++ b/docs/dev/reference/saem.html @@ -19,7 +19,7 @@ Expectation Maximisation algorithm (SAEM)."> mkin - 1.2.0 + 1.2.2 @@ -113,7 +113,7 @@ Expectation Maximisation algorithm (SAEM).

    covariates = NULL, covariate_models = NULL, no_random_effect = NULL, - error.init = c(3, 0.1), + error.init = c(1, 1), nbiter.saemix = c(300, 100), control = list(displayProgress = FALSE, print = FALSE, nbiter.saemix = nbiter.saemix, save = FALSE, save.graphs = FALSE), @@ -430,10 +430,10 @@ using mmkin.

    summary(f_saem_dfop_sfo, data = TRUE) #> saemix version used for fitting: 3.2 -#> mkin version used for pre-fitting: 1.2.0 +#> mkin version used for pre-fitting: 1.2.2 #> R version used for fitting: 4.2.2 -#> Date of fit: Wed Nov 16 10:49:43 2022 -#> Date of summary: Wed Nov 16 10:49:43 2022 +#> Date of fit: Thu Nov 24 08:11:00 2022 +#> Date of summary: Thu Nov 24 08:11:01 2022 #> #> Equations: #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -448,7 +448,7 @@ using mmkin.

    #> #> Model predictions using solution type analytical #> -#> Fitted in 8.935 s +#> Fitted in 8.778 s #> Using 300, 100 iterations and 10 chains #> #> Variance model: Constant variance diff --git a/docs/dev/reference/schaefer07_complex_case-1.png b/docs/dev/reference/schaefer07_complex_case-1.png index 96aab2dc..eee9e0cc 100644 Binary files a/docs/dev/reference/schaefer07_complex_case-1.png and b/docs/dev/reference/schaefer07_complex_case-1.png differ diff --git a/docs/dev/reference/schaefer07_complex_case.html b/docs/dev/reference/schaefer07_complex_case.html index 4ccad5c4..5ff62d34 100644 --- a/docs/dev/reference/schaefer07_complex_case.html +++ b/docs/dev/reference/schaefer07_complex_case.html @@ -1,69 +1,14 @@ - - - - - - - -Metabolism data set used for checking the software quality of KinGUI — schaefer07_complex_case • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Metabolism data set used for checking the software quality of KinGUI — schaefer07_complex_case • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    schaefer07_complex_case
    +
    +
    schaefer07_complex_case
    +
    + +
    +

    Format

    +

    The data set is a data frame with 8 observations on the following 6 variables.

    time
    +

    a numeric vector

    + +
    parent
    +

    a numeric vector

    +
    A1
    +

    a numeric vector

    -

    Format

    +
    B1
    +

    a numeric vector

    + +
    C1
    +

    a numeric vector

    + +
    A2
    +

    a numeric vector

    -

    The data set is a data frame with 8 observations on the following 6 variables.

    -
    time

    a numeric vector

    -
    parent

    a numeric vector

    -
    A1

    a numeric vector

    -
    B1

    a numeric vector

    -
    C1

    a numeric vector

    -
    A2

    a numeric vector

    The results are a data frame with 14 results for different parameter values

    -

    References

    - +
    +
    +

    References

    Schäfer D, Mikolasch B, Rainbird P and Harvey B (2007). KinGUI: a new kinetic software tool for evaluations according to FOCUS degradation kinetics. In: Del Re AAM, Capri E, Fragoulis G and Trevisan M (Eds.). Proceedings of the XIII Symposium Pesticide Chemistry, Piacenza, 2007, p. 916-923.

    +
    -

    Examples

    -
    data <- mkin_wide_to_long(schaefer07_complex_case, time = "time") -model <- mkinmod( - parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE), - A1 = list(type = "SFO", to = "A2"), - B1 = list(type = "SFO"), - C1 = list(type = "SFO"), - A2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    # \dontrun{ - fit <- mkinfit(model, data, quiet = TRUE) - plot(fit) -
    endpoints(fit) -
    #> $ff -#> parent_A1 parent_B1 parent_C1 parent_sink A1_A2 A1_sink -#> 0.3809620 0.1954667 0.4235713 0.0000000 0.4479619 0.5520381 -#> -#> $distimes -#> DT50 DT90 -#> parent 13.95078 46.34350 -#> A1 49.75342 165.27728 -#> B1 37.26908 123.80520 -#> C1 11.23131 37.30961 -#> A2 28.50624 94.69567 -#>
    # } - # Compare with the results obtained in the original publication - print(schaefer07_complex_results) -
    #> compound parameter KinGUI ModelMaker deviation -#> 1 parent degradation rate 0.0496 0.0506 2.0 -#> 2 parent DT50 13.9900 13.6900 2.2 -#> 3 metabolite A1 formation fraction 0.3803 0.3696 2.9 -#> 4 metabolite A1 degradation rate 0.0139 0.0136 2.2 -#> 5 metabolite A1 DT50 49.9600 50.8900 1.8 -#> 6 metabolite B1 formation fraction 0.1866 0.1818 2.6 -#> 7 metabolite B1 degradation rate 0.0175 0.0172 1.7 -#> 8 metabolite B1 DT50 39.6100 40.2400 1.6 -#> 9 metabolite C1 formation fraction 0.4331 0.4486 3.5 -#> 10 metabolite C1 degradation rate 0.0638 0.0700 8.9 -#> 11 metabolite C1 DT50 10.8700 9.9000 9.8 -#> 12 metabolite A2 formation fraction 0.4529 0.4559 0.7 -#> 13 metabolite A2 degradation rate 0.0245 0.0244 0.4 -#> 14 metabolite A2 DT50 28.2400 28.4500 0.7
    +
    +

    Examples

    +
    data <- mkin_wide_to_long(schaefer07_complex_case, time = "time")
    +model <- mkinmod(
    +  parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE),
    +  A1 = list(type = "SFO", to = "A2"),
    +  B1 = list(type = "SFO"),
    +  C1 = list(type = "SFO"),
    +  A2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +  # \dontrun{
    +    fit <- mkinfit(model, data, quiet = TRUE)
    +    plot(fit)
    +
    +    endpoints(fit)
    +#> $ff
    +#>   parent_A1   parent_B1   parent_C1 parent_sink       A1_A2     A1_sink 
    +#>   0.3809620   0.1954667   0.4235713   0.0000000   0.4479619   0.5520381 
    +#> 
    +#> $distimes
    +#>            DT50      DT90
    +#> parent 13.95078  46.34350
    +#> A1     49.75342 165.27728
    +#> B1     37.26908 123.80520
    +#> C1     11.23131  37.30961
    +#> A2     28.50624  94.69567
    +#> 
    +  # }
    + # Compare with the results obtained in the original publication
    + print(schaefer07_complex_results)
    +#>         compound          parameter  KinGUI ModelMaker deviation
    +#> 1         parent   degradation rate  0.0496     0.0506       2.0
    +#> 2         parent               DT50 13.9900    13.6900       2.2
    +#> 3  metabolite A1 formation fraction  0.3803     0.3696       2.9
    +#> 4  metabolite A1   degradation rate  0.0139     0.0136       2.2
    +#> 5  metabolite A1               DT50 49.9600    50.8900       1.8
    +#> 6  metabolite B1 formation fraction  0.1866     0.1818       2.6
    +#> 7  metabolite B1   degradation rate  0.0175     0.0172       1.7
    +#> 8  metabolite B1               DT50 39.6100    40.2400       1.6
    +#> 9  metabolite C1 formation fraction  0.4331     0.4486       3.5
    +#> 10 metabolite C1   degradation rate  0.0638     0.0700       8.9
    +#> 11 metabolite C1               DT50 10.8700     9.9000       9.8
    +#> 12 metabolite A2 formation fraction  0.4529     0.4559       0.7
    +#> 13 metabolite A2   degradation rate  0.0245     0.0244       0.4
    +#> 14 metabolite A2               DT50 28.2400    28.4500       0.7
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/set_nd_nq.html b/docs/dev/reference/set_nd_nq.html index 6c6a5d46..fab0a72d 100644 --- a/docs/dev/reference/set_nd_nq.html +++ b/docs/dev/reference/set_nd_nq.html @@ -21,7 +21,7 @@ it automates the proposal of Boesten et al (2015)."> mkin - 1.2.0 + 1.2.2 @@ -63,7 +63,10 @@ it automates the proposal of Boesten et al (2015).">Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/sigma_twocomp-1.png b/docs/dev/reference/sigma_twocomp-1.png index 6e61684e..0353b72c 100644 Binary files a/docs/dev/reference/sigma_twocomp-1.png and b/docs/dev/reference/sigma_twocomp-1.png differ diff --git a/docs/dev/reference/sigma_twocomp.html b/docs/dev/reference/sigma_twocomp.html index b7d295b2..292bf8e8 100644 --- a/docs/dev/reference/sigma_twocomp.html +++ b/docs/dev/reference/sigma_twocomp.html @@ -1,68 +1,13 @@ - - - - - - - -Two-component error model — sigma_twocomp • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Two-component error model — sigma_twocomp • mkin + + - - - - -
    -
    - -
    - -
    +
    @@ -149,40 +94,43 @@ dependence of the measured value \(y\):" /> dependence of the measured value \(y\):

    -
    sigma_twocomp(y, sigma_low, rsd_high)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    y

    The magnitude of the observed value

    sigma_low

    The asymptotic minimum of the standard deviation for low -observed values

    rsd_high

    The coefficient describing the increase of the standard -deviation with the magnitude of the observed value

    - -

    Value

    - -

    The standard deviation of the response variable.

    -

    Details

    +
    +
    sigma_twocomp(y, sigma_low, rsd_high)
    +
    + +
    +

    Arguments

    +
    y
    +

    The magnitude of the observed value

    + +
    sigma_low
    +

    The asymptotic minimum of the standard deviation for low +observed values

    + + +
    rsd_high
    +

    The coefficient describing the increase of the standard +deviation with the magnitude of the observed value

    + +
    +
    +

    Value

    + + +

    The standard deviation of the response variable.

    +
    +
    +

    Details

    $$\sigma = \sqrt{ \sigma_{low}^2 + y^2 * {rsd}_{high}^2}$$ sigma = sqrt(sigma_low^2 + y^2 * rsd_high^2)

    This is the error model used for example by Werner et al. (1978). The model proposed by Rocke and Lorenzato (1995) can be written in this form as well, but assumes approximate lognormal distribution of errors for high values of y.

    -

    References

    - +
    +
    +

    References

    Werner, Mario, Brooks, Samuel H., and Knott, Lancaster B. (1978) Additive, Multiplicative, and Mixed Analytical Errors. Clinical Chemistry 24(11), 1895-1898.

    @@ -190,61 +138,62 @@ Additive, Multiplicative, and Mixed Analytical Errors. Clinical Chemistry measurement error in analytical chemistry. Technometrics 37(2), 176-184.

    Ranke J and Meinecke S (2019) Error Models for the Kinetic Evaluation of Chemical Degradation Data. Environments 6(12) 124 -doi: 10.3390/environments6120124 +doi:10.3390/environments6120124 .

    +
    -

    Examples

    -
    times <- c(0, 1, 3, 7, 14, 28, 60, 90, 120) -d_pred <- data.frame(time = times, parent = 100 * exp(- 0.03 * times)) -set.seed(123456) -d_syn <- add_err(d_pred, function(y) sigma_twocomp(y, 1, 0.07), - reps = 2, n = 1)[[1]] -f_nls <- nls(value ~ SSasymp(time, 0, parent_0, lrc), data = d_syn, - start = list(parent_0 = 100, lrc = -3)) -library(nlme) -f_gnls <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), - data = d_syn, na.action = na.omit, - start = list(parent_0 = 100, lrc = -3)) -if (length(findFunction("varConstProp")) > 0) { - f_gnls_tc <- update(f_gnls, weights = varConstProp()) - f_gnls_tc_sf <- update(f_gnls_tc, control = list(sigma = 1)) -} -f_mkin <- mkinfit("SFO", d_syn, error_model = "const", quiet = TRUE) -f_mkin_tc <- mkinfit("SFO", d_syn, error_model = "tc", quiet = TRUE) -plot_res(f_mkin_tc, standardized = TRUE) -
    AIC(f_nls, f_gnls, f_gnls_tc, f_gnls_tc_sf, f_mkin, f_mkin_tc) -
    #> df AIC -#> f_nls 3 114.4817 -#> f_gnls 3 114.4817 -#> f_gnls_tc 5 103.6447 -#> f_gnls_tc_sf 4 101.6447 -#> f_mkin 3 114.4817 -#> f_mkin_tc 4 101.6446
    +
    +

    Examples

    +
    times <- c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +d_pred <- data.frame(time = times, parent = 100 * exp(- 0.03 * times))
    +set.seed(123456)
    +d_syn <- add_err(d_pred, function(y) sigma_twocomp(y, 1, 0.07),
    +  reps = 2, n = 1)[[1]]
    +f_nls <- nls(value ~ SSasymp(time, 0, parent_0, lrc), data = d_syn,
    + start = list(parent_0 = 100, lrc = -3))
    +library(nlme)
    +f_gnls <- gnls(value ~ SSasymp(time, 0, parent_0, lrc),
    +  data = d_syn, na.action = na.omit,
    +  start = list(parent_0 = 100, lrc = -3))
    +if (length(findFunction("varConstProp")) > 0) {
    +  f_gnls_tc <- update(f_gnls, weights = varConstProp())
    +  f_gnls_tc_sf <- update(f_gnls_tc, control = list(sigma = 1))
    +}
    +f_mkin <- mkinfit("SFO", d_syn, error_model = "const", quiet = TRUE)
    +f_mkin_tc <- mkinfit("SFO", d_syn, error_model = "tc", quiet = TRUE)
    +plot_res(f_mkin_tc, standardized = TRUE)
    +
    +AIC(f_nls, f_gnls, f_gnls_tc, f_gnls_tc_sf, f_mkin, f_mkin_tc)
    +#>              df      AIC
    +#> f_nls         3 114.4817
    +#> f_gnls        3 114.4817
    +#> f_gnls_tc     5 103.6447
    +#> f_gnls_tc_sf  4 101.6447
    +#> f_mkin        3 114.4817
    +#> f_mkin_tc     4 101.6446
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/status.html b/docs/dev/reference/status.html index 4c856100..c3516f07 100644 --- a/docs/dev/reference/status.html +++ b/docs/dev/reference/status.html @@ -17,7 +17,7 @@ mkin - 1.2.0 + 1.2.2 @@ -59,7 +59,10 @@ Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/summary.mkinfit.html b/docs/dev/reference/summary.mkinfit.html index 3994a424..ad8432bf 100644 --- a/docs/dev/reference/summary.mkinfit.html +++ b/docs/dev/reference/summary.mkinfit.html @@ -21,7 +21,7 @@ values."> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Synthetic datasets for one parent compound with two metabolites — synthetic_data_for_UBA_2014 • mkin - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    -
    synthetic_data_for_UBA_2014
    +
    +
    synthetic_data_for_UBA_2014
    +
    +
    +

    Format

    +

    A list containing twelve datasets as an R6 class defined by mkinds, + each containing, among others, the following components

    title
    +

    The name of the dataset, e.g. SFO_lin_a

    -

    Format

    +
    data
    +

    A data frame with the data in the form expected by mkinfit

    -

    A list containing twelve datasets as an R6 class defined by mkinds, - each containing, among others, the following components

    -
    title

    The name of the dataset, e.g. SFO_lin_a

    -
    data

    A data frame with the data in the form expected by mkinfit

    -
    - -

    Source

    - +
    +
    +

    Source

    Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452

    Rocke, David M. und Lorenzato, Stefan (1995) A two-component model for measurement error in analytical chemistry. Technometrics 37(2), 176-184.

    +
    -

    Examples

    -
    # \dontrun{ -# The data have been generated using the following kinetic models -m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    - -m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2"), - sink = FALSE), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -m_synth_DFOP_lin <- mkinmod(parent = list(type = "DFOP", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2"), - sink = FALSE), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -# The model predictions without intentional error were generated as follows -sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) - -d_synth_SFO_lin <- mkinpredict(m_synth_SFO_lin, - c(k_parent = 0.7, f_parent_to_M1 = 0.8, - k_M1 = 0.3, f_M1_to_M2 = 0.7, - k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_DFOP_lin <- mkinpredict(m_synth_DFOP_lin, - c(k1 = 0.2, k2 = 0.02, g = 0.5, - f_parent_to_M1 = 0.5, k_M1 = 0.3, - f_M1_to_M2 = 0.7, k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_SFO_par <- mkinpredict(m_synth_SFO_par, - c(k_parent = 0.2, - f_parent_to_M1 = 0.8, k_M1 = 0.01, - f_parent_to_M2 = 0.2, k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_DFOP_par <- mkinpredict(m_synth_DFOP_par, - c(k1 = 0.3, k2 = 0.02, g = 0.7, - f_parent_to_M1 = 0.6, k_M1 = 0.04, - f_parent_to_M2 = 0.4, k_M2 = 0.01), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -# Construct names for datasets with errors -d_synth_names = paste0("d_synth_", c("SFO_lin", "SFO_par", - "DFOP_lin", "DFOP_par")) - -# Original function used or adding errors. The add_err function now published -# with this package is a slightly generalised version where the names of -# secondary compartments that should have an initial value of zero (M1 and M2 -# in this case) are not hardcoded any more. -# add_err = function(d, sdfunc, LOD = 0.1, reps = 2, seed = 123456789) -# { -# set.seed(seed) -# d_long = mkin_wide_to_long(d, time = "time") -# d_rep = data.frame(lapply(d_long, rep, each = 2)) -# d_rep$value = rnorm(length(d_rep$value), d_rep$value, sdfunc(d_rep$value)) -# -# d_rep[d_rep$time == 0 & d_rep$name %in% c("M1", "M2"), "value"] <- 0 -# d_NA <- transform(d_rep, value = ifelse(value < LOD, NA, value)) -# d_NA$value <- round(d_NA$value, 1) -# return(d_NA) -# } - -# The following is the simplified version of the two-component model of Rocke -# and Lorenzato (1995) -sdfunc_twocomp = function(value, sd_low, rsd_high) { - sqrt(sd_low^2 + value^2 * rsd_high^2) -} - -# Add the errors. -for (d_synth_name in d_synth_names) -{ - d_synth = get(d_synth_name) - assign(paste0(d_synth_name, "_a"), add_err(d_synth, function(value) 3)) - assign(paste0(d_synth_name, "_b"), add_err(d_synth, function(value) 7)) - assign(paste0(d_synth_name, "_c"), add_err(d_synth, - function(value) sdfunc_twocomp(value, 0.5, 0.07))) - -} - -d_synth_err_names = c( - paste(rep(d_synth_names, each = 3), letters[1:3], sep = "_") -) - -# This is just one example of an evaluation using the kinetic model used for -# the generation of the data - fit <- mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data, - quiet = TRUE) - plot_sep(fit) -
    summary(fit) -
    #> mkin version used for fitting: 1.0.3.9000 -#> R version used for fitting: 4.0.3 -#> Date of fit: Mon Feb 15 17:13:29 2021 -#> Date of summary: Mon Feb 15 17:13:29 2021 -#> -#> Equations: -#> d_parent/dt = - k_parent * parent -#> d_M1/dt = + f_parent_to_M1 * k_parent * parent - k_M1 * M1 -#> d_M2/dt = + f_M1_to_M2 * k_M1 * M1 - k_M2 * M2 -#> -#> Model predictions using solution type deSolve -#> -#> Fitted using 833 model solutions performed in 0.649 s -#> -#> Error model: Constant variance -#> -#> Error model algorithm: OLS -#> -#> Starting values for parameters to be optimised: -#> value type -#> parent_0 101.3500 state -#> k_parent 0.1000 deparm -#> k_M1 0.1001 deparm -#> k_M2 0.1002 deparm -#> f_parent_to_M1 0.5000 deparm -#> f_M1_to_M2 0.5000 deparm -#> -#> Starting values for the transformed parameters actually optimised: -#> value lower upper -#> parent_0 101.350000 -Inf Inf -#> log_k_parent -2.302585 -Inf Inf -#> log_k_M1 -2.301586 -Inf Inf -#> log_k_M2 -2.300587 -Inf Inf -#> f_parent_qlogis 0.000000 -Inf Inf -#> f_M1_qlogis 0.000000 -Inf Inf -#> -#> Fixed parameter values: -#> value type -#> M1_0 0 state -#> M2_0 0 state -#> -#> Results: -#> -#> AIC BIC logLik -#> 188.7274 200.3723 -87.36368 -#> -#> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 102.1000 1.57000 98.8600 105.3000 -#> log_k_parent -0.3020 0.03885 -0.3812 -0.2229 -#> log_k_M1 -1.2070 0.07123 -1.3520 -1.0620 -#> log_k_M2 -3.9010 0.06571 -4.0350 -3.7670 -#> f_parent_qlogis 1.2010 0.23530 0.7216 1.6800 -#> f_M1_qlogis 0.9589 0.24890 0.4520 1.4660 -#> sigma 2.2730 0.25740 1.7490 2.7970 -#> -#> Parameter correlation: -#> parent_0 log_k_parent log_k_M1 log_k_M2 f_parent_qlogis -#> parent_0 1.000e+00 3.933e-01 -1.605e-01 2.819e-02 -4.624e-01 -#> log_k_parent 3.933e-01 1.000e+00 -4.082e-01 7.166e-02 -5.682e-01 -#> log_k_M1 -1.605e-01 -4.082e-01 1.000e+00 -3.929e-01 7.478e-01 -#> log_k_M2 2.819e-02 7.166e-02 -3.929e-01 1.000e+00 -2.658e-01 -#> f_parent_qlogis -4.624e-01 -5.682e-01 7.478e-01 -2.658e-01 1.000e+00 -#> f_M1_qlogis 1.614e-01 4.102e-01 -8.109e-01 5.419e-01 -8.605e-01 -#> sigma -2.900e-08 -8.030e-09 -2.741e-08 3.938e-08 -2.681e-08 -#> f_M1_qlogis sigma -#> parent_0 1.614e-01 -2.900e-08 -#> log_k_parent 4.102e-01 -8.030e-09 -#> log_k_M1 -8.109e-01 -2.741e-08 -#> log_k_M2 5.419e-01 3.938e-08 -#> f_parent_qlogis -8.605e-01 -2.681e-08 -#> f_M1_qlogis 1.000e+00 4.971e-08 -#> sigma 4.971e-08 1.000e+00 -#> -#> 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 102.10000 65.000 7.281e-36 98.86000 105.30000 -#> k_parent 0.73930 25.740 2.948e-23 0.68310 0.80020 -#> k_M1 0.29920 14.040 1.577e-15 0.25880 0.34590 -#> k_M2 0.02023 15.220 1.653e-16 0.01769 0.02312 -#> f_parent_to_M1 0.76870 18.370 7.295e-19 0.67300 0.84290 -#> f_M1_to_M2 0.72290 14.500 6.418e-16 0.61110 0.81240 -#> sigma 2.27300 8.832 2.161e-10 1.74900 2.79700 -#> -#> FOCUS Chi2 error levels in percent: -#> err.min n.optim df -#> All data 8.454 6 17 -#> parent 8.660 2 6 -#> M1 10.583 2 5 -#> M2 3.586 2 6 -#> -#> Resulting formation fractions: -#> ff -#> parent_M1 0.7687 -#> parent_sink 0.2313 -#> M1_M2 0.7229 -#> M1_sink 0.2771 -#> -#> Estimated disappearance times: -#> DT50 DT90 -#> parent 0.9376 3.114 -#> M1 2.3170 7.697 -#> M2 34.2689 113.839 -#> -#> Data: -#> time variable observed predicted residual -#> 0 parent 101.5 1.021e+02 -0.56248 -#> 0 parent 101.2 1.021e+02 -0.86248 -#> 1 parent 53.9 4.873e+01 5.17118 -#> 1 parent 47.5 4.873e+01 -1.22882 -#> 3 parent 10.4 1.111e+01 -0.70773 -#> 3 parent 7.6 1.111e+01 -3.50773 -#> 7 parent 1.1 5.772e-01 0.52283 -#> 7 parent 0.3 5.772e-01 -0.27717 -#> 14 parent 3.5 3.264e-03 3.49674 -#> 28 parent 3.2 1.045e-07 3.20000 -#> 90 parent 0.6 9.530e-10 0.60000 -#> 120 parent 3.5 -5.940e-10 3.50000 -#> 1 M1 36.4 3.479e+01 1.61088 -#> 1 M1 37.4 3.479e+01 2.61088 -#> 3 M1 34.3 3.937e+01 -5.07027 -#> 3 M1 39.8 3.937e+01 0.42973 -#> 7 M1 15.1 1.549e+01 -0.38715 -#> 7 M1 17.8 1.549e+01 2.31285 -#> 14 M1 5.8 1.995e+00 3.80469 -#> 14 M1 1.2 1.995e+00 -0.79531 -#> 60 M1 0.5 2.111e-06 0.50000 -#> 90 M1 3.2 -9.670e-10 3.20000 -#> 120 M1 1.5 7.670e-10 1.50000 -#> 120 M1 0.6 7.670e-10 0.60000 -#> 1 M2 4.8 4.455e+00 0.34517 -#> 3 M2 20.9 2.153e+01 -0.62527 -#> 3 M2 19.3 2.153e+01 -2.22527 -#> 7 M2 42.0 4.192e+01 0.07941 -#> 7 M2 43.1 4.192e+01 1.17941 -#> 14 M2 49.4 4.557e+01 3.83353 -#> 14 M2 44.3 4.557e+01 -1.26647 -#> 28 M2 34.6 3.547e+01 -0.87275 -#> 28 M2 33.0 3.547e+01 -2.47275 -#> 60 M2 18.8 1.858e+01 0.21837 -#> 60 M2 17.6 1.858e+01 -0.98163 -#> 90 M2 10.6 1.013e+01 0.47130 -#> 90 M2 10.8 1.013e+01 0.67130 -#> 120 M2 9.8 5.521e+00 4.27893 -#> 120 M2 3.3 5.521e+00 -2.22107
    # } -
    +
    +

    Examples

    +
    # \dontrun{
    +# The data have been generated using the following kinetic models
    +m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"),
    +                           M1 = list(type = "SFO", to = "M2"),
    +                           M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +
    +m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2"),
    +                                         sink = FALSE),
    +                           M1 = list(type = "SFO"),
    +                           M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +m_synth_DFOP_lin <- mkinmod(parent = list(type = "DFOP", to = "M1"),
    +                            M1 = list(type = "SFO", to = "M2"),
    +                            M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2"),
    +                                          sink = FALSE),
    +                            M1 = list(type = "SFO"),
    +                            M2 = list(type = "SFO"), use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +# The model predictions without intentional error were generated as follows
    +sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
    +
    +d_synth_SFO_lin <- mkinpredict(m_synth_SFO_lin,
    +                               c(k_parent = 0.7, f_parent_to_M1 = 0.8,
    +                                 k_M1 = 0.3, f_M1_to_M2 = 0.7,
    +                                 k_M2 = 0.02),
    +                               c(parent = 100, M1 = 0, M2 = 0),
    +                               sampling_times)
    +
    +d_synth_DFOP_lin <- mkinpredict(m_synth_DFOP_lin,
    +                                c(k1 = 0.2, k2 = 0.02, g = 0.5,
    +                                  f_parent_to_M1 = 0.5, k_M1 = 0.3,
    +                                  f_M1_to_M2 = 0.7, k_M2 = 0.02),
    +                                 c(parent = 100, M1 = 0, M2 = 0),
    +                                 sampling_times)
    +
    +d_synth_SFO_par <- mkinpredict(m_synth_SFO_par,
    +                               c(k_parent = 0.2,
    +                                 f_parent_to_M1 = 0.8, k_M1 = 0.01,
    +                                 f_parent_to_M2 = 0.2, k_M2 = 0.02),
    +                                 c(parent = 100, M1 = 0, M2 = 0),
    +                                 sampling_times)
    +
    +d_synth_DFOP_par <- mkinpredict(m_synth_DFOP_par,
    +                               c(k1 = 0.3, k2 = 0.02, g = 0.7,
    +                                 f_parent_to_M1 = 0.6, k_M1 = 0.04,
    +                                 f_parent_to_M2 = 0.4, k_M2 = 0.01),
    +                                 c(parent = 100, M1 = 0, M2 = 0),
    +                                 sampling_times)
    +
    +# Construct names for datasets with errors
    +d_synth_names = paste0("d_synth_", c("SFO_lin", "SFO_par",
    +                                     "DFOP_lin", "DFOP_par"))
    +
    +# Original function used or adding errors. The add_err function now published
    +# with this package is a slightly generalised version where the names of
    +# secondary compartments that should have an initial value of zero (M1 and M2
    +# in this case) are not hardcoded any more.
    +# add_err = function(d, sdfunc, LOD = 0.1, reps = 2, seed = 123456789)
    +# {
    +#   set.seed(seed)
    +#   d_long = mkin_wide_to_long(d, time = "time")
    +#   d_rep = data.frame(lapply(d_long, rep, each = 2))
    +#   d_rep$value = rnorm(length(d_rep$value), d_rep$value, sdfunc(d_rep$value))
    +#
    +#   d_rep[d_rep$time == 0 & d_rep$name %in% c("M1", "M2"), "value"] <- 0
    +#   d_NA <- transform(d_rep, value = ifelse(value < LOD, NA, value))
    +#   d_NA$value <- round(d_NA$value, 1)
    +#   return(d_NA)
    +# }
    +
    +# The following is the simplified version of the two-component model of Rocke
    +# and Lorenzato (1995)
    +sdfunc_twocomp = function(value, sd_low, rsd_high) {
    +  sqrt(sd_low^2 + value^2 * rsd_high^2)
    +}
    +
    +# Add the errors.
    +for (d_synth_name in d_synth_names)
    +{
    +  d_synth = get(d_synth_name)
    +  assign(paste0(d_synth_name, "_a"), add_err(d_synth, function(value) 3))
    +  assign(paste0(d_synth_name, "_b"), add_err(d_synth, function(value) 7))
    +  assign(paste0(d_synth_name, "_c"), add_err(d_synth,
    +                           function(value) sdfunc_twocomp(value, 0.5, 0.07)))
    +
    +}
    +
    +d_synth_err_names = c(
    +  paste(rep(d_synth_names, each = 3), letters[1:3], sep = "_")
    +)
    +
    +# This is just one example of an evaluation using the kinetic model used for
    +# the generation of the data
    +  fit <- mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data,
    +                 quiet = TRUE)
    +  plot_sep(fit)
    +
    +  summary(fit)
    +#> mkin version used for fitting:    1.2.2 
    +#> R version used for fitting:       4.2.2 
    +#> Date of fit:     Thu Nov 24 08:11:54 2022 
    +#> Date of summary: Thu Nov 24 08:11:54 2022 
    +#> 
    +#> Equations:
    +#> d_parent/dt = - k_parent * parent
    +#> d_M1/dt = + f_parent_to_M1 * k_parent * parent - k_M1 * M1
    +#> d_M2/dt = + f_M1_to_M2 * k_M1 * M1 - k_M2 * M2
    +#> 
    +#> Model predictions using solution type deSolve 
    +#> 
    +#> Fitted using 833 model solutions performed in 0.574 s
    +#> 
    +#> Error model: Constant variance 
    +#> 
    +#> Error model algorithm: OLS 
    +#> 
    +#> Starting values for parameters to be optimised:
    +#>                   value   type
    +#> parent_0       101.3500  state
    +#> k_parent         0.1000 deparm
    +#> k_M1             0.1001 deparm
    +#> k_M2             0.1002 deparm
    +#> f_parent_to_M1   0.5000 deparm
    +#> f_M1_to_M2       0.5000 deparm
    +#> 
    +#> Starting values for the transformed parameters actually optimised:
    +#>                      value lower upper
    +#> parent_0        101.350000  -Inf   Inf
    +#> log_k_parent     -2.302585  -Inf   Inf
    +#> log_k_M1         -2.301586  -Inf   Inf
    +#> log_k_M2         -2.300587  -Inf   Inf
    +#> f_parent_qlogis   0.000000  -Inf   Inf
    +#> f_M1_qlogis       0.000000  -Inf   Inf
    +#> 
    +#> Fixed parameter values:
    +#>      value  type
    +#> M1_0     0 state
    +#> M2_0     0 state
    +#> 
    +#> Results:
    +#> 
    +#>        AIC      BIC    logLik
    +#>   188.7274 200.3723 -87.36368
    +#> 
    +#> Optimised, transformed parameters with symmetric confidence intervals:
    +#>                 Estimate Std. Error   Lower    Upper
    +#> parent_0        102.1000    1.57000 98.8600 105.3000
    +#> log_k_parent     -0.3020    0.03885 -0.3812  -0.2229
    +#> log_k_M1         -1.2070    0.07123 -1.3520  -1.0620
    +#> log_k_M2         -3.9010    0.06571 -4.0350  -3.7670
    +#> f_parent_qlogis   1.2010    0.23530  0.7216   1.6800
    +#> f_M1_qlogis       0.9589    0.24890  0.4520   1.4660
    +#> sigma             2.2730    0.25740  1.7490   2.7970
    +#> 
    +#> Parameter correlation:
    +#>                   parent_0 log_k_parent   log_k_M1   log_k_M2 f_parent_qlogis
    +#> parent_0         1.000e+00    3.933e-01 -1.605e-01  2.819e-02      -4.624e-01
    +#> log_k_parent     3.933e-01    1.000e+00 -4.082e-01  7.166e-02      -5.682e-01
    +#> log_k_M1        -1.605e-01   -4.082e-01  1.000e+00 -3.929e-01       7.478e-01
    +#> log_k_M2         2.819e-02    7.166e-02 -3.929e-01  1.000e+00      -2.658e-01
    +#> f_parent_qlogis -4.624e-01   -5.682e-01  7.478e-01 -2.658e-01       1.000e+00
    +#> f_M1_qlogis      1.614e-01    4.102e-01 -8.109e-01  5.419e-01      -8.605e-01
    +#> sigma           -2.900e-08   -8.030e-09 -2.741e-08  3.938e-08      -2.681e-08
    +#>                 f_M1_qlogis      sigma
    +#> parent_0          1.614e-01 -2.900e-08
    +#> log_k_parent      4.102e-01 -8.030e-09
    +#> log_k_M1         -8.109e-01 -2.741e-08
    +#> log_k_M2          5.419e-01  3.938e-08
    +#> f_parent_qlogis  -8.605e-01 -2.681e-08
    +#> f_M1_qlogis       1.000e+00  4.971e-08
    +#> sigma             4.971e-08  1.000e+00
    +#> 
    +#> 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       102.10000  65.000 7.281e-36 98.86000 105.30000
    +#> k_parent         0.73930  25.740 2.948e-23  0.68310   0.80020
    +#> k_M1             0.29920  14.040 1.577e-15  0.25880   0.34590
    +#> k_M2             0.02023  15.220 1.653e-16  0.01769   0.02312
    +#> f_parent_to_M1   0.76870  18.370 7.295e-19  0.67300   0.84290
    +#> f_M1_to_M2       0.72290  14.500 6.418e-16  0.61110   0.81240
    +#> sigma            2.27300   8.832 2.161e-10  1.74900   2.79700
    +#> 
    +#> FOCUS Chi2 error levels in percent:
    +#>          err.min n.optim df
    +#> All data   8.454       6 17
    +#> parent     8.660       2  6
    +#> M1        10.583       2  5
    +#> M2         3.586       2  6
    +#> 
    +#> Resulting formation fractions:
    +#>                 ff
    +#> parent_M1   0.7687
    +#> parent_sink 0.2313
    +#> M1_M2       0.7229
    +#> M1_sink     0.2771
    +#> 
    +#> Estimated disappearance times:
    +#>           DT50    DT90
    +#> parent  0.9376   3.114
    +#> M1      2.3170   7.697
    +#> M2     34.2689 113.839
    +#> 
    +#> Data:
    +#>  time variable observed  predicted residual
    +#>     0   parent    101.5  1.021e+02 -0.56248
    +#>     0   parent    101.2  1.021e+02 -0.86248
    +#>     1   parent     53.9  4.873e+01  5.17118
    +#>     1   parent     47.5  4.873e+01 -1.22882
    +#>     3   parent     10.4  1.111e+01 -0.70773
    +#>     3   parent      7.6  1.111e+01 -3.50773
    +#>     7   parent      1.1  5.772e-01  0.52283
    +#>     7   parent      0.3  5.772e-01 -0.27717
    +#>    14   parent      3.5  3.264e-03  3.49674
    +#>    28   parent      3.2  1.045e-07  3.20000
    +#>    90   parent      0.6  9.530e-10  0.60000
    +#>   120   parent      3.5 -5.940e-10  3.50000
    +#>     1       M1     36.4  3.479e+01  1.61088
    +#>     1       M1     37.4  3.479e+01  2.61088
    +#>     3       M1     34.3  3.937e+01 -5.07027
    +#>     3       M1     39.8  3.937e+01  0.42973
    +#>     7       M1     15.1  1.549e+01 -0.38715
    +#>     7       M1     17.8  1.549e+01  2.31285
    +#>    14       M1      5.8  1.995e+00  3.80469
    +#>    14       M1      1.2  1.995e+00 -0.79531
    +#>    60       M1      0.5  2.111e-06  0.50000
    +#>    90       M1      3.2 -9.670e-10  3.20000
    +#>   120       M1      1.5  7.670e-10  1.50000
    +#>   120       M1      0.6  7.670e-10  0.60000
    +#>     1       M2      4.8  4.455e+00  0.34517
    +#>     3       M2     20.9  2.153e+01 -0.62527
    +#>     3       M2     19.3  2.153e+01 -2.22527
    +#>     7       M2     42.0  4.192e+01  0.07941
    +#>     7       M2     43.1  4.192e+01  1.17941
    +#>    14       M2     49.4  4.557e+01  3.83353
    +#>    14       M2     44.3  4.557e+01 -1.26647
    +#>    28       M2     34.6  3.547e+01 -0.87275
    +#>    28       M2     33.0  3.547e+01 -2.47275
    +#>    60       M2     18.8  1.858e+01  0.21837
    +#>    60       M2     17.6  1.858e+01 -0.98163
    +#>    90       M2     10.6  1.013e+01  0.47130
    +#>    90       M2     10.8  1.013e+01  0.67130
    +#>   120       M2      9.8  5.521e+00  4.27893
    +#>   120       M2      3.3  5.521e+00 -2.22107
    +# }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/test_data_from_UBA_2014-1.png b/docs/dev/reference/test_data_from_UBA_2014-1.png index 7bf0bd0f..e4fc2a4c 100644 Binary files a/docs/dev/reference/test_data_from_UBA_2014-1.png and b/docs/dev/reference/test_data_from_UBA_2014-1.png differ diff --git a/docs/dev/reference/test_data_from_UBA_2014-2.png b/docs/dev/reference/test_data_from_UBA_2014-2.png index fc1f77e0..4ce36561 100644 Binary files a/docs/dev/reference/test_data_from_UBA_2014-2.png and b/docs/dev/reference/test_data_from_UBA_2014-2.png differ diff --git a/docs/dev/reference/test_data_from_UBA_2014.html b/docs/dev/reference/test_data_from_UBA_2014.html index 539b8287..05529e0e 100644 --- a/docs/dev/reference/test_data_from_UBA_2014.html +++ b/docs/dev/reference/test_data_from_UBA_2014.html @@ -1,68 +1,13 @@ - - - - - - - -Three experimental datasets from two water sediment systems and one soil — test_data_from_UBA_2014 • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Three experimental datasets from two water sediment systems and one soil — test_data_from_UBA_2014 • mkin - - - - + + -
    -
    - -
    - -
    +
    -
    test_data_from_UBA_2014
    +
    +
    test_data_from_UBA_2014
    +
    +
    +

    Format

    +

    A list containing three datasets as an R6 class defined by mkinds. + Each dataset has, among others, the following components

    title
    +

    The name of the dataset, e.g. UBA_2014_WS_river

    -

    Format

    +
    data
    +

    A data frame with the data in the form expected by mkinfit

    -

    A list containing three datasets as an R6 class defined by mkinds. - Each dataset has, among others, the following components

    -
    title

    The name of the dataset, e.g. UBA_2014_WS_river

    -
    data

    A data frame with the data in the form expected by mkinfit

    -
    - -

    Source

    - +
    +
    +

    Source

    Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452

    +
    -

    Examples

    -
    # \dontrun{ - # This is a level P-II evaluation of the dataset according to the FOCUS kinetics - # guidance. Due to the strong correlation of the parameter estimates, the - # covariance matrix is not returned. Note that level P-II evaluations are - # generally considered deprecated due to the frequent occurrence of such - # large parameter correlations, among other reasons (e.g. the adequacy of the - # model). - m_ws <- mkinmod(parent_w = mkinsub("SFO", "parent_s"), - parent_s = mkinsub("SFO", "parent_w")) -
    #> Temporary DLL for differentials generated and loaded
    f_river <- mkinfit(m_ws, test_data_from_UBA_2014[[1]]$data, quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    plot_sep(f_river) -
    - summary(f_river)$bpar -
    #> Warning: Could not calculate correlation; no covariance matrix
    #> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_w_0 95.91998118 NA NA NA NA NA -#> k_parent_w 0.41145375 NA NA NA NA NA -#> k_parent_s 0.04663944 NA NA NA NA NA -#> f_parent_w_to_parent_s 0.12467894 NA NA NA NA NA -#> f_parent_s_to_parent_w 0.50000000 NA NA NA NA NA -#> sigma 3.13612618 NA NA NA NA NA
    mkinerrmin(f_river) -
    #> err.min n.optim df -#> All data 0.1090929 5 6 -#> parent_w 0.0817436 3 3 -#> parent_s 0.1619965 2 3
    - # This is the evaluation used for the validation of software packages - # in the expertise from 2014 - m_soil <- mkinmod(parent = mkinsub("SFO", c("M1", "M2")), - M1 = mkinsub("SFO", "M3"), - M2 = mkinsub("SFO", "M3"), - M3 = mkinsub("SFO"), - use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    - f_soil <- mkinfit(m_soil, test_data_from_UBA_2014[[3]]$data, quiet = TRUE) -
    #> Warning: Observations with value of zero were removed from the data
    plot_sep(f_soil, lpos = c("topright", "topright", "topright", "bottomright")) -
    summary(f_soil)$bpar -
    #> Estimate se_notrans t value Pr(>t) Lower -#> parent_0 76.55425650 0.859186399 89.1008710 1.113861e-26 74.755959418 -#> k_parent 0.12081956 0.004601918 26.2541722 1.077359e-16 0.111561575 -#> k_M1 0.84258615 0.806160102 1.0451846 1.545268e-01 0.113779609 -#> k_M2 0.04210880 0.017083034 2.4649483 1.170188e-02 0.018013857 -#> k_M3 0.01122918 0.007245856 1.5497385 6.885052e-02 0.002909431 -#> f_parent_to_M1 0.32240200 0.240783943 1.3389680 9.819076e-02 NA -#> f_parent_to_M2 0.16099855 0.033691952 4.7785464 6.531136e-05 NA -#> f_M1_to_M3 0.27921507 0.269423780 1.0363416 1.565267e-01 0.022978205 -#> f_M2_to_M3 0.55641252 0.595119966 0.9349586 1.807707e-01 0.008002509 -#> sigma 1.14005399 0.149696423 7.6157731 1.727024e-07 0.826735778 -#> Upper -#> parent_0 78.35255358 -#> k_parent 0.13084582 -#> k_M1 6.23970702 -#> k_M2 0.09843260 -#> k_M3 0.04333992 -#> f_parent_to_M1 NA -#> f_parent_to_M2 NA -#> f_M1_to_M3 0.86450775 -#> f_M2_to_M3 0.99489895 -#> sigma 1.45337221
    mkinerrmin(f_soil) -
    #> err.min n.optim df -#> All data 0.09649963 9 20 -#> parent 0.04721283 2 6 -#> M1 0.26551208 2 5 -#> M2 0.20327575 2 5 -#> M3 0.05196550 3 4
    # } -
    +
    +

    Examples

    +
      # \dontrun{
    +  # This is a level P-II evaluation of the dataset according to the FOCUS kinetics
    +  # guidance. Due to the strong correlation of the parameter estimates, the
    +  # covariance matrix is not returned. Note that level P-II evaluations are
    +  # generally considered deprecated due to the frequent occurrence of such
    +  # large parameter correlations, among other reasons (e.g. the adequacy of the
    +  # model).
    +  m_ws <- mkinmod(parent_w = mkinsub("SFO", "parent_s"),
    +                  parent_s = mkinsub("SFO", "parent_w"))
    +#> Temporary DLL for differentials generated and loaded
    +  f_river <- mkinfit(m_ws, test_data_from_UBA_2014[[1]]$data, quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +  plot_sep(f_river)
    +
    +
    +  summary(f_river)$bpar
    +#> Warning: Could not calculate correlation; no covariance matrix
    +#>                           Estimate se_notrans t value Pr(>t) Lower Upper
    +#> parent_w_0             95.91998118         NA      NA     NA    NA    NA
    +#> k_parent_w              0.41145375         NA      NA     NA    NA    NA
    +#> k_parent_s              0.04663944         NA      NA     NA    NA    NA
    +#> f_parent_w_to_parent_s  0.12467894         NA      NA     NA    NA    NA
    +#> f_parent_s_to_parent_w  0.50000000         NA      NA     NA    NA    NA
    +#> sigma                   3.13612618         NA      NA     NA    NA    NA
    +  mkinerrmin(f_river)
    +#>            err.min n.optim df
    +#> All data 0.1090929       5  6
    +#> parent_w 0.0817436       3  3
    +#> parent_s 0.1619965       2  3
    +
    +  # This is the evaluation used for the validation of software packages
    +  # in the expertise from 2014
    +  m_soil <- mkinmod(parent = mkinsub("SFO", c("M1", "M2")),
    +                    M1 = mkinsub("SFO", "M3"),
    +                    M2 = mkinsub("SFO", "M3"),
    +                    M3 = mkinsub("SFO"),
    +                    use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +  f_soil <- mkinfit(m_soil, test_data_from_UBA_2014[[3]]$data, quiet = TRUE)
    +#> Warning: Observations with value of zero were removed from the data
    +  plot_sep(f_soil, lpos = c("topright", "topright", "topright", "bottomright"))
    +
    +  summary(f_soil)$bpar
    +#>                   Estimate  se_notrans    t value       Pr(>t)        Lower
    +#> parent_0       76.55425650 0.859186399 89.1008710 1.113861e-26 74.755959418
    +#> k_parent        0.12081956 0.004601918 26.2541722 1.077359e-16  0.111561575
    +#> k_M1            0.84258615 0.806160102  1.0451846 1.545268e-01  0.113779609
    +#> k_M2            0.04210880 0.017083034  2.4649483 1.170188e-02  0.018013857
    +#> k_M3            0.01122918 0.007245856  1.5497385 6.885052e-02  0.002909431
    +#> f_parent_to_M1  0.32240200 0.240783943  1.3389680 9.819076e-02           NA
    +#> f_parent_to_M2  0.16099855 0.033691952  4.7785464 6.531136e-05           NA
    +#> f_M1_to_M3      0.27921507 0.269423780  1.0363416 1.565267e-01  0.022978205
    +#> f_M2_to_M3      0.55641252 0.595119966  0.9349586 1.807707e-01  0.008002509
    +#> sigma           1.14005399 0.149696423  7.6157731 1.727024e-07  0.826735778
    +#>                      Upper
    +#> parent_0       78.35255358
    +#> k_parent        0.13084582
    +#> k_M1            6.23970702
    +#> k_M2            0.09843260
    +#> k_M3            0.04333992
    +#> f_parent_to_M1          NA
    +#> f_parent_to_M2          NA
    +#> f_M1_to_M3      0.86450775
    +#> f_M2_to_M3      0.99489895
    +#> sigma           1.45337221
    +  mkinerrmin(f_soil)
    +#>             err.min n.optim df
    +#> All data 0.09649963       9 20
    +#> parent   0.04721283       2  6
    +#> M1       0.26551208       2  5
    +#> M2       0.20327575       2  5
    +#> M3       0.05196550       3  4
    +  # }
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/tex_listing.html b/docs/dev/reference/tex_listing.html index c82138b7..03bd83f2 100644 --- a/docs/dev/reference/tex_listing.html +++ b/docs/dev/reference/tex_listing.html @@ -18,7 +18,7 @@ option results = "asis".'> mkin - 1.2.0 + 1.2.2 @@ -60,7 +60,10 @@ option results = "asis".'> Example evaluation of NAFTA SOP Attachment examples
  • - Some benchmark timings + Benchmark timings for mkin +
  • +
  • + Benchmark timings for saem.mmkin
  • diff --git a/docs/dev/reference/transform_odeparms.html b/docs/dev/reference/transform_odeparms.html index 75d6a1f9..a7a01043 100644 --- a/docs/dev/reference/transform_odeparms.html +++ b/docs/dev/reference/transform_odeparms.html @@ -1,72 +1,17 @@ - - - - - - - -Functions to transform and backtransform kinetic parameters for fitting — transform_odeparms • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Functions to transform and backtransform kinetic parameters for fitting — transform_odeparms • mkin - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +
    @@ -154,205 +99,221 @@ restricted values to the full scale of real numbers. For kinetic rate constants and other parameters that can only take on positive values, a simple log transformation is used. For compositional parameters, such as the formations fractions that should always sum up to 1 and can not be negative, -the ilr transformation is used.

    +the ilr transformation is used.

    +
    + +
    +
    transform_odeparms(
    +  parms,
    +  mkinmod,
    +  transform_rates = TRUE,
    +  transform_fractions = TRUE
    +)
    +
    +backtransform_odeparms(
    +  transparms,
    +  mkinmod,
    +  transform_rates = TRUE,
    +  transform_fractions = TRUE
    +)
    -
    transform_odeparms(
    -  parms,
    -  mkinmod,
    -  transform_rates = TRUE,
    -  transform_fractions = TRUE
    -)
    +    
    +

    Arguments

    +
    parms
    +

    Parameters of kinetic models as used in the differential +equations.

    -backtransform_odeparms( - transparms, - mkinmod, - transform_rates = TRUE, - transform_fractions = TRUE -)
    -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    parms

    Parameters of kinetic models as used in the differential -equations.

    mkinmod

    The kinetic model of class mkinmod, containing +

    mkinmod
    +

    The kinetic model of class mkinmod, containing the names of the model variables that are needed for grouping the -formation fractions before ilr transformation, the parameter -names and the information if the pathway to sink is included in the model.

    transform_rates

    Boolean specifying if kinetic rate constants should +formation fractions before ilr transformation, the parameter +names and the information if the pathway to sink is included in the model.

    + + +
    transform_rates
    +

    Boolean specifying if kinetic rate constants should be transformed in the model specification used in the fitting for better compliance with the assumption of normal distribution of the estimator. If TRUE, also alpha and beta parameters of the FOMC model are log-transformed, as well as k1 and k2 rate constants for the DFOP and HS -models and the break point tb of the HS model.

    transform_fractions

    Boolean specifying if formation fractions +models and the break point tb of the HS model.

    + + +
    transform_fractions
    +

    Boolean specifying if formation fractions constants should be transformed in the model specification used in the fitting for better compliance with the assumption of normal distribution of the estimator. The default (TRUE) is to do transformations. The g parameter of the DFOP model is also seen as a fraction. If a single fraction is transformed (g parameter of DFOP or only a single target variable e.g. a single metabolite plus a pathway to sink), a -logistic transformation is used stats::qlogis(). In other cases, i.e. if +logistic transformation is used stats::qlogis(). In other cases, i.e. if two or more formation fractions need to be transformed whose sum cannot -exceed one, the ilr transformation is used.

    transparms

    Transformed parameters of kinetic models as used in the -fitting procedure.

    +exceed one, the ilr transformation is used.

    + -

    Value

    +
    transparms
    +

    Transformed parameters of kinetic models as used in the +fitting procedure.

    -

    A vector of transformed or backtransformed parameters

    -

    Details

    +
    +
    +

    Value

    + +

    A vector of transformed or backtransformed parameters

    +
    +
    +

    Details

    The transformation of sets of formation fractions is fragile, as it supposes the same ordering of the components in forward and backward transformation. -This is no problem for the internal use in mkinfit.

    -

    Author

    - +This is no problem for the internal use in mkinfit.

    +
    +
    +

    Author

    Johannes Ranke

    +
    -

    Examples

    -
    -SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = TRUE), - m1 = list(type = "SFO"), use_of_ff = "min") -
    #> Temporary DLL for differentials generated and loaded
    -# Fit the model to the FOCUS example dataset D using defaults -FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning -fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE) -fit.s <- summary(fit) -# Transformed and backtransformed parameters -print(fit.s$par, 3) -
    #> Estimate Std. Error Lower Upper -#> parent_0 99.60 1.5702 96.40 102.79 -#> log_k_parent_sink -3.04 0.0763 -3.19 -2.88 -#> log_k_parent_m1 -2.98 0.0403 -3.06 -2.90 -#> log_k_m1_sink -5.25 0.1332 -5.52 -4.98 -#> sigma 3.13 0.3585 2.40 3.85
    print(fit.s$bpar, 3) -
    #> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 102.7931 -#> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04103 0.0560 -#> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04678 0.0551 -#> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
    -# \dontrun{ -# Compare to the version without transforming rate parameters (does not work -# with analytical solution, we get NA values for m1 in predictions) -fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE, - solution_type = "deSolve", quiet = TRUE) -fit.2.s <- summary(fit.2) -print(fit.2.s$par, 3) -
    #> Estimate Std. Error Lower Upper -#> parent_0 99.59848 1.57022 96.40384 1.03e+02 -#> k_parent_sink 0.04792 0.00365 0.04049 5.54e-02 -#> k_parent_m1 0.05078 0.00205 0.04661 5.49e-02 -#> k_m1_sink 0.00526 0.00070 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 2.39609 3.85e+00
    print(fit.2.s$bpar, 3) -
    #> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 1.03e+02 -#> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04049 5.54e-02 -#> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04661 5.49e-02 -#> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.85e+00
    # } - -initials <- fit$start$value -names(initials) <- rownames(fit$start) -transformed <- fit$start_transformed$value -names(transformed) <- rownames(fit$start_transformed) -transform_odeparms(initials, SFO_SFO) -
    #> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink -#> 100.750000 -2.302585 -2.301586 -2.300587
    backtransform_odeparms(transformed, SFO_SFO) -
    #> parent_0 k_parent_sink k_parent_m1 k_m1_sink -#> 100.7500 0.1000 0.1001 0.1002
    -# \dontrun{ -# The case of formation fractions (this is now the default) -SFO_SFO.ff <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = TRUE), - m1 = list(type = "SFO"), - use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    -fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE) -fit.ff.s <- summary(fit.ff) -print(fit.ff.s$par, 3) -
    #> Estimate Std. Error Lower Upper -#> parent_0 99.5985 1.5702 96.404 102.79 -#> log_k_parent -2.3157 0.0409 -2.399 -2.23 -#> log_k_m1 -5.2475 0.1332 -5.518 -4.98 -#> f_parent_qlogis 0.0579 0.0893 -0.124 0.24 -#> sigma 3.1255 0.3585 2.396 3.85
    print(fit.ff.s$bpar, 3) -
    #> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40383 102.7931 -#> k_parent 0.09870 0.00403 24.47 4.96e-23 0.09082 0.1073 -#> k_m1 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 -#> f_parent_to_m1 0.51448 0.02230 23.07 3.10e-22 0.46912 0.5596 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
    initials <- c("f_parent_to_m1" = 0.5) -transformed <- transform_odeparms(initials, SFO_SFO.ff) -backtransform_odeparms(transformed, SFO_SFO.ff) -
    #> f_parent_to_m1 -#> 0.5
    -# And without sink -SFO_SFO.ff.2 <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = FALSE), - m1 = list(type = "SFO"), - use_of_ff = "max") -
    #> Temporary DLL for differentials generated and loaded
    - -fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE) -fit.ff.2.s <- summary(fit.ff.2) -print(fit.ff.2.s$par, 3) -
    #> Estimate Std. Error Lower Upper -#> parent_0 84.79 3.012 78.67 90.91 -#> log_k_parent -2.76 0.082 -2.92 -2.59 -#> log_k_m1 -4.21 0.123 -4.46 -3.96 -#> sigma 8.22 0.943 6.31 10.14
    print(fit.ff.2.s$bpar, 3) -
    #> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 84.7916 3.01203 28.15 1.92e-25 78.6704 90.913 -#> k_parent 0.0635 0.00521 12.19 2.91e-14 0.0538 0.075 -#> k_m1 0.0148 0.00182 8.13 8.81e-10 0.0115 0.019 -#> sigma 8.2229 0.94323 8.72 1.73e-10 6.3060 10.140
    # } - -
    +
    +

    Examples

    +
    
    +SFO_SFO <- mkinmod(
    +  parent = list(type = "SFO", to = "m1", sink = TRUE),
    +  m1 = list(type = "SFO"), use_of_ff = "min")
    +#> Temporary DLL for differentials generated and loaded
    +
    +# Fit the model to the FOCUS example dataset D using defaults
    +FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning
    +fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE)
    +fit.s <- summary(fit)
    +# Transformed and backtransformed parameters
    +print(fit.s$par, 3)
    +#>                   Estimate Std. Error Lower  Upper
    +#> parent_0             99.60     1.5702 96.40 102.79
    +#> log_k_parent_sink    -3.04     0.0763 -3.19  -2.88
    +#> log_k_parent_m1      -2.98     0.0403 -3.06  -2.90
    +#> log_k_m1_sink        -5.25     0.1332 -5.52  -4.98
    +#> sigma                 3.13     0.3585  2.40   3.85
    +print(fit.s$bpar, 3)
    +#>               Estimate se_notrans t value   Pr(>t)    Lower    Upper
    +#> parent_0      99.59848    1.57022   63.43 2.30e-36 96.40384 102.7931
    +#> k_parent_sink  0.04792    0.00365   13.11 6.13e-15  0.04103   0.0560
    +#> k_parent_m1    0.05078    0.00205   24.80 3.27e-23  0.04678   0.0551
    +#> k_m1_sink      0.00526    0.00070    7.51 6.16e-09  0.00401   0.0069
    +#> sigma          3.12550    0.35852    8.72 2.24e-10  2.39609   3.8549
    +
    +# \dontrun{
    +# Compare to the version without transforming rate parameters (does not work
    +# with analytical solution, we get NA values for m1 in predictions)
    +fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE,
    +  solution_type = "deSolve", quiet = TRUE)
    +fit.2.s <- summary(fit.2)
    +print(fit.2.s$par, 3)
    +#>               Estimate Std. Error    Lower    Upper
    +#> parent_0      99.59848    1.57022 96.40384 1.03e+02
    +#> k_parent_sink  0.04792    0.00365  0.04049 5.54e-02
    +#> k_parent_m1    0.05078    0.00205  0.04661 5.49e-02
    +#> k_m1_sink      0.00526    0.00070  0.00384 6.69e-03
    +#> sigma          3.12550    0.35852  2.39609 3.85e+00
    +print(fit.2.s$bpar, 3)
    +#>               Estimate se_notrans t value   Pr(>t)    Lower    Upper
    +#> parent_0      99.59848    1.57022   63.43 2.30e-36 96.40384 1.03e+02
    +#> k_parent_sink  0.04792    0.00365   13.11 6.13e-15  0.04049 5.54e-02
    +#> k_parent_m1    0.05078    0.00205   24.80 3.27e-23  0.04661 5.49e-02
    +#> k_m1_sink      0.00526    0.00070    7.51 6.16e-09  0.00384 6.69e-03
    +#> sigma          3.12550    0.35852    8.72 2.24e-10  2.39609 3.85e+00
    +# }
    +
    +initials <- fit$start$value
    +names(initials) <- rownames(fit$start)
    +transformed <- fit$start_transformed$value
    +names(transformed) <- rownames(fit$start_transformed)
    +transform_odeparms(initials, SFO_SFO)
    +#>          parent_0 log_k_parent_sink   log_k_parent_m1     log_k_m1_sink 
    +#>        100.750000         -2.302585         -2.301586         -2.300587 
    +backtransform_odeparms(transformed, SFO_SFO)
    +#>      parent_0 k_parent_sink   k_parent_m1     k_m1_sink 
    +#>      100.7500        0.1000        0.1001        0.1002 
    +
    +# \dontrun{
    +# The case of formation fractions (this is now the default)
    +SFO_SFO.ff <- mkinmod(
    +  parent = list(type = "SFO", to = "m1", sink = TRUE),
    +  m1 = list(type = "SFO"),
    +  use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE)
    +fit.ff.s <- summary(fit.ff)
    +print(fit.ff.s$par, 3)
    +#>                 Estimate Std. Error  Lower  Upper
    +#> parent_0         99.5985     1.5702 96.404 102.79
    +#> log_k_parent     -2.3157     0.0409 -2.399  -2.23
    +#> log_k_m1         -5.2475     0.1332 -5.518  -4.98
    +#> f_parent_qlogis   0.0579     0.0893 -0.124   0.24
    +#> sigma             3.1255     0.3585  2.396   3.85
    +print(fit.ff.s$bpar, 3)
    +#>                Estimate se_notrans t value   Pr(>t)    Lower    Upper
    +#> parent_0       99.59848    1.57022   63.43 2.30e-36 96.40383 102.7931
    +#> k_parent        0.09870    0.00403   24.47 4.96e-23  0.09082   0.1073
    +#> k_m1            0.00526    0.00070    7.51 6.16e-09  0.00401   0.0069
    +#> f_parent_to_m1  0.51448    0.02230   23.07 3.10e-22  0.46912   0.5596
    +#> sigma           3.12550    0.35852    8.72 2.24e-10  2.39609   3.8549
    +initials <- c("f_parent_to_m1" = 0.5)
    +transformed <- transform_odeparms(initials, SFO_SFO.ff)
    +backtransform_odeparms(transformed, SFO_SFO.ff)
    +#> f_parent_to_m1 
    +#>            0.5 
    +
    +# And without sink
    +SFO_SFO.ff.2 <- mkinmod(
    +  parent = list(type = "SFO", to = "m1", sink = FALSE),
    +  m1 = list(type = "SFO"),
    +  use_of_ff = "max")
    +#> Temporary DLL for differentials generated and loaded
    +
    +
    +fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE)
    +fit.ff.2.s <- summary(fit.ff.2)
    +print(fit.ff.2.s$par, 3)
    +#>              Estimate Std. Error Lower Upper
    +#> parent_0        84.79      3.012 78.67 90.91
    +#> log_k_parent    -2.76      0.082 -2.92 -2.59
    +#> log_k_m1        -4.21      0.123 -4.46 -3.96
    +#> sigma            8.22      0.943  6.31 10.14
    +print(fit.ff.2.s$bpar, 3)
    +#>          Estimate se_notrans t value   Pr(>t)   Lower  Upper
    +#> parent_0  84.7916    3.01203   28.15 1.92e-25 78.6704 90.913
    +#> k_parent   0.0635    0.00521   12.19 2.91e-14  0.0538  0.075
    +#> k_m1       0.0148    0.00182    8.13 8.81e-10  0.0115  0.019
    +#> sigma      8.2229    0.94323    8.72 1.73e-10  6.3060 10.140
    +# }
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/dev/reference/update.mkinfit-1.png b/docs/dev/reference/update.mkinfit-1.png index df8473c1..12fe1f5b 100644 Binary files a/docs/dev/reference/update.mkinfit-1.png and b/docs/dev/reference/update.mkinfit-1.png differ diff --git a/docs/dev/reference/update.mkinfit-2.png b/docs/dev/reference/update.mkinfit-2.png index 13c99b44..21817f94 100644 Binary files a/docs/dev/reference/update.mkinfit-2.png and b/docs/dev/reference/update.mkinfit-2.png differ diff --git a/docs/dev/reference/update.mkinfit.html b/docs/dev/reference/update.mkinfit.html index 83f45028..cf611716 100644 --- a/docs/dev/reference/update.mkinfit.html +++ b/docs/dev/reference/update.mkinfit.html @@ -1,70 +1,15 @@ - - - - - - - -Update an mkinfit model with different arguments — update.mkinfit • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Update an mkinfit model with different arguments — update.mkinfit • mkin - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -153,66 +98,67 @@ updated fit. Values specified as 'parms.ini' and/or 'state.ini' will override these starting values.

    -
    # S3 method for mkinfit
    -update(object, ..., evaluate = TRUE)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    object

    An mkinfit object to be updated

    ...

    Arguments to mkinfit that should replace +

    +
    # S3 method for mkinfit
    +update(object, ..., evaluate = TRUE)
    +
    + +
    +

    Arguments

    +
    object
    +

    An mkinfit object to be updated

    + + +
    ...
    +

    Arguments to mkinfit that should replace the arguments from the original call. Arguments set to NULL will -remove arguments given in the original call

    evaluate

    Should the call be evaluated or returned as a call

    - - -

    Examples

    -
    # \dontrun{ -fit <- mkinfit("SFO", subset(FOCUS_2006_D, value != 0), quiet = TRUE) -parms(fit) -
    #> parent_0 k_parent sigma -#> 99.44423885 0.09793574 3.39632469
    plot_err(fit) -
    fit_2 <- update(fit, error_model = "tc") -parms(fit_2) -
    #> parent_0 k_parent sigma_low rsd_high -#> 1.008549e+02 1.005665e-01 3.752222e-03 6.763434e-02
    plot_err(fit_2) -
    # } -
    +remove arguments given in the original call

    + + +
    evaluate
    +

    Should the call be evaluated or returned as a call

    + +
    + +
    +

    Examples

    +
    # \dontrun{
    +fit <- mkinfit("SFO", subset(FOCUS_2006_D, value != 0), quiet = TRUE)
    +parms(fit)
    +#>    parent_0    k_parent       sigma 
    +#> 99.44423885  0.09793574  3.39632469 
    +plot_err(fit)
    +
    +fit_2 <- update(fit, error_model = "tc")
    +parms(fit_2)
    +#>     parent_0     k_parent    sigma_low     rsd_high 
    +#> 1.008549e+02 1.005665e-01 3.752222e-03 6.763434e-02 
    +plot_err(fit_2)
    +
    +# }
    +
    +
    +
    -
    - +
    - - + + -- cgit v1.2.1 From 9a1136dc5550663b352239502a39a07601959644 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 2 Dec 2022 08:00:40 +0100 Subject: Update online docs --- docs/dev/reference/Rplot001.png | Bin 14083 -> 18113 bytes docs/dev/reference/Rplot002.png | Bin 13699 -> 38732 bytes docs/dev/reference/mhmkin-1.png | Bin 0 -> 53169 bytes docs/dev/reference/mhmkin-2.png | Bin 0 -> 113443 bytes docs/dev/reference/mhmkin.html | 103 +++++++++++++++++++++++++++++++++++----- 5 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 docs/dev/reference/mhmkin-1.png create mode 100644 docs/dev/reference/mhmkin-2.png (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png index ca982688..8a77fc7f 100644 Binary files a/docs/dev/reference/Rplot001.png and b/docs/dev/reference/Rplot001.png differ diff --git a/docs/dev/reference/Rplot002.png b/docs/dev/reference/Rplot002.png index de2d61aa..c1621707 100644 Binary files a/docs/dev/reference/Rplot002.png and b/docs/dev/reference/Rplot002.png differ diff --git a/docs/dev/reference/mhmkin-1.png b/docs/dev/reference/mhmkin-1.png new file mode 100644 index 00000000..2ecb6759 Binary files /dev/null and b/docs/dev/reference/mhmkin-1.png differ diff --git a/docs/dev/reference/mhmkin-2.png b/docs/dev/reference/mhmkin-2.png new file mode 100644 index 00000000..9bb43d35 Binary files /dev/null and b/docs/dev/reference/mhmkin-2.png differ diff --git a/docs/dev/reference/mhmkin.html b/docs/dev/reference/mhmkin.html index e72d17f9..1328aa48 100644 --- a/docs/dev/reference/mhmkin.html +++ b/docs/dev/reference/mhmkin.html @@ -113,7 +113,6 @@ mhmkin( backend = "saemix", algorithm = "saem", no_random_effect = NULL, - auto_ranef_threshold = 3, ..., cores = if (Sys.info()["sysname"] == "Windows") 1 else parallel::detectCores(), cluster = NULL @@ -150,16 +149,14 @@ supported

    no_random_effect
    -

    Default is NULL and will be passed to saem. If -you specify "auto", random effects are only included if the number -of datasets in which the parameter passed the t-test is at least 'auto_ranef_threshold'. -Beware that while this may make for convenient model reduction or even -numerical stability of the algorithm, it will likely lead to -underparameterised models.

    - - -
    auto_ranef_threshold
    -

    See 'no_random_effect.

    +

    Default is NULL and will be passed to saem. If a +character vector is supplied, it will be passed to all calls to saem, +which will exclude random effects for all matching parameters. Alternatively, +a list of character vectors or an object of class illparms.mhmkin can be +specified. They have to have the same dimensions that the return object of +the current call will have, i.e. the number of rows must match the number +of degradation models in the mmkin object(s), and the number of columns must +match the number of error models used in the mmkin object(s).

    cores
    @@ -203,7 +200,7 @@ and the error model names for the second index (column index), with class attribute 'mhmkin'.

    -

    An object of class mhmkin.

    +

    An object inheriting from mhmkin.

    See also

    @@ -214,6 +211,88 @@ attribute 'mhmkin'.

    Johannes Ranke

    +
    +

    Examples

    +
    # \dontrun{
    +# We start with separate evaluations of all the first six datasets with two
    +# degradation models and two error models
    +f_sep_const <- mmkin(c("SFO", "FOMC"), ds_fomc[1:6], cores = 2, quiet = TRUE)
    +f_sep_tc <- update(f_sep_const, error_model = "tc")
    +# The mhmkin function sets up hierarchical degradation models aka
    +# nonlinear mixed-effects models for all four combinations, specifying
    +# uncorrelated random effects for all degradation parameters
    +f_saem_1 <- mhmkin(list(f_sep_const, f_sep_tc), cores = 2)
    +status(f_saem_1)
    +#>            error
    +#> degradation const tc
    +#>        SFO  OK    OK
    +#>        FOMC OK    OK
    +#> 
    +#> OK: Fit terminated successfully
    +# The 'illparms' function shows that in all hierarchical fits, at least
    +# one random effect is ill-defined (the confidence interval for the
    +# random effect expressed as standard deviation includes zero)
    +illparms(f_saem_1)
    +#>            error
    +#> degradation const        tc                        
    +#>        SFO  sd(parent_0) sd(parent_0)              
    +#>        FOMC sd(log_beta) sd(parent_0), sd(log_beta)
    +# Therefore we repeat the fits, excluding the ill-defined random effects
    +f_saem_2 <- update(f_saem_1, no_random_effect = illparms(f_saem_1))
    +status(f_saem_2)
    +#>            error
    +#> degradation const tc
    +#>        SFO  OK    OK
    +#>        FOMC OK    OK
    +#> 
    +#> OK: Fit terminated successfully
    +illparms(f_saem_2)
    +#>            error
    +#> degradation const tc
    +#>        SFO          
    +#>        FOMC         
    +# Model comparisons show that FOMC with two-component error is preferable,
    +# and confirms our reduction of the default parameter model
    +anova(f_saem_1)
    +#> Data: 95 observations of 1 variable(s) grouped in 6 datasets
    +#> 
    +#>            npar    AIC    BIC     Lik
    +#> SFO const     5 574.40 573.35 -282.20
    +#> SFO tc        6 543.72 542.47 -265.86
    +#> FOMC const    7 489.67 488.22 -237.84
    +#> FOMC tc       8 406.11 404.44 -195.05
    +anova(f_saem_2)
    +#> Data: 95 observations of 1 variable(s) grouped in 6 datasets
    +#> 
    +#>            npar    AIC    BIC     Lik
    +#> SFO const     4 572.22 571.39 -282.11
    +#> SFO tc        5 541.63 540.59 -265.81
    +#> FOMC const    6 487.38 486.13 -237.69
    +#> FOMC tc       6 402.12 400.88 -195.06
    +# The convergence plot for the selected model looks fine
    +saemix::plot(f_saem_2[["FOMC", "tc"]]$so, plot.type = "convergence")
    +
    +# The plot of predictions versus data shows that we have a pretty data-rich
    +# situation with homogeneous distribution of residuals, because we used the
    +# same degradation model, error model and parameter distribution model that
    +# was used in the data generation.
    +plot(f_saem_2[["FOMC", "tc"]])
    +
    +# We can specify the same parameter model reductions manually
    +no_ranef <- list("parent_0", "log_beta", "parent_0", c("parent_0", "log_beta"))
    +dim(no_ranef) <- c(2, 2)
    +f_saem_2m <- update(f_saem_1, no_random_effect = no_ranef)
    +anova(f_saem_2m)
    +#> Data: 95 observations of 1 variable(s) grouped in 6 datasets
    +#> 
    +#>            npar    AIC    BIC     Lik
    +#> SFO const     4 572.22 571.39 -282.11
    +#> SFO tc        5 541.63 540.59 -265.81
    +#> FOMC const    6 487.38 486.13 -237.69
    +#> FOMC tc       6 402.12 400.88 -195.06
    +# }
    +
    +

    Value

    diff --git a/docs/dev/reference/parplot.html b/docs/dev/reference/parplot.html index 9852b694..720c0b2a 100644 --- a/docs/dev/reference/parplot.html +++ b/docs/dev/reference/parplot.html @@ -103,6 +103,7 @@ or by their medians as proposed in the paper by Duchesne et al. (2021).

    parplot( object, llmin = -Inf, + llquant = NA, scale = c("best", "median"), lpos = "bottomleft", main = "", @@ -124,8 +125,14 @@ or by their medians as proposed in the paper by Duchesne et al. (2021).

    The minimum likelihood of objects to be shown

    +
    llquant
    +

    Fractional value for selecting only the fits with higher +likelihoods. Overrides 'llmin'.

    + +
    scale
    -

    By default, scale parameters using the best available fit. +

    By default, scale parameters using the best +available fit. If 'median', parameters are scaled using the median parameters from all fits.

    diff --git a/docs/dev/reference/saem.html b/docs/dev/reference/saem.html index d18cb848..131b168b 100644 --- a/docs/dev/reference/saem.html +++ b/docs/dev/reference/saem.html @@ -432,8 +432,8 @@ using mmkin.

    #> saemix version used for fitting: 3.2 #> mkin version used for pre-fitting: 1.2.2 #> R version used for fitting: 4.2.2 -#> Date of fit: Thu Nov 24 08:11:00 2022 -#> Date of summary: Thu Nov 24 08:11:01 2022 +#> Date of fit: Wed Dec 7 16:22:26 2022 +#> Date of summary: Wed Dec 7 16:22:26 2022 #> #> Equations: #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -448,12 +448,12 @@ using mmkin.

    #> #> Model predictions using solution type analytical #> -#> Fitted in 8.778 s +#> Fitted in 8.508 s #> Using 300, 100 iterations and 10 chains #> #> Variance model: Constant variance #> -#> Mean of starting values for individual parameters: +#> Starting values for degradation parameters: #> parent_0 log_k_A1 f_parent_qlogis log_k1 log_k2 #> 93.8102 -5.3734 -0.9711 -1.8799 -4.2708 #> g_qlogis @@ -462,6 +462,19 @@ using mmkin.

    #> Fixed degradation parameter values: #> None #> +#> Starting values for random effects (square root of initial entries in omega): +#> parent_0 log_k_A1 f_parent_qlogis log_k1 log_k2 g_qlogis +#> parent_0 4.941 0.000 0.0000 0.000 0.000 0.0000 +#> log_k_A1 0.000 2.551 0.0000 0.000 0.000 0.0000 +#> f_parent_qlogis 0.000 0.000 0.7251 0.000 0.000 0.0000 +#> log_k1 0.000 0.000 0.0000 1.449 0.000 0.0000 +#> log_k2 0.000 0.000 0.0000 0.000 2.228 0.0000 +#> g_qlogis 0.000 0.000 0.0000 0.000 0.000 0.7814 +#> +#> Starting values for error model parameters: +#> a.1 +#> 1 +#> #> Results: #> #> Likelihood computed by importance sampling diff --git a/docs/dev/reference/summary.saem.mmkin.html b/docs/dev/reference/summary.saem.mmkin.html index a4150959..3b5869f1 100644 --- a/docs/dev/reference/summary.saem.mmkin.html +++ b/docs/dev/reference/summary.saem.mmkin.html @@ -102,7 +102,7 @@ endpoints such as formation fractions and DT50 values. Optionally
    # S3 method for saem.mmkin
    -summary(object, data = FALSE, verbose = FALSE, distimes = TRUE, ...)
    +summary(object, data = FALSE, verbose = FALSE, distimes = TRUE, ...)
     
     # S3 method for summary.saem.mmkin
     print(x, digits = max(3, getOption("digits") - 3), verbose = x$verbose, ...)
    @@ -266,36 +266,38 @@ saemix authors for the parts inherited from saemix.

    #> SD.g_qlogis 0.37478 0.04490 0.70467 illparms(f_saem_dfop_sfo) #> [1] "sd(parent_0)" "sd(log_k_m1)" -f_saem_dfop_sfo_2 <- update(f_saem_dfop_sfo, covariance.model = diag(c(0, 0, 1, 1, 1, 0))) +f_saem_dfop_sfo_2 <- update(f_saem_dfop_sfo, + no_random_effect = c("parent_0", "log_k_m1")) illparms(f_saem_dfop_sfo_2) intervals(f_saem_dfop_sfo_2) #> Approximate 95% confidence intervals #> #> Fixed effects: #> lower est. upper -#> parent_0 97.57609542 100.73343868 103.89078195 -#> k_m1 0.01549292 0.01714893 0.01898194 -#> f_parent_to_m1 0.20720315 0.28358738 0.37481744 -#> k1 0.06149334 0.08733164 0.12402670 -#> k2 0.01448390 0.01699942 0.01995184 -#> g 0.45084762 0.51075839 0.57036168 +#> parent_0 98.36731429 101.42508066 104.48284703 +#> k_m1 0.01513234 0.01670094 0.01843214 +#> f_parent_to_m1 0.20221431 0.27608850 0.36461630 +#> k1 0.06915073 0.09759718 0.13774560 +#> k2 0.01487068 0.01740389 0.02036863 +#> g 0.37365671 0.48384821 0.59563299 #> #> Random effects: #> lower est. upper -#> sd(f_parent_qlogis) 0.16606767 0.4479731 0.7298784 -#> sd(log_k1) 0.12284609 0.3588446 0.5948430 -#> sd(log_k2) 0.05379723 0.1548780 0.2559588 +#> sd(f_parent_qlogis) 0.16439770 0.4427585 0.7211193 +#> sd(log_k1) 0.08304243 0.3345213 0.5860002 +#> sd(log_k2) 0.03146410 0.1490210 0.2665779 +#> sd(g_qlogis) 0.06216385 0.4023430 0.7425221 #> #> -#> lower est. upper -#> a.1 0.6811490 0.88503409 1.08891921 -#> b.1 0.0676515 0.08336272 0.09907394 -summary(f_saem_dfop_sfo_2, data = TRUE) +#> lower est. upper +#> a.1 0.67696663 0.87777355 1.07858048 +#> b.1 0.06363957 0.07878001 0.09392044 +summary(f_saem_dfop_sfo_2, data = TRUE) #> saemix version used for fitting: 3.2 #> mkin version used for pre-fitting: 1.2.2 #> R version used for fitting: 4.2.2 -#> Date of fit: Thu Nov 24 08:11:52 2022 -#> Date of summary: Thu Nov 24 08:11:52 2022 +#> Date of fit: Thu Dec 15 14:47:14 2022 +#> Date of summary: Thu Dec 15 14:47:14 2022 #> #> Equations: #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -310,12 +312,12 @@ saemix authors for the parts inherited from saemix.

    #> #> Model predictions using solution type analytical #> -#> Fitted in 26.242 s +#> Fitted in 9.623 s #> Using 300, 100 iterations and 10 chains #> #> Variance model: Two-component variance function #> -#> Mean of starting values for individual parameters: +#> Starting values for degradation parameters: #> parent_0 log_k_m1 f_parent_qlogis log_k1 log_k2 #> 101.65645 -4.05368 -0.94311 -2.35943 -4.07006 #> g_qlogis @@ -324,237 +326,291 @@ saemix authors for the parts inherited from saemix.

    #> Fixed degradation parameter values: #> None #> +#> Starting values for random effects (square root of initial entries in omega): +#> parent_0 log_k_m1 f_parent_qlogis log_k1 log_k2 g_qlogis +#> parent_0 6.742 0.0000 0.0000 0.0000 0.0000 0.000 +#> log_k_m1 0.000 0.2236 0.0000 0.0000 0.0000 0.000 +#> f_parent_qlogis 0.000 0.0000 0.5572 0.0000 0.0000 0.000 +#> log_k1 0.000 0.0000 0.0000 0.8031 0.0000 0.000 +#> log_k2 0.000 0.0000 0.0000 0.0000 0.2931 0.000 +#> g_qlogis 0.000 0.0000 0.0000 0.0000 0.0000 0.807 +#> +#> Starting values for error model parameters: +#> a.1 b.1 +#> 1 1 +#> #> Results: #> #> Likelihood computed by importance sampling -#> AIC BIC logLik -#> 809.5 805.2 -393.7 +#> AIC BIC logLik +#> 807 802.3 -391.5 #> #> Optimised parameters: #> est. lower upper -#> parent_0 100.73344 97.57610 103.89078 -#> log_k_m1 -4.06582 -4.16737 -3.96427 -#> f_parent_qlogis -0.92674 -1.34187 -0.51160 -#> log_k1 -2.43804 -2.78883 -2.08726 -#> log_k2 -4.07458 -4.23472 -3.91443 -#> g_qlogis 0.04304 -0.19725 0.28333 -#> a.1 0.88503 0.68115 1.08892 -#> b.1 0.08336 0.06765 0.09907 -#> SD.f_parent_qlogis 0.44797 0.16607 0.72988 -#> SD.log_k1 0.35884 0.12285 0.59484 -#> SD.log_k2 0.15488 0.05380 0.25596 +#> parent_0 101.42508 98.36731 104.48285 +#> log_k_m1 -4.09229 -4.19092 -3.99366 +#> f_parent_qlogis -0.96395 -1.37251 -0.55538 +#> log_k1 -2.32691 -2.67147 -1.98235 +#> log_k2 -4.05106 -4.20836 -3.89376 +#> g_qlogis -0.06463 -0.51656 0.38730 +#> a.1 0.87777 0.67697 1.07858 +#> b.1 0.07878 0.06364 0.09392 +#> SD.f_parent_qlogis 0.44276 0.16440 0.72112 +#> SD.log_k1 0.33452 0.08304 0.58600 +#> SD.log_k2 0.14902 0.03146 0.26658 +#> SD.g_qlogis 0.40234 0.06216 0.74252 #> #> Correlation: #> parnt_0 lg_k_m1 f_prnt_ log_k1 log_k2 -#> log_k_m1 -0.4698 -#> f_parent_qlogis -0.2461 0.2709 -#> log_k1 0.1572 -0.1517 -0.0648 -#> log_k2 -0.0023 0.0835 0.0125 0.1420 -#> g_qlogis 0.2314 -0.2337 -0.0755 -0.2762 -0.4797 +#> log_k_m1 -0.4693 +#> f_parent_qlogis -0.2378 0.2595 +#> log_k1 0.1720 -0.1593 -0.0669 +#> log_k2 0.0179 0.0594 0.0035 0.1995 +#> g_qlogis 0.1073 -0.1060 -0.0322 -0.2299 -0.3168 #> #> Random effects: -#> est. lower upper -#> SD.f_parent_qlogis 0.4480 0.1661 0.7299 -#> SD.log_k1 0.3588 0.1228 0.5948 -#> SD.log_k2 0.1549 0.0538 0.2560 +#> est. lower upper +#> SD.f_parent_qlogis 0.4428 0.16440 0.7211 +#> SD.log_k1 0.3345 0.08304 0.5860 +#> SD.log_k2 0.1490 0.03146 0.2666 +#> SD.g_qlogis 0.4023 0.06216 0.7425 #> #> Variance model: #> est. lower upper -#> a.1 0.88503 0.68115 1.08892 -#> b.1 0.08336 0.06765 0.09907 +#> a.1 0.87777 0.67697 1.07858 +#> b.1 0.07878 0.06364 0.09392 #> #> Backtransformed parameters: -#> est. lower upper -#> parent_0 100.73344 97.57610 103.89078 -#> k_m1 0.01715 0.01549 0.01898 -#> f_parent_to_m1 0.28359 0.20720 0.37482 -#> k1 0.08733 0.06149 0.12403 -#> k2 0.01700 0.01448 0.01995 -#> g 0.51076 0.45085 0.57036 +#> est. lower upper +#> parent_0 101.4251 98.36731 104.48285 +#> k_m1 0.0167 0.01513 0.01843 +#> f_parent_to_m1 0.2761 0.20221 0.36462 +#> k1 0.0976 0.06915 0.13775 +#> k2 0.0174 0.01487 0.02037 +#> g 0.4838 0.37366 0.59563 #> #> Resulting formation fractions: #> ff -#> parent_m1 0.2836 -#> parent_sink 0.7164 +#> parent_m1 0.2761 +#> parent_sink 0.7239 #> #> Estimated disappearance times: #> DT50 DT90 DT50back DT50_k1 DT50_k2 -#> parent 15.94 93.48 28.14 7.937 40.77 -#> m1 40.42 134.27 NA NA NA +#> parent 15.54 94.33 28.4 7.102 39.83 +#> m1 41.50 137.87 NA NA NA #> #> Data: -#> ds name time observed predicted residual std standardized -#> ds 1 parent 0 89.8 1.007e+02 -10.93344 8.4439 -1.29483 -#> ds 1 parent 0 104.1 1.007e+02 3.36656 8.4439 0.39870 -#> ds 1 parent 1 88.7 9.591e+01 -7.20789 8.0440 -0.89606 -#> ds 1 parent 1 95.5 9.591e+01 -0.40789 8.0440 -0.05071 -#> ds 1 parent 3 81.8 8.712e+01 -5.31561 7.3159 -0.72658 -#> ds 1 parent 3 94.5 8.712e+01 7.38439 7.3159 1.00936 -#> ds 1 parent 7 71.5 7.246e+01 -0.95675 6.1047 -0.15672 -#> ds 1 parent 7 70.3 7.246e+01 -2.15675 6.1047 -0.35329 -#> ds 1 parent 14 54.2 5.382e+01 0.38143 4.5729 0.08341 -#> ds 1 parent 14 49.6 5.382e+01 -4.21857 4.5729 -0.92251 -#> ds 1 parent 28 31.5 3.230e+01 -0.80120 2.8344 -0.28267 -#> ds 1 parent 28 28.8 3.230e+01 -3.50120 2.8344 -1.23524 -#> ds 1 parent 60 12.1 1.307e+01 -0.97165 1.4038 -0.69215 -#> ds 1 parent 60 13.6 1.307e+01 0.52835 1.4038 0.37637 -#> ds 1 parent 90 6.2 6.353e+00 -0.15285 1.0314 -0.14820 -#> ds 1 parent 90 8.3 6.353e+00 1.94715 1.0314 1.88790 -#> ds 1 parent 120 2.2 3.175e+00 -0.97462 0.9238 -1.05506 -#> ds 1 parent 120 2.4 3.175e+00 -0.77462 0.9238 -0.83855 -#> ds 1 m1 1 0.3 1.183e+00 -0.88350 0.8905 -0.99212 -#> ds 1 m1 1 0.2 1.183e+00 -0.98350 0.8905 -1.10441 -#> ds 1 m1 3 2.2 3.281e+00 -1.08106 0.9263 -1.16703 -#> ds 1 m1 3 3.0 3.281e+00 -0.28106 0.9263 -0.30341 -#> ds 1 m1 7 6.5 6.564e+00 -0.06353 1.0405 -0.06106 -#> ds 1 m1 7 5.0 6.564e+00 -1.56353 1.0405 -1.50266 -#> ds 1 m1 14 10.2 1.015e+01 0.05147 1.2243 0.04204 -#> ds 1 m1 14 9.5 1.015e+01 -0.64853 1.2243 -0.52970 -#> ds 1 m1 28 12.2 1.265e+01 -0.44824 1.3766 -0.32561 -#> ds 1 m1 28 13.4 1.265e+01 0.75176 1.3766 0.54610 -#> ds 1 m1 60 11.8 1.078e+01 1.02355 1.2611 0.81165 -#> ds 1 m1 60 13.2 1.078e+01 2.42355 1.2611 1.92181 -#> ds 1 m1 90 6.6 7.698e+00 -1.09840 1.0932 -1.00474 -#> ds 1 m1 90 9.3 7.698e+00 1.60160 1.0932 1.46502 -#> ds 1 m1 120 3.5 5.199e+00 -1.69853 0.9854 -1.72363 -#> ds 1 m1 120 5.4 5.199e+00 0.20147 0.9854 0.20445 -#> ds 2 parent 0 118.0 1.007e+02 17.26656 8.4439 2.04485 -#> ds 2 parent 0 99.8 1.007e+02 -0.93344 8.4439 -0.11055 -#> ds 2 parent 1 90.2 9.584e+01 -5.63852 8.0382 -0.70146 -#> ds 2 parent 1 94.6 9.584e+01 -1.23852 8.0382 -0.15408 -#> ds 2 parent 3 96.1 8.706e+01 9.04068 7.3113 1.23654 -#> ds 2 parent 3 78.4 8.706e+01 -8.65932 7.3113 -1.18438 -#> ds 2 parent 7 77.9 7.286e+01 5.04438 6.1376 0.82188 -#> ds 2 parent 7 77.7 7.286e+01 4.84438 6.1376 0.78930 -#> ds 2 parent 14 56.0 5.567e+01 0.33336 4.7242 0.07057 -#> ds 2 parent 14 54.7 5.567e+01 -0.96664 4.7242 -0.20462 -#> ds 2 parent 28 36.6 3.705e+01 -0.44800 3.2127 -0.13944 -#> ds 2 parent 28 36.8 3.705e+01 -0.24800 3.2127 -0.07719 -#> ds 2 parent 60 22.1 2.008e+01 2.01984 1.8935 1.06672 -#> ds 2 parent 60 24.7 2.008e+01 4.61984 1.8935 2.43984 -#> ds 2 parent 90 12.4 1.253e+01 -0.12814 1.3689 -0.09360 -#> ds 2 parent 90 10.8 1.253e+01 -1.72814 1.3689 -1.26238 -#> ds 2 parent 120 6.8 7.916e+00 -1.11595 1.1040 -1.01085 -#> ds 2 parent 120 7.9 7.916e+00 -0.01595 1.1040 -0.01445 -#> ds 2 m1 1 1.3 1.317e+00 -0.01669 0.8918 -0.01871 -#> ds 2 m1 3 3.7 3.613e+00 0.08699 0.9349 0.09305 -#> ds 2 m1 3 4.7 3.613e+00 1.08699 0.9349 1.16270 -#> ds 2 m1 7 8.1 7.092e+00 1.00781 1.0643 0.94688 -#> ds 2 m1 7 7.9 7.092e+00 0.80781 1.0643 0.75897 -#> ds 2 m1 14 10.1 1.066e+01 -0.56458 1.2545 -0.45006 -#> ds 2 m1 14 10.3 1.066e+01 -0.36458 1.2545 -0.29063 -#> ds 2 m1 28 10.7 1.281e+01 -2.11106 1.3870 -1.52201 -#> ds 2 m1 28 12.2 1.281e+01 -0.61106 1.3870 -0.44055 -#> ds 2 m1 60 10.7 1.078e+01 -0.08464 1.2616 -0.06709 -#> ds 2 m1 60 12.5 1.078e+01 1.71536 1.2616 1.35970 -#> ds 2 m1 90 9.1 8.013e+00 1.08684 1.1088 0.98016 -#> ds 2 m1 90 7.4 8.013e+00 -0.61316 1.1088 -0.55298 -#> ds 2 m1 120 6.1 5.749e+00 0.35063 1.0065 0.34838 -#> ds 2 m1 120 4.5 5.749e+00 -1.24937 1.0065 -1.24133 -#> ds 3 parent 0 106.2 1.007e+02 5.46656 8.4439 0.64740 -#> ds 3 parent 0 106.9 1.007e+02 6.16656 8.4439 0.73030 -#> ds 3 parent 1 107.4 9.369e+01 13.70530 7.8606 1.74354 -#> ds 3 parent 1 96.1 9.369e+01 2.40530 7.8606 0.30599 -#> ds 3 parent 3 79.4 8.185e+01 -2.45363 6.8807 -0.35660 -#> ds 3 parent 3 82.6 8.185e+01 0.74637 6.8807 0.10847 -#> ds 3 parent 7 63.9 6.487e+01 -0.97153 5.4798 -0.17729 -#> ds 3 parent 7 62.4 6.487e+01 -2.47153 5.4798 -0.45103 -#> ds 3 parent 14 51.0 4.791e+01 3.09024 4.0908 0.75542 -#> ds 3 parent 14 47.1 4.791e+01 -0.80976 4.0908 -0.19795 -#> ds 3 parent 28 36.1 3.313e+01 2.97112 2.9001 1.02450 -#> ds 3 parent 28 36.6 3.313e+01 3.47112 2.9001 1.19691 -#> ds 3 parent 60 20.1 1.927e+01 0.83265 1.8339 0.45404 -#> ds 3 parent 60 19.8 1.927e+01 0.53265 1.8339 0.29045 -#> ds 3 parent 90 11.3 1.203e+01 -0.72783 1.3374 -0.54421 -#> ds 3 parent 90 10.7 1.203e+01 -1.32783 1.3374 -0.99284 -#> ds 3 parent 120 8.2 7.516e+00 0.68382 1.0844 0.63061 -#> ds 3 parent 120 7.3 7.516e+00 -0.21618 1.0844 -0.19936 -#> ds 3 m1 0 0.8 -9.948e-14 0.80000 0.8850 0.90392 -#> ds 3 m1 1 1.8 1.682e+00 0.11759 0.8961 0.13123 -#> ds 3 m1 1 2.3 1.682e+00 0.61759 0.8961 0.68921 -#> ds 3 m1 3 4.2 4.431e+00 -0.23052 0.9590 -0.24037 -#> ds 3 m1 3 4.1 4.431e+00 -0.33052 0.9590 -0.34465 -#> ds 3 m1 7 6.8 8.084e+00 -1.28422 1.1124 -1.15445 -#> ds 3 m1 7 10.1 8.084e+00 2.01578 1.1124 1.81208 -#> ds 3 m1 14 11.4 1.100e+01 0.40274 1.2743 0.31606 -#> ds 3 m1 14 12.8 1.100e+01 1.80274 1.2743 1.41474 -#> ds 3 m1 28 11.5 1.176e+01 -0.25977 1.3207 -0.19669 -#> ds 3 m1 28 10.6 1.176e+01 -1.15977 1.3207 -0.87813 -#> ds 3 m1 60 7.5 9.277e+00 -1.77696 1.1753 -1.51190 -#> ds 3 m1 60 8.6 9.277e+00 -0.67696 1.1753 -0.57598 -#> ds 3 m1 90 7.3 6.883e+00 0.41708 1.0548 0.39542 -#> ds 3 m1 90 8.1 6.883e+00 1.21708 1.0548 1.15389 -#> ds 3 m1 120 5.3 4.948e+00 0.35179 0.9764 0.36028 -#> ds 3 m1 120 3.8 4.948e+00 -1.14821 0.9764 -1.17591 -#> ds 4 parent 0 104.7 1.007e+02 3.96656 8.4439 0.46975 -#> ds 4 parent 0 88.3 1.007e+02 -12.43344 8.4439 -1.47247 -#> ds 4 parent 1 94.2 9.738e+01 -3.18358 8.1663 -0.38985 -#> ds 4 parent 1 94.6 9.738e+01 -2.78358 8.1663 -0.34086 -#> ds 4 parent 3 78.1 9.110e+01 -12.99595 7.6454 -1.69984 -#> ds 4 parent 3 96.5 9.110e+01 5.40405 7.6454 0.70684 -#> ds 4 parent 7 76.2 8.000e+01 -3.79797 6.7273 -0.56456 -#> ds 4 parent 7 77.8 8.000e+01 -2.19797 6.7273 -0.32672 -#> ds 4 parent 14 70.8 6.446e+01 6.34396 5.4456 1.16496 -#> ds 4 parent 14 67.3 6.446e+01 2.84396 5.4456 0.52225 -#> ds 4 parent 28 43.1 4.359e+01 -0.48960 3.7400 -0.13091 -#> ds 4 parent 28 45.1 4.359e+01 1.51040 3.7400 0.40385 -#> ds 4 parent 60 21.3 2.095e+01 0.35282 1.9577 0.18022 -#> ds 4 parent 60 23.5 2.095e+01 2.55282 1.9577 1.30400 -#> ds 4 parent 90 11.8 1.188e+01 -0.07874 1.3281 -0.05929 -#> ds 4 parent 90 12.1 1.188e+01 0.22126 1.3281 0.16660 -#> ds 4 parent 120 7.0 7.072e+00 -0.07245 1.0634 -0.06813 -#> ds 4 parent 120 6.2 7.072e+00 -0.87245 1.0634 -0.82041 -#> ds 4 m1 0 1.6 5.684e-14 1.60000 0.8850 1.80784 -#> ds 4 m1 1 0.9 6.960e-01 0.20399 0.8869 0.23000 -#> ds 4 m1 3 3.7 1.968e+00 1.73240 0.9001 1.92466 -#> ds 4 m1 3 2.0 1.968e+00 0.03240 0.9001 0.03599 -#> ds 4 m1 7 3.6 4.083e+00 -0.48287 0.9482 -0.50924 -#> ds 4 m1 7 3.8 4.083e+00 -0.28287 0.9482 -0.29832 -#> ds 4 m1 14 7.1 6.682e+00 0.41836 1.0457 0.40007 -#> ds 4 m1 14 6.6 6.682e+00 -0.08164 1.0457 -0.07807 -#> ds 4 m1 28 9.5 9.103e+00 0.39733 1.1658 0.34082 -#> ds 4 m1 28 9.3 9.103e+00 0.19733 1.1658 0.16926 -#> ds 4 m1 60 8.3 8.750e+00 -0.44979 1.1469 -0.39218 -#> ds 4 m1 60 9.0 8.750e+00 0.25021 1.1469 0.21817 -#> ds 4 m1 90 6.6 6.673e+00 -0.07285 1.0453 -0.06969 -#> ds 4 m1 90 7.7 6.673e+00 1.02715 1.0453 0.98261 -#> ds 4 m1 120 3.7 4.757e+00 -1.05747 0.9698 -1.09036 -#> ds 4 m1 120 3.5 4.757e+00 -1.25747 0.9698 -1.29658 -#> ds 5 parent 0 110.4 1.007e+02 9.66656 8.4439 1.14480 -#> ds 5 parent 0 112.1 1.007e+02 11.36656 8.4439 1.34612 -#> ds 5 parent 1 93.5 9.395e+01 -0.45394 7.8821 -0.05759 -#> ds 5 parent 1 91.0 9.395e+01 -2.95394 7.8821 -0.37477 -#> ds 5 parent 3 71.0 8.245e+01 -11.44783 6.9298 -1.65197 -#> ds 5 parent 3 89.7 8.245e+01 7.25217 6.9298 1.04652 -#> ds 5 parent 7 60.4 6.567e+01 -5.27002 5.5455 -0.95032 -#> ds 5 parent 7 59.1 6.567e+01 -6.57002 5.5455 -1.18475 -#> ds 5 parent 14 56.5 4.847e+01 8.03029 4.1364 1.94139 -#> ds 5 parent 14 47.0 4.847e+01 -1.46971 4.1364 -0.35532 -#> ds 5 parent 28 30.2 3.309e+01 -2.89206 2.8971 -0.99825 -#> ds 5 parent 28 23.9 3.309e+01 -9.19206 2.8971 -3.17281 -#> ds 5 parent 60 17.0 1.891e+01 -1.90623 1.8076 -1.05458 -#> ds 5 parent 60 18.7 1.891e+01 -0.20623 1.8076 -0.11409 -#> ds 5 parent 90 11.3 1.168e+01 -0.38263 1.3160 -0.29076 -#> ds 5 parent 90 11.9 1.168e+01 0.21737 1.3160 0.16518 -#> ds 5 parent 120 9.0 7.230e+00 1.77031 1.0708 1.65333 -#> ds 5 parent 120 8.1 7.230e+00 0.87031 1.0708 0.81280 -#> ds 5 m1 0 0.7 -5.116e-13 0.70000 0.8850 0.79093 -#> ds 5 m1 1 3.0 3.244e+00 -0.24430 0.9254 -0.26398 -#> ds 5 m1 1 2.6 3.244e+00 -0.64430 0.9254 -0.69621 -#> ds 5 m1 3 5.1 8.592e+00 -3.49175 1.1385 -3.06686 -#> ds 5 m1 3 7.5 8.592e+00 -1.09175 1.1385 -0.95890 -#> ds 5 m1 7 16.5 1.583e+01 0.66887 1.5890 0.42093 -#> ds 5 m1 7 19.0 1.583e+01 3.16887 1.5890 1.99424 -#> ds 5 m1 14 22.9 2.181e+01 1.08658 2.0224 0.53728 -#> ds 5 m1 14 23.2 2.181e+01 1.38658 2.0224 0.68562 -#> ds 5 m1 28 22.2 2.364e+01 -1.43659 2.1600 -0.66508 -#> ds 5 m1 28 24.4 2.364e+01 0.76341 2.1600 0.35342 -#> ds 5 m1 60 15.5 1.873e+01 -3.23377 1.7950 -1.80150 -#> ds 5 m1 60 19.8 1.873e+01 1.06623 1.7950 0.59398 -#> ds 5 m1 90 14.9 1.387e+01 1.03117 1.4560 0.70822 -#> ds 5 m1 90 14.2 1.387e+01 0.33117 1.4560 0.22745 -#> ds 5 m1 120 10.9 9.937e+00 0.96270 1.2122 0.79415 -#> ds 5 m1 120 10.4 9.937e+00 0.46270 1.2122 0.38169 +#> ds name time observed predicted residual std standardized +#> ds 1 parent 0 89.8 1.014e+02 -11.62508 8.0383 -1.44620 +#> ds 1 parent 0 104.1 1.014e+02 2.67492 8.0383 0.33277 +#> ds 1 parent 1 88.7 9.650e+01 -7.80311 7.6530 -1.01961 +#> ds 1 parent 1 95.5 9.650e+01 -1.00311 7.6530 -0.13107 +#> ds 1 parent 3 81.8 8.753e+01 -5.72638 6.9510 -0.82382 +#> ds 1 parent 3 94.5 8.753e+01 6.97362 6.9510 1.00326 +#> ds 1 parent 7 71.5 7.254e+01 -1.04133 5.7818 -0.18010 +#> ds 1 parent 7 70.3 7.254e+01 -2.24133 5.7818 -0.38765 +#> ds 1 parent 14 54.2 5.349e+01 0.71029 4.3044 0.16502 +#> ds 1 parent 14 49.6 5.349e+01 -3.88971 4.3044 -0.90366 +#> ds 1 parent 28 31.5 3.167e+01 -0.16616 2.6446 -0.06283 +#> ds 1 parent 28 28.8 3.167e+01 -2.86616 2.6446 -1.08379 +#> ds 1 parent 60 12.1 1.279e+01 -0.69287 1.3365 -0.51843 +#> ds 1 parent 60 13.6 1.279e+01 0.80713 1.3365 0.60392 +#> ds 1 parent 90 6.2 6.397e+00 -0.19718 1.0122 -0.19481 +#> ds 1 parent 90 8.3 6.397e+00 1.90282 1.0122 1.87996 +#> ds 1 parent 120 2.2 3.323e+00 -1.12320 0.9160 -1.22623 +#> ds 1 parent 120 2.4 3.323e+00 -0.92320 0.9160 -1.00788 +#> ds 1 m1 1 0.3 1.179e+00 -0.87919 0.8827 -0.99605 +#> ds 1 m1 1 0.2 1.179e+00 -0.97919 0.8827 -1.10935 +#> ds 1 m1 3 2.2 3.273e+00 -1.07272 0.9149 -1.17256 +#> ds 1 m1 3 3.0 3.273e+00 -0.27272 0.9149 -0.29811 +#> ds 1 m1 7 6.5 6.559e+00 -0.05872 1.0186 -0.05765 +#> ds 1 m1 7 5.0 6.559e+00 -1.55872 1.0186 -1.53032 +#> ds 1 m1 14 10.2 1.016e+01 0.03787 1.1880 0.03188 +#> ds 1 m1 14 9.5 1.016e+01 -0.66213 1.1880 -0.55734 +#> ds 1 m1 28 12.2 1.268e+01 -0.47913 1.3297 -0.36032 +#> ds 1 m1 28 13.4 1.268e+01 0.72087 1.3297 0.54211 +#> ds 1 m1 60 11.8 1.078e+01 1.02493 1.2211 0.83936 +#> ds 1 m1 60 13.2 1.078e+01 2.42493 1.2211 1.98588 +#> ds 1 m1 90 6.6 7.705e+00 -1.10464 1.0672 -1.03509 +#> ds 1 m1 90 9.3 7.705e+00 1.59536 1.0672 1.49491 +#> ds 1 m1 120 3.5 5.236e+00 -1.73617 0.9699 -1.79010 +#> ds 1 m1 120 5.4 5.236e+00 0.16383 0.9699 0.16892 +#> ds 2 parent 0 118.0 1.014e+02 16.57492 8.0383 2.06198 +#> ds 2 parent 0 99.8 1.014e+02 -1.62508 8.0383 -0.20217 +#> ds 2 parent 1 90.2 9.599e+01 -5.79045 7.6129 -0.76061 +#> ds 2 parent 1 94.6 9.599e+01 -1.39045 7.6129 -0.18264 +#> ds 2 parent 3 96.1 8.652e+01 9.57931 6.8724 1.39388 +#> ds 2 parent 3 78.4 8.652e+01 -8.12069 6.8724 -1.18164 +#> ds 2 parent 7 77.9 7.197e+01 5.93429 5.7370 1.03439 +#> ds 2 parent 7 77.7 7.197e+01 5.73429 5.7370 0.99953 +#> ds 2 parent 14 56.0 5.555e+01 0.44657 4.4637 0.10005 +#> ds 2 parent 14 54.7 5.555e+01 -0.85343 4.4637 -0.19120 +#> ds 2 parent 28 36.6 3.853e+01 -1.93170 3.1599 -0.61132 +#> ds 2 parent 28 36.8 3.853e+01 -1.73170 3.1599 -0.54803 +#> ds 2 parent 60 22.1 2.110e+01 1.00360 1.8795 0.53396 +#> ds 2 parent 60 24.7 2.110e+01 3.60360 1.8795 1.91728 +#> ds 2 parent 90 12.4 1.250e+01 -0.09712 1.3190 -0.07363 +#> ds 2 parent 90 10.8 1.250e+01 -1.69712 1.3190 -1.28667 +#> ds 2 parent 120 6.8 7.419e+00 -0.61913 1.0546 -0.58709 +#> ds 2 parent 120 7.9 7.419e+00 0.48087 1.0546 0.45599 +#> ds 2 m1 1 1.3 1.422e+00 -0.12194 0.8849 -0.13781 +#> ds 2 m1 3 3.7 3.831e+00 -0.13149 0.9282 -0.14166 +#> ds 2 m1 3 4.7 3.831e+00 0.86851 0.9282 0.93567 +#> ds 2 m1 7 8.1 7.292e+00 0.80812 1.0490 0.77034 +#> ds 2 m1 7 7.9 7.292e+00 0.60812 1.0490 0.57969 +#> ds 2 m1 14 10.1 1.055e+01 -0.45332 1.2090 -0.37495 +#> ds 2 m1 14 10.3 1.055e+01 -0.25332 1.2090 -0.20953 +#> ds 2 m1 28 10.7 1.230e+01 -1.59960 1.3074 -1.22347 +#> ds 2 m1 28 12.2 1.230e+01 -0.09960 1.3074 -0.07618 +#> ds 2 m1 60 10.7 1.065e+01 0.05342 1.2141 0.04400 +#> ds 2 m1 60 12.5 1.065e+01 1.85342 1.2141 1.52661 +#> ds 2 m1 90 9.1 8.196e+00 0.90368 1.0897 0.82930 +#> ds 2 m1 90 7.4 8.196e+00 -0.79632 1.0897 -0.73078 +#> ds 2 m1 120 6.1 5.997e+00 0.10252 0.9969 0.10284 +#> ds 2 m1 120 4.5 5.997e+00 -1.49748 0.9969 -1.50220 +#> ds 3 parent 0 106.2 1.014e+02 4.77492 8.0383 0.59402 +#> ds 3 parent 0 106.9 1.014e+02 5.47492 8.0383 0.68110 +#> ds 3 parent 1 107.4 9.390e+01 13.49935 7.4494 1.81214 +#> ds 3 parent 1 96.1 9.390e+01 2.19935 7.4494 0.29524 +#> ds 3 parent 3 79.4 8.152e+01 -2.12307 6.4821 -0.32753 +#> ds 3 parent 3 82.6 8.152e+01 1.07693 6.4821 0.16614 +#> ds 3 parent 7 63.9 6.446e+01 -0.55834 5.1533 -0.10834 +#> ds 3 parent 7 62.4 6.446e+01 -2.05834 5.1533 -0.39942 +#> ds 3 parent 14 51.0 4.826e+01 2.74073 3.9019 0.70241 +#> ds 3 parent 14 47.1 4.826e+01 -1.15927 3.9019 -0.29711 +#> ds 3 parent 28 36.1 3.424e+01 1.86399 2.8364 0.65718 +#> ds 3 parent 28 36.6 3.424e+01 2.36399 2.8364 0.83346 +#> ds 3 parent 60 20.1 1.968e+01 0.42172 1.7815 0.23672 +#> ds 3 parent 60 19.8 1.968e+01 0.12172 1.7815 0.06833 +#> ds 3 parent 90 11.3 1.195e+01 -0.64633 1.2869 -0.50222 +#> ds 3 parent 90 10.7 1.195e+01 -1.24633 1.2869 -0.96844 +#> ds 3 parent 120 8.2 7.255e+00 0.94532 1.0474 0.90251 +#> ds 3 parent 120 7.3 7.255e+00 0.04532 1.0474 0.04327 +#> ds 3 m1 0 0.8 2.956e-11 0.80000 0.8778 0.91140 +#> ds 3 m1 1 1.8 1.758e+00 0.04187 0.8886 0.04712 +#> ds 3 m1 1 2.3 1.758e+00 0.54187 0.8886 0.60978 +#> ds 3 m1 3 4.2 4.567e+00 -0.36697 0.9486 -0.38683 +#> ds 3 m1 3 4.1 4.567e+00 -0.46697 0.9486 -0.49224 +#> ds 3 m1 7 6.8 8.151e+00 -1.35124 1.0876 -1.24242 +#> ds 3 m1 7 10.1 8.151e+00 1.94876 1.0876 1.79182 +#> ds 3 m1 14 11.4 1.083e+01 0.57098 1.2240 0.46647 +#> ds 3 m1 14 12.8 1.083e+01 1.97098 1.2240 1.61022 +#> ds 3 m1 28 11.5 1.147e+01 0.03175 1.2597 0.02520 +#> ds 3 m1 28 10.6 1.147e+01 -0.86825 1.2597 -0.68928 +#> ds 3 m1 60 7.5 9.298e+00 -1.79834 1.1433 -1.57298 +#> ds 3 m1 60 8.6 9.298e+00 -0.69834 1.1433 -0.61083 +#> ds 3 m1 90 7.3 7.038e+00 0.26249 1.0382 0.25283 +#> ds 3 m1 90 8.1 7.038e+00 1.06249 1.0382 1.02340 +#> ds 3 m1 120 5.3 5.116e+00 0.18417 0.9659 0.19068 +#> ds 3 m1 120 3.8 5.116e+00 -1.31583 0.9659 -1.36232 +#> ds 4 parent 0 104.7 1.014e+02 3.27492 8.0383 0.40741 +#> ds 4 parent 0 88.3 1.014e+02 -13.12508 8.0383 -1.63281 +#> ds 4 parent 1 94.2 9.781e+01 -3.61183 7.7555 -0.46572 +#> ds 4 parent 1 94.6 9.781e+01 -3.21183 7.7555 -0.41414 +#> ds 4 parent 3 78.1 9.110e+01 -13.00467 7.2307 -1.79853 +#> ds 4 parent 3 96.5 9.110e+01 5.39533 7.2307 0.74617 +#> ds 4 parent 7 76.2 7.951e+01 -3.30511 6.3246 -0.52258 +#> ds 4 parent 7 77.8 7.951e+01 -1.70511 6.3246 -0.26960 +#> ds 4 parent 14 70.8 6.376e+01 7.03783 5.0993 1.38016 +#> ds 4 parent 14 67.3 6.376e+01 3.53783 5.0993 0.69379 +#> ds 4 parent 28 43.1 4.340e+01 -0.30456 3.5303 -0.08627 +#> ds 4 parent 28 45.1 4.340e+01 1.69544 3.5303 0.48026 +#> ds 4 parent 60 21.3 2.142e+01 -0.12077 1.9022 -0.06349 +#> ds 4 parent 60 23.5 2.142e+01 2.07923 1.9022 1.09308 +#> ds 4 parent 90 11.8 1.207e+01 -0.26813 1.2940 -0.20721 +#> ds 4 parent 90 12.1 1.207e+01 0.03187 1.2940 0.02463 +#> ds 4 parent 120 7.0 6.954e+00 0.04554 1.0347 0.04402 +#> ds 4 parent 120 6.2 6.954e+00 -0.75446 1.0347 -0.72914 +#> ds 4 m1 0 1.6 1.990e-13 1.60000 0.8778 1.82279 +#> ds 4 m1 1 0.9 7.305e-01 0.16949 0.8797 0.19267 +#> ds 4 m1 3 3.7 2.051e+00 1.64896 0.8925 1.84753 +#> ds 4 m1 3 2.0 2.051e+00 -0.05104 0.8925 -0.05719 +#> ds 4 m1 7 3.6 4.204e+00 -0.60375 0.9382 -0.64354 +#> ds 4 m1 7 3.8 4.204e+00 -0.40375 0.9382 -0.43036 +#> ds 4 m1 14 7.1 6.760e+00 0.34021 1.0267 0.33137 +#> ds 4 m1 14 6.6 6.760e+00 -0.15979 1.0267 -0.15563 +#> ds 4 m1 28 9.5 9.011e+00 0.48856 1.1289 0.43277 +#> ds 4 m1 28 9.3 9.011e+00 0.28856 1.1289 0.25561 +#> ds 4 m1 60 8.3 8.611e+00 -0.31077 1.1093 -0.28014 +#> ds 4 m1 60 9.0 8.611e+00 0.38923 1.1093 0.35086 +#> ds 4 m1 90 6.6 6.678e+00 -0.07753 1.0233 -0.07576 +#> ds 4 m1 90 7.7 6.678e+00 1.02247 1.0233 0.99915 +#> ds 4 m1 120 3.7 4.847e+00 -1.14679 0.9572 -1.19804 +#> ds 4 m1 120 3.5 4.847e+00 -1.34679 0.9572 -1.40698 +#> ds 5 parent 0 110.4 1.014e+02 8.97492 8.0383 1.11651 +#> ds 5 parent 0 112.1 1.014e+02 10.67492 8.0383 1.32800 +#> ds 5 parent 1 93.5 9.466e+01 -1.16118 7.5089 -0.15464 +#> ds 5 parent 1 91.0 9.466e+01 -3.66118 7.5089 -0.48758 +#> ds 5 parent 3 71.0 8.302e+01 -12.01844 6.5988 -1.82130 +#> ds 5 parent 3 89.7 8.302e+01 6.68156 6.5988 1.01254 +#> ds 5 parent 7 60.4 6.563e+01 -5.22574 5.2440 -0.99652 +#> ds 5 parent 7 59.1 6.563e+01 -6.52574 5.2440 -1.24442 +#> ds 5 parent 14 56.5 4.727e+01 9.22621 3.8263 2.41128 +#> ds 5 parent 14 47.0 4.727e+01 -0.27379 3.8263 -0.07156 +#> ds 5 parent 28 30.2 3.103e+01 -0.83405 2.5977 -0.32108 +#> ds 5 parent 28 23.9 3.103e+01 -7.13405 2.5977 -2.74634 +#> ds 5 parent 60 17.0 1.800e+01 -0.99696 1.6675 -0.59787 +#> ds 5 parent 60 18.7 1.800e+01 0.70304 1.6675 0.42161 +#> ds 5 parent 90 11.3 1.167e+01 -0.36809 1.2710 -0.28961 +#> ds 5 parent 90 11.9 1.167e+01 0.23191 1.2710 0.18246 +#> ds 5 parent 120 9.0 7.595e+00 1.40496 1.0623 1.32256 +#> ds 5 parent 120 8.1 7.595e+00 0.50496 1.0623 0.47535 +#> ds 5 m1 0 0.7 0.000e+00 0.70000 0.8778 0.79747 +#> ds 5 m1 1 3.0 3.158e+00 -0.15799 0.9123 -0.17317 +#> ds 5 m1 1 2.6 3.158e+00 -0.55799 0.9123 -0.61160 +#> ds 5 m1 3 5.1 8.443e+00 -3.34286 1.1013 -3.03535 +#> ds 5 m1 3 7.5 8.443e+00 -0.94286 1.1013 -0.85613 +#> ds 5 m1 7 16.5 1.580e+01 0.69781 1.5232 0.45811 +#> ds 5 m1 7 19.0 1.580e+01 3.19781 1.5232 2.09935 +#> ds 5 m1 14 22.9 2.216e+01 0.73604 1.9543 0.37663 +#> ds 5 m1 14 23.2 2.216e+01 1.03604 1.9543 0.53014 +#> ds 5 m1 28 22.2 2.423e+01 -2.03128 2.1011 -0.96678 +#> ds 5 m1 28 24.4 2.423e+01 0.16872 2.1011 0.08030 +#> ds 5 m1 60 15.5 1.876e+01 -3.25610 1.7187 -1.89455 +#> ds 5 m1 60 19.8 1.876e+01 1.04390 1.7187 0.60739 +#> ds 5 m1 90 14.9 1.366e+01 1.23585 1.3890 0.88976 +#> ds 5 m1 90 14.2 1.366e+01 0.53585 1.3890 0.38579 +#> ds 5 m1 120 10.9 9.761e+00 1.13911 1.1670 0.97613 +#> ds 5 m1 120 10.4 9.761e+00 0.63911 1.1670 0.54767 +# Add a correlation between random effects of g and k2 +cov_model_3 <- f_saem_dfop_sfo_2$so@model@covariance.model +cov_model_3["log_k2", "g_qlogis"] <- 1 +cov_model_3["g_qlogis", "log_k2"] <- 1 +f_saem_dfop_sfo_3 <- update(f_saem_dfop_sfo, + covariance.model = cov_model_3) +intervals(f_saem_dfop_sfo_3) +#> Approximate 95% confidence intervals +#> +#> Fixed effects: +#> lower est. upper +#> parent_0 98.39888363 101.48951337 104.58014311 +#> k_m1 0.01508704 0.01665986 0.01839665 +#> f_parent_to_m1 0.20141557 0.27540583 0.36418131 +#> k1 0.07708759 0.10430866 0.14114200 +#> k2 0.01476621 0.01786384 0.02161129 +#> g 0.33679867 0.45083525 0.57028162 +#> +#> Random effects: +#> lower est. upper +#> sd(f_parent_qlogis) 0.38085375 0.4441841 0.5075145 +#> sd(log_k1) 0.04774819 0.2660384 0.4843286 +#> sd(log_k2) -0.63842736 0.1977024 1.0338321 +#> sd(g_qlogis) 0.22711289 0.4502227 0.6733326 +#> corr(log_k2,g_qlogis) -0.83271473 -0.6176939 -0.4026730 +#> +#> +#> lower est. upper +#> a.1 0.67347568 0.87437392 1.07527216 +#> b.1 0.06393032 0.07912417 0.09431802 +# The correlation does not improve the fit judged by AIC and BIC, although +# the likelihood is higher with the additional parameter +anova(f_saem_dfop_sfo, f_saem_dfop_sfo_2, f_saem_dfop_sfo_3) +#> Data: 171 observations of 2 variable(s) grouped in 5 datasets +#> +#> npar AIC BIC Lik +#> f_saem_dfop_sfo_2 12 806.96 802.27 -391.48 +#> f_saem_dfop_sfo_3 13 807.99 802.91 -391.00 +#> f_saem_dfop_sfo 14 810.83 805.36 -391.42 # }
    -- cgit v1.2.1 From 24eb77216700cf8b2f2bde3abad84c1f83f9e32a Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 9 Jan 2023 06:22:04 +0100 Subject: Prebuilt PDF vignettes, summary_listing --- .../reference/example_analysis/dlls/sforb_sfo2.so | Bin 0 -> 17272 bytes .../example_analysis/example_analysis.Rmd | 314 +++++++++++++++++++++ docs/dev/reference/example_analysis/header.tex | 1 + docs/dev/reference/example_analysis/skeleton.pdf | Bin 0 -> 351780 bytes .../figure-latex/unnamed-chunk-11-1.pdf | Bin 0 -> 30166 bytes .../figure-latex/unnamed-chunk-16-1.pdf | Bin 0 -> 30137 bytes .../figure-latex/unnamed-chunk-6-1.pdf | Bin 0 -> 16408 bytes .../figure-latex/unnamed-chunk-9-1.pdf | Bin 0 -> 16043 bytes docs/dev/reference/hierarchical_kinetics.html | 154 ++++++++++ docs/dev/reference/index.html | 10 +- docs/dev/reference/mkinmod.html | 10 +- docs/dev/reference/summary_listing.html | 147 ++++++++++ 12 files changed, 628 insertions(+), 8 deletions(-) create mode 100755 docs/dev/reference/example_analysis/dlls/sforb_sfo2.so create mode 100644 docs/dev/reference/example_analysis/example_analysis.Rmd create mode 100644 docs/dev/reference/example_analysis/header.tex create mode 100644 docs/dev/reference/example_analysis/skeleton.pdf create mode 100644 docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-11-1.pdf create mode 100644 docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-16-1.pdf create mode 100644 docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-6-1.pdf create mode 100644 docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-9-1.pdf create mode 100644 docs/dev/reference/hierarchical_kinetics.html create mode 100644 docs/dev/reference/summary_listing.html (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/example_analysis/dlls/sforb_sfo2.so b/docs/dev/reference/example_analysis/dlls/sforb_sfo2.so new file mode 100755 index 00000000..a692256d Binary files /dev/null and b/docs/dev/reference/example_analysis/dlls/sforb_sfo2.so differ diff --git a/docs/dev/reference/example_analysis/example_analysis.Rmd b/docs/dev/reference/example_analysis/example_analysis.Rmd new file mode 100644 index 00000000..38a6bd20 --- /dev/null +++ b/docs/dev/reference/example_analysis/example_analysis.Rmd @@ -0,0 +1,314 @@ +--- +title: "Hierarchical kinetic modelling of degradation data" +author: +date: +output: mkin::hierarchical_kinetics +geometry: margin=2cm +--- + +\clearpage + +# Setup + +```{r packages, cache = FALSE, message = FALSE} +library(mkin) +library(knitr) +library(saemix) +library(parallel) +library(readxl) +``` + +```{r n_cores, cache = FALSE} +n_cores <- detectCores() + +if (Sys.info()["sysname"] == "Windows") { + cl <- makePSOCKcluster(n_cores) +} else { + cl <- makeForkCluster(n_cores) +} +``` + +\clearpage + +# Introduction + +This report shows hierarchical kinetic modelling for ... +The data were obtained from ... + +```{r ds} +data_path <- system.file( + "testdata", "lambda-cyhalothrin_soil_efsa_2014.xlsx", + package = "mkin") +ds <- read_spreadsheet(data_path, valid_datasets = c(1:4, 7:13)) +covariates <- attr(ds, "covariates") +``` + +The covariate data are shown below. + +```{r results = "asis", dependson = "ds", echo = FALSE} +kable(covariates, caption = "Covariate data for all datasets") +``` + +\clearpage + +The datasets with the residue time series are shown in the tables below. Please +refer to the spreadsheet for details like data sources, treatment of values +below reporting limits and time step normalisation factors. + +```{r results = "asis", dependson = "ds", echo = FALSE} +for (ds_name in names(ds)) { + print( + kable(mkin_long_to_wide(ds[[ds_name]]), + caption = paste("Dataset", ds_name), + booktabs = TRUE, row.names = FALSE)) + cat("\n\\clearpage\n") +} +``` + +# Parent only evaluations + +The following code performs separate fits of the candidate degradation models +to all datasets using constant variance and the two-component error model. + +```{r parent-sep, dependson = "ds"} +parent_deg_mods <- c("SFO", "FOMC", "DFOP", "SFORB") +errmods <- c(const = "constant variance", tc = "two-component error") +parent_sep_const <- mmkin( + parent_deg_mods, ds, + error_model = "const", + cluster = cl, quiet = TRUE) +parent_sep_tc <- update(parent_sep_const, error_model = "tc") +``` + +To select the parent model, the corresponding hierarchical fits are performed below. + +```{r parent-mhmkin, dependson = "parent-sep"} +parent_mhmkin <- mhmkin(list(parent_sep_const, parent_sep_tc), cluster = cl) +status(parent_mhmkin) |> kable() +``` + +All fits terminate without errors (status OK). The check for ill-defined +parameters shows that not all random effect parameters can be robustly +quantified. + +```{r dependson = "parent_mhmkin"} +illparms(parent_mhmkin) |> kable() +``` + +Therefore, the fits are updated, excluding random effects that were +ill-defined according to the `illparms` function. The status of the fits +is checked. + +```{r parent-mhmkin-refined} +parent_mhmkin_refined <- update(parent_mhmkin, + no_random_effect = illparms(parent_mhmkin)) +status(parent_mhmkin_refined) |> kable() +``` + +Also, it is checked if the AIC values of the refined fits are actually smaller +than the AIC values of the original fits. + +```{r dependson = "parent-mhmkin-refined"} +(AIC(parent_mhmkin_refined) < AIC(parent_mhmkin)) |> kable() +``` + +From the refined fits, the most suitable model is selected using the AIC. + +```{r parent-best, dependson = "parent-mhmkin"} +aic_parent <- AIC(parent_mhmkin_refined) +min_aic <- which(aic_parent == min(aic_parent), arr.ind = TRUE) +best_degmod_parent <- rownames(aic_parent)[min_aic[1]] +best_errmod_parent <- colnames(aic_parent)[min_aic[2]] +anova(parent_mhmkin_refined) |> kable(digits = 1) +parent_best <- parent_mhmkin_refined[[best_degmod_parent, best_errmod_parent]] +``` + +Based on the AIC, the combination of the `r best_degmod_parent` degradation +model with the error model `r errmods[best_errmod_parent]` is identified to +be most suitable for the degradation of the parent. The check below +confirms that no ill-defined parameters remain for this combined model. + +```{r dependson = "parent-best"} +illparms(parent_best) +``` + +The corresponding fit is plotted below. + +```{r dependson = "parent-best"} +plot(parent_best) +``` +The fitted parameters, together with approximate confidence +intervals are listed below. + +```{r dependson = "parent-best"} +parms(parent_best, ci = TRUE) |> kable(digits = 3) +``` + +To investigate a potential covariate influence on degradation parameters, a +covariate model is added to the hierarchical model for each of the degradation +parameters with well-defined random effects. Also, a version with covariate +models for both of them is fitted. + +```{r parent-best-pH} +parent_best_pH_1 <- update(parent_best, covariates = covariates, + covariate_models = list(log_k_lambda_free ~ pH)) +parent_best_pH_2 <- update(parent_best, covariates = covariates, + covariate_models = list(log_k_lambda_bound_free ~ pH)) +parent_best_pH_3 <- update(parent_best, covariates = covariates, + covariate_models = list(log_k_lambda_free ~ pH, log_k_lambda_bound_free ~ pH)) +``` + +The resulting models are compared. + +```{r dependson = "parent-best-pH"} +anova(parent_best, parent_best_pH_1, parent_best_pH_2, parent_best_pH_3) |> + kable(digits = 1) +``` + +The model fit with the lowest AIC is the one with a pH correlation of the +desorption rate constant `k_lambda_bound_free`. Plot and parameter listing +of this fit are shown below. Also, it is confirmed that no ill-defined +variance parameters are found. + +```{r dependson = "parent-best-pH"} +plot(parent_best_pH_2) +``` + +```{r dependson = "parent-best-pH"} +illparms(parent_best_pH_2) +parms(parent_best_pH_2, ci = TRUE) |> kable(digits = 3) +``` + +\clearpage + +# Pathway fits + +As an example of a pathway fit, a model with SFORB for the parent compound and +parallel formation of two metabolites is set up. + +```{r path-1-degmod} +if (!dir.exists("dlls")) dir.create("dlls") + +m_sforb_sfo2 = mkinmod( + lambda = mkinsub("SFORB", to = c("c_V", "c_XV")), + c_V = mkinsub("SFO"), + c_XV = mkinsub("SFO"), + name = "sforb_sfo2", + dll_dir = "dlls", + overwrite = TRUE, quiet = TRUE +) +``` + +Separate evaluations of all datasets are performed with constant variance +and using two-component error. + +```{r path-1-sep, dependson = c("path-1-degmod", "ds")} +sforb_sep_const <- mmkin(list(sforb_path = m_sforb_sfo2), ds, + cluster = cl, quiet = TRUE) +sforb_sep_tc <- update(sforb_sep_const, error_model = "tc") +``` + +The separate fits with constant variance are plotted. + +```{r dependson = "path-1-sep", fig.height = 9} +plot(mixed(sforb_sep_const)) +``` + +The two corresponding hierarchical fits, with the random effects for the parent +degradation parameters excluded as discussed above, and including the covariate +model that was identified for the parent degradation, are attempted below. + +```{r path-1, dependson = "path-1-sep"} +path_1 <- mhmkin(list(sforb_sep_const, sforb_sep_tc), + no_random_effect = c("lambda_free_0", "log_k_lambda_free_bound"), + covariates = covariates, covariate_models = list(log_k_lambda_bound_free ~ pH), + cluster = cl) +``` + +```{r dependson = "path-1"} +status(path_1) |> kable() +``` + +The status information shows that both fits were successfully completed. + +```{r dependson = "path-1"} +anova(path_1) |> kable(digits = 1) +``` +Model comparison shows that the two-component error model provides a much +better fit. + +```{r dependson = "path-1"} +illparms(path_1[["sforb_path", "tc"]]) +``` + +Two ill-defined variance components are found. Therefore, the fit is +repeated with the corresponding random effects removed. + +```{r path-1-refined, dependson = "path-1"} +path_1_refined <- update(path_1[["sforb_path", "tc"]], + no_random_effect = c("lambda_free_0", "log_k_lambda_free_bound", + "log_k_c_XV", "f_lambda_ilr_2")) +``` + +The empty output of the illparms function indicates that there are no +ill-defined parameters remaining in the refined fit. + +```{r dependson = "path-1-refined"} +illparms(path_1_refined) +``` + +Below, the refined fit is plotted and the fitted parameters are shown together +with their 95% confidence intervals. + +```{r dependson = "path-1-refined", fig.height = 9} +plot(path_1_refined) +``` + +```{r dependson = "path-1-refined", fig.height = 9} +parms(path_1_refined, ci = TRUE) |> kable(digits = 3) +``` + +\clearpage + +# Appendix + +## Listings of initial parent fits + +```{r listings-parent, results = "asis", echo = FALSE, dependson = "parent_mhmkin"} +for (deg_mod in parent_deg_mods) { + for (err_mod in c("const", "tc")) { + caption <- paste("Hierarchical", deg_mod, "fit with", errmods[err_mod]) + tex_listing(parent_mhmkin[[deg_mod, err_mod]], caption) + } +} +``` + +## Listings of refined parent fits + +```{r listings-parent-refined, results = "asis", echo = FALSE, dependson = "parent_mhmkin_refined"} +for (deg_mod in parent_deg_mods) { + for (err_mod in c("const", "tc")) { + caption <- paste("Refined hierarchical", deg_mod, "fit with", errmods[err_mod]) + tex_listing(parent_mhmkin_refined[[deg_mod, err_mod]], caption) + } +} +``` + +## Listings of pathway fits + +```{r listings-path-1, results = "asis", echo = FALSE, dependson = "path-1-refined"} +tex_listing(path_1[["sforb_path", "const"]], + caption = "Hierarchical fit of SFORB-SFO2 with constant variance") +tex_listing(path_1[["sforb_path", "tc"]], + caption = "Hierarchical fit of SFORB-SFO2 with two-component error") +tex_listing(path_1_refined, + caption = "Refined hierarchical fit of SFORB-SFO2 with two-component error") +``` + +## Session info + +```{r echo = FALSE, cache = FALSE} +parallel::stopCluster(cl) +sessionInfo() +``` + diff --git a/docs/dev/reference/example_analysis/header.tex b/docs/dev/reference/example_analysis/header.tex new file mode 100644 index 00000000..a2b7ce83 --- /dev/null +++ b/docs/dev/reference/example_analysis/header.tex @@ -0,0 +1 @@ +\definecolor{shadecolor}{RGB}{248,248,248} diff --git a/docs/dev/reference/example_analysis/skeleton.pdf b/docs/dev/reference/example_analysis/skeleton.pdf new file mode 100644 index 00000000..53c5fb31 Binary files /dev/null and b/docs/dev/reference/example_analysis/skeleton.pdf differ diff --git a/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-11-1.pdf b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-11-1.pdf new file mode 100644 index 00000000..ab685d92 Binary files /dev/null and b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-11-1.pdf differ diff --git a/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-16-1.pdf b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-16-1.pdf new file mode 100644 index 00000000..5d88063b Binary files /dev/null and b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-16-1.pdf differ diff --git a/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-6-1.pdf b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-6-1.pdf new file mode 100644 index 00000000..5e0d7b6f Binary files /dev/null and b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-6-1.pdf differ diff --git a/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-9-1.pdf b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-9-1.pdf new file mode 100644 index 00000000..eecd06a8 Binary files /dev/null and b/docs/dev/reference/example_analysis/skeleton_files/figure-latex/unnamed-chunk-9-1.pdf differ diff --git a/docs/dev/reference/hierarchical_kinetics.html b/docs/dev/reference/hierarchical_kinetics.html new file mode 100644 index 00000000..bedb8753 --- /dev/null +++ b/docs/dev/reference/hierarchical_kinetics.html @@ -0,0 +1,154 @@ + +Hierarchical kinetics template — hierarchical_kinetics • mkin + + +
    +
    + + + +
    +
    + + +
    +

    R markdown format for setting up hierarchical kinetics based on a template +provided with the mkin package.

    +
    + +
    +
    hierarchical_kinetics(..., keep_tex = FALSE)
    +
    + +
    +

    Arguments

    +
    ...
    +

    Arguments to rmarkdown::pdf_document

    + + +
    keep_tex
    +

    Keep the intermediate tex file used in the conversion to PDF

    + +
    +
    +

    Value

    + + +

    R Markdown output format to pass to +render

    + + +
    + +
    +

    Examples

    +
    
    +# \dontrun{
    +library(rmarkdown)
    +draft("example_analysis.rmd", template = "hierarchical_kinetics", package = "mkin")
    +# }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.0.7.

    +
    + +
    + + + + + + + + diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index 794126cf..525551fd 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -195,6 +195,10 @@ of an mmkin object

    Create and work with nonlinear hierarchical models

    +

    hierarchical_kinetics()

    + +

    Hierarchical kinetics template

    +

    read_spreadsheet()

    Read datasets and relevant meta information from a spreadsheet file

    @@ -356,9 +360,9 @@ degradation models and one or more error models

    -

    tex_listing()

    +

    summary_listing() tex_listing() html_listing()

    -

    Wrap the output of a summary function in tex listing environment

    +

    Display the output of a summary function according to the output format

    f_time_norm_focus()

    @@ -493,7 +497,7 @@ kinetic models fitted with mkinfit

    -

    Site built with pkgdown 2.0.6.

    +

    Site built with pkgdown 2.0.7.

    diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html index 251215a7..145dee83 100644 --- a/docs/dev/reference/mkinmod.html +++ b/docs/dev/reference/mkinmod.html @@ -132,7 +132,7 @@ the source compartment. Additionally, mkinsub() has an argument to, specifying names of variables to which a transfer is to be assumed in the model. If the argument use_of_ff is set to "min" -(default) and the model for the compartment is "SFO" or "SFORB", an +and the model for the compartment is "SFO" or "SFORB", an additional mkinsub() argument can be sink = FALSE, effectively fixing the flux to sink to zero. In print.mkinmod, this argument is currently not used.

    @@ -247,7 +247,7 @@ in the FOCUS and NAFTA guidance documents are used.

    For kinetic models with more than one observed variable, a symbolic solution of the system of differential equations is included in the resulting mkinmod object in some cases, speeding up the solution.

    -

    If a C compiler is found by pkgbuild::has_compiler() and there +

    If a C compiler is found by pkgbuild::has_compiler() and there is more than one observed variable in the specification, C code is generated for evaluating the differential equations, compiled using inline::cfunction() and added to the resulting mkinmod object.

    @@ -310,7 +310,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

    parent = mkinsub("SFO", "m1", full_name = "Test compound"), m1 = mkinsub("SFO", full_name = "Metabolite M1"), name = "SFO_SFO", dll_dir = DLL_dir, unload = TRUE, overwrite = TRUE) -#> Copied DLL from /tmp/RtmpbZbZ8Y/file8c6a9f402f42.so to /home/jranke/.local/share/mkin/SFO_SFO.so +#> Copied DLL from /tmp/RtmpelWAOB/fileb43c31a25a86.so to /home/jranke/.local/share/mkin/SFO_SFO.so # Now we can save the model and restore it in a new session saveRDS(SFO_SFO.2, file = "~/SFO_SFO.rds") # Terminate the R session here if you would like to check, and then do @@ -363,7 +363,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

    #> }) #> return(predicted) #> } -#> <environment: 0x55556029f678> +#> <environment: 0x55555f013820> # If we have several parallel metabolites # (compare tests/testthat/test_synthetic_data_for_UBA_2014.R) @@ -392,7 +392,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

    -

    Site built with pkgdown 2.0.6.

    +

    Site built with pkgdown 2.0.7.

    diff --git a/docs/dev/reference/summary_listing.html b/docs/dev/reference/summary_listing.html new file mode 100644 index 00000000..876412cc --- /dev/null +++ b/docs/dev/reference/summary_listing.html @@ -0,0 +1,147 @@ + +Display the output of a summary function according to the output format — summary_listing • mkin + + +
    +
    + + + +
    +
    + + +
    +

    This function is intended for use in a R markdown code chunk with the chunk +option results = "asis".

    +
    + +
    +
    summary_listing(object, caption = NULL, label = NULL, clearpage = TRUE)
    +
    +tex_listing(object, caption = NULL, label = NULL, clearpage = TRUE)
    +
    +html_listing(object, caption = NULL)
    +
    + +
    +

    Arguments

    +
    object
    +

    The object for which the summary is to be listed

    + + +
    caption
    +

    An optional caption

    + + +
    label
    +

    An optional label, ignored in html output

    + + +
    clearpage
    +

    Should a new page be started after the listing? Ignored in html output

    + +
    + +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.0.7.

    +
    + +
    + + + + + + + + -- cgit v1.2.1 From 9aa186eaf43d3c86a99fd08c310cefbc5dfe0612 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 28 Jan 2023 17:40:31 +0100 Subject: Build online HTML versions of prebuilt vignettes Also, give some structure to the menu for selecting articles --- docs/dev/reference/index.html | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index 525551fd..b6d2db20 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -23,7 +23,7 @@