From 0b754ffa91b9496bdd2f892cf3ca2bd887028dea Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 27 Jul 2021 18:22:01 +0200 Subject: Fix dimethenamid vignette problems and update docs --- docs/dev/reference/dimethenamid_2018.html | 217 +++++++++++++++++++++++++++--- 1 file changed, 201 insertions(+), 16 deletions(-) (limited to 'docs/dev/reference/dimethenamid_2018.html') diff --git a/docs/dev/reference/dimethenamid_2018.html b/docs/dev/reference/dimethenamid_2018.html index e255765e..160dcaa3 100644 --- a/docs/dev/reference/dimethenamid_2018.html +++ b/docs/dev/reference/dimethenamid_2018.html @@ -77,7 +77,7 @@ constrained by data protection regulations." /> mkin - 1.0.5 + 1.1.0 @@ -168,7 +168,7 @@ constrained by data protection regulations.

Rapporteur Member State Germany, Co-Rapporteur Member State Bulgaria (2018) Renewal Assessment Report Dimethenamid-P Volume 3 - B.8 Environmental fate and behaviour Rev. 2 - November 2017 -http://registerofquestions.efsa.europa.eu/roqFrontend/outputLoader?output=ON-5211

+https://open.efsa.europa.eu/study-inventory/EFSA-Q-2014-00716

Details

The R code used to create this data object is installed with this package @@ -295,8 +295,11 @@ specific pieces of information in the comments.

#> M31 ~ add(sigma_low_M31) + prop(rsd_high_M31) #> }) #> } -#> <environment: 0x555559c2bd78>
f_dmta_nlmixr_focei <- nlmixr(f_dmta_mkin_tc, est = "focei", - control = nlmixr::foceiControl(print = 500)) +#> <environment: 0x555559c00ce8>
# The focei fit takes about four minutes on my system +system.time( + f_dmta_nlmixr_focei <- nlmixr(f_dmta_mkin_tc, est = "focei", + control = nlmixr::foceiControl(print = 500)) +)
#> parameter labels from comments are typically ignored in non-interactive mode
#> Need to run with the source intact to parse comments
#> → creating full model...
#> → pruning branches (`if`/`else`)...
#> done
#> → loading into symengine environment...
#> done
#> → creating full model...
#> → pruning branches (`if`/`else`)...
#> done
#> → loading into symengine environment...
#> done
#> → calculate jacobian
#> [====|====|====|====|====|====|====|====|====|====] 0:00:02 #>
#> → calculate sensitivities
#> [====|====|====|====|====|====|====|====|====|====] 0:00:04 #>
#> → calculate ∂(f)/∂(η)
#> [====|====|====|====|====|====|====|====|====|====] 0:00:01 @@ -320,12 +323,13 @@ specific pieces of information in the comments.

#> |.....................| o5 | o6 | o7 | o8 | #> |.....................| o9 | o10 |...........|...........| #> calculating covariance matrix -#> done
#> Calculating residuals/tables
#> done
#> Warning: initial ETAs were nudged; (can control by foceiControl(etaNudge=., etaNudge2=))
#> Warning: last objective function was not at minimum, possible problems in optimization
#> Warning: S matrix non-positive definite
#> Warning: using R matrix to calculate covariance
#> Warning: gradient problems with initial estimate and covariance; see $scaleInfo
summary(f_dmta_nlmixr_focei) +#> done
#> Calculating residuals/tables
#> done
#> Warning: initial ETAs were nudged; (can control by foceiControl(etaNudge=., etaNudge2=))
#> Warning: last objective function was not at minimum, possible problems in optimization
#> Warning: S matrix non-positive definite
#> Warning: using R matrix to calculate covariance
#> Warning: gradient problems with initial estimate and covariance; see $scaleInfo
#> user system elapsed +#> 227.879 9.742 237.728
summary(f_dmta_nlmixr_focei)
#> nlmixr version used for fitting: 2.0.4 -#> mkin version used for pre-fitting: 1.0.5 +#> mkin version used for pre-fitting: 1.1.0 #> R version used for fitting: 4.1.0 -#> Date of fit: Thu Jun 17 14:04:58 2021 -#> Date of summary: Thu Jun 17 14:04:58 2021 +#> Date of fit: Tue Jul 27 16:02:33 2021 +#> Date of summary: Tue Jul 27 16:02:34 2021 #> #> Equations: #> d_DMTA/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -346,7 +350,7 @@ specific pieces of information in the comments.

#> #> Degradation model predictions using RxODE #> -#> Fitted in 242.937 s +#> Fitted in 237.547 s #> #> Variance model: Two-component variance function #> @@ -480,13 +484,194 @@ specific pieces of information in the comments.

#> M23 34.99 116.24 NA NA NA #> M27 53.05 176.23 NA NA NA #> M31 48.48 161.05 NA NA NA
plot(f_dmta_nlmixr_focei) -
# saem has a problem with this model/data combination, maybe because of the -# overparameterised error model, to be investigated -#f_dmta_nlmixr_saem <- nlmixr(f_dmta_mkin_tc, est = "saem", -# control = saemControl(print = 500)) -#summary(f_dmta_nlmixr_saem) -#plot(f_dmta_nlmixr_saem) -# } +
# Using saemix takes about 18 minutes +system.time( + f_dmta_saemix <- saem(f_dmta_mkin_tc, test_log_parms = TRUE) +) +
#> Running main SAEM algorithm +#> [1] "Tue Jul 27 16:02:34 2021" +#> .... +#> Minimisation finished +#> [1] "Tue Jul 27 16:21:39 2021"
#> user system elapsed +#> 1213.394 0.087 1213.578
+# nlmixr with est = "saem" is pretty fast with default iteration numbers, most +# of the time (about 2.5 minutes) is spent for calculating the log likelihood at the end +# The likelihood calculated for the nlmixr fit is much lower than that found by saemix +# Also, the trace plot and the plot of the individual predictions is not +# convincing for the parent. It seems we are fitting an overparameterised +# model, so the result we get strongly depends on starting parameters and control settings. +system.time( + f_dmta_nlmixr_saem <- nlmixr(f_dmta_mkin_tc, est = "saem", + control = nlmixr::saemControl(print = 500, logLik = TRUE, nmc = 9)) +) +
#> With est = 'saem', a different error model is required for each observed variableChanging the error model to 'obs_tc' (Two-component error for each observed variable)
#> parameter labels from comments are typically ignored in non-interactive mode
#> Need to run with the source intact to parse comments
#>
#> → generate SAEM model
#> done
#> 1: 98.3427 -3.5148 -3.3187 -3.7728 -2.1163 -2.8457 0.9482 -2.8064 -2.7412 -2.8745 2.7912 0.6805 0.8213 0.8055 0.8578 1.4980 2.9309 0.2850 0.2854 0.2850 4.0990 0.3821 3.5349 0.6537 5.4143 0.0002 4.5093 0.1905 +#> 500: 97.8277 -4.3506 -4.0318 -4.1520 -3.0553 -3.5843 1.1326 -2.0873 -2.0421 -2.0751 0.2960 1.2515 0.2531 0.3807 0.7928 0.8863 6.5211 0.1433 0.1082 0.3353 0.8960 0.0470 0.7501 0.0475 0.9527 0.0281 0.7321 0.0594
#> Calculating covariance matrix
#>
#> Calculating -2LL by Gaussian quadrature (nnodes=3,nsd=1.6)
#>
#> → creating full model...
#> → pruning branches (`if`/`else`)...
#> done
#> → loading into symengine environment...
#> done
#> → compiling EBE model...
#>
#> done
#> Needed Covariates:
#> [1] "CMT"
#> Calculating residuals/tables
#> done
#> user system elapsed +#> 818.782 3.808 154.926
traceplot(f_dmta_nlmixr_saem$nm) +
#> Error in traceplot(f_dmta_nlmixr_saem$nm): could not find function "traceplot"
summary(f_dmta_nlmixr_saem) +
#> nlmixr version used for fitting: 2.0.4 +#> mkin version used for pre-fitting: 1.1.0 +#> R version used for fitting: 4.1.0 +#> Date of fit: Tue Jul 27 16:25:23 2021 +#> Date of summary: Tue Jul 27 16:25:23 2021 +#> +#> Equations: +#> d_DMTA/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * +#> time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time))) +#> * DMTA +#> d_M23/dt = + f_DMTA_to_M23 * ((k1 * g * exp(-k1 * time) + k2 * (1 - g) +#> * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * +#> exp(-k2 * time))) * DMTA - k_M23 * M23 +#> d_M27/dt = + f_DMTA_to_M27 * ((k1 * g * exp(-k1 * time) + k2 * (1 - g) +#> * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * +#> exp(-k2 * time))) * DMTA - k_M27 * M27 + k_M31 * M31 +#> d_M31/dt = + f_DMTA_to_M31 * ((k1 * g * exp(-k1 * time) + k2 * (1 - g) +#> * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * +#> exp(-k2 * time))) * DMTA - k_M31 * M31 +#> +#> Data: +#> 568 observations of 4 variable(s) grouped in 6 datasets +#> +#> Degradation model predictions using RxODE +#> +#> Fitted in 154.632 s +#> +#> Variance model: Two-component variance function +#> +#> Mean of starting values for individual parameters: +#> DMTA_0 log_k_M23 log_k_M27 log_k_M31 f_DMTA_ilr_1 f_DMTA_ilr_2 +#> 98.7698 -3.9216 -4.3377 -4.2477 0.1380 0.1393 +#> f_DMTA_ilr_3 log_k1 log_k2 g_qlogis +#> -1.7571 -2.2341 -3.7763 0.4502 +#> +#> Mean of starting values for error model parameters: +#> sigma_low_DMTA rsd_high_DMTA sigma_low_M23 rsd_high_M23 sigma_low_M27 +#> 0.69793 0.02577 0.69793 0.02577 0.69793 +#> rsd_high_M27 sigma_low_M31 rsd_high_M31 +#> 0.02577 0.69793 0.02577 +#> +#> Fixed degradation parameter values: +#> None +#> +#> Results: +#> +#> Likelihood calculated by focei +#> AIC BIC logLik +#> 2036 2157 -989.8 +#> +#> Optimised parameters: +#> est. lower upper +#> DMTA_0 97.828 96.121 99.535 +#> log_k_M23 -4.351 -5.300 -3.401 +#> log_k_M27 -4.032 -4.470 -3.594 +#> log_k_M31 -4.152 -4.689 -3.615 +#> log_k1 -3.055 -3.785 -2.325 +#> log_k2 -3.584 -4.517 -2.651 +#> g_qlogis 1.133 -2.165 4.430 +#> f_DMTA_tffm0_1_qlogis -2.087 -2.407 -1.768 +#> f_DMTA_tffm0_2_qlogis -2.042 -2.336 -1.748 +#> f_DMTA_tffm0_3_qlogis -2.075 -2.557 -1.593 +#> +#> Correlation: +#> DMTA_0 l__M23 l__M27 l__M31 log_k1 log_k2 g_qlgs +#> log_k_M23 -0.031 +#> log_k_M27 -0.050 0.004 +#> log_k_M31 -0.032 0.003 0.078 +#> log_k1 0.014 -0.002 -0.002 -0.001 +#> log_k2 0.059 0.006 -0.001 0.002 -0.037 +#> g_qlogis -0.077 0.005 0.009 0.004 0.035 -0.201 +#> f_DMTA_tffm0_1_qlogis -0.104 0.066 0.009 0.006 0.000 -0.011 0.014 +#> f_DMTA_tffm0_2_qlogis -0.120 0.013 0.081 -0.033 -0.002 -0.013 0.017 +#> f_DMTA_tffm0_3_qlogis -0.086 0.010 0.060 0.078 -0.002 -0.005 0.010 +#> f_DMTA_0_1 f_DMTA_0_2 +#> log_k_M23 +#> log_k_M27 +#> log_k_M31 +#> log_k1 +#> log_k2 +#> g_qlogis +#> f_DMTA_tffm0_1_qlogis +#> f_DMTA_tffm0_2_qlogis 0.026 +#> f_DMTA_tffm0_3_qlogis 0.019 0.002 +#> +#> Random effects (omega): +#> eta.DMTA_0 eta.log_k_M23 eta.log_k_M27 eta.log_k_M31 +#> eta.DMTA_0 0.296 0.000 0.0000 0.0000 +#> eta.log_k_M23 0.000 1.252 0.0000 0.0000 +#> eta.log_k_M27 0.000 0.000 0.2531 0.0000 +#> eta.log_k_M31 0.000 0.000 0.0000 0.3807 +#> eta.log_k1 0.000 0.000 0.0000 0.0000 +#> eta.log_k2 0.000 0.000 0.0000 0.0000 +#> eta.g_qlogis 0.000 0.000 0.0000 0.0000 +#> eta.f_DMTA_tffm0_1_qlogis 0.000 0.000 0.0000 0.0000 +#> eta.f_DMTA_tffm0_2_qlogis 0.000 0.000 0.0000 0.0000 +#> eta.f_DMTA_tffm0_3_qlogis 0.000 0.000 0.0000 0.0000 +#> eta.log_k1 eta.log_k2 eta.g_qlogis +#> eta.DMTA_0 0.0000 0.0000 0.000 +#> eta.log_k_M23 0.0000 0.0000 0.000 +#> eta.log_k_M27 0.0000 0.0000 0.000 +#> eta.log_k_M31 0.0000 0.0000 0.000 +#> eta.log_k1 0.7928 0.0000 0.000 +#> eta.log_k2 0.0000 0.8863 0.000 +#> eta.g_qlogis 0.0000 0.0000 6.521 +#> eta.f_DMTA_tffm0_1_qlogis 0.0000 0.0000 0.000 +#> eta.f_DMTA_tffm0_2_qlogis 0.0000 0.0000 0.000 +#> eta.f_DMTA_tffm0_3_qlogis 0.0000 0.0000 0.000 +#> eta.f_DMTA_tffm0_1_qlogis eta.f_DMTA_tffm0_2_qlogis +#> eta.DMTA_0 0.0000 0.0000 +#> eta.log_k_M23 0.0000 0.0000 +#> eta.log_k_M27 0.0000 0.0000 +#> eta.log_k_M31 0.0000 0.0000 +#> eta.log_k1 0.0000 0.0000 +#> eta.log_k2 0.0000 0.0000 +#> eta.g_qlogis 0.0000 0.0000 +#> eta.f_DMTA_tffm0_1_qlogis 0.1433 0.0000 +#> eta.f_DMTA_tffm0_2_qlogis 0.0000 0.1082 +#> eta.f_DMTA_tffm0_3_qlogis 0.0000 0.0000 +#> eta.f_DMTA_tffm0_3_qlogis +#> eta.DMTA_0 0.0000 +#> eta.log_k_M23 0.0000 +#> eta.log_k_M27 0.0000 +#> eta.log_k_M31 0.0000 +#> eta.log_k1 0.0000 +#> eta.log_k2 0.0000 +#> eta.g_qlogis 0.0000 +#> eta.f_DMTA_tffm0_1_qlogis 0.0000 +#> eta.f_DMTA_tffm0_2_qlogis 0.0000 +#> eta.f_DMTA_tffm0_3_qlogis 0.3353 +#> +#> Variance model: +#> sigma_low_DMTA rsd_high_DMTA sigma_low_M23 rsd_high_M23 sigma_low_M27 +#> 0.89603 0.04704 0.75015 0.04753 0.95265 +#> rsd_high_M27 sigma_low_M31 rsd_high_M31 +#> 0.02810 0.73212 0.05942 +#> +#> Backtransformed parameters: +#> est. lower upper +#> DMTA_0 97.82774 96.120503 99.53498 +#> k_M23 0.01290 0.004991 0.03334 +#> k_M27 0.01774 0.011451 0.02749 +#> k_M31 0.01573 0.009195 0.02692 +#> f_DMTA_to_M23 0.11033 NA NA +#> f_DMTA_to_M27 0.10218 NA NA +#> f_DMTA_to_M31 0.08784 NA NA +#> k1 0.04711 0.022707 0.09773 +#> k2 0.02775 0.010918 0.07056 +#> g 0.75632 0.102960 0.98823 +#> +#> Resulting formation fractions: +#> ff +#> DMTA_M23 0.11033 +#> DMTA_M27 0.10218 +#> DMTA_M31 0.08784 +#> DMTA_sink 0.69965 +#> +#> Estimated disappearance times: +#> DT50 DT90 DT50back DT50_k1 DT50_k2 +#> DMTA 16.59 57.44 17.29 14.71 24.97 +#> M23 53.74 178.51 NA NA NA +#> M27 39.07 129.78 NA NA NA +#> M31 44.06 146.36 NA NA NA
plot(f_dmta_nlmixr_saem) +
# }