From 7a1d3d031aa23fce723ac4f4c8e4bb5d64959447 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 4 Apr 2019 15:42:23 +0200 Subject: Direct error model fitting works - No IRLS required - Removed optimization algorithms other than Port - Removed the dependency on FME - Fitting the error model 'obs' is much faster for the FOCUS_2006_D dataset and the FOMC_SFO model (1 second versus 3.4 seconds) - Vignettes build slower. Compiled models needs 3 minutes instead of 1.5 - For other vignettes, the trend is less clear. Some fits are faster, even for error_model = "const". FOCUS_Z is faster (34.9 s versus 44.1 s) - Standard errors and confidence intervals are slightly smaller - Removed code for plotting during the fit, as I hardly ever used it - Merged the two cost functions (using transformed and untransformed parameters) into one log-likelihood function --- vignettes/FOCUS_D.html | 102 +++++++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 46 deletions(-) (limited to 'vignettes/FOCUS_D.html') diff --git a/vignettes/FOCUS_D.html b/vignettes/FOCUS_D.html index 0507740f..cb512e99 100644 --- a/vignettes/FOCUS_D.html +++ b/vignettes/FOCUS_D.html @@ -11,7 +11,7 @@ - + Example evaluation of FOCUS Example Dataset D @@ -372,7 +372,7 @@ $(document).ready(function () {

Example evaluation of FOCUS Example Dataset D

Johannes Ranke

-

2019-01-31

+

2019-04-04

@@ -438,16 +438,16 @@ print(FOCUS_2006_D)
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)

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

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

+

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

mkinparplot(fit)
-

+

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

summary(fit)
-
## mkin version used for fitting:    0.9.47.5 
-## R version used for fitting:       3.5.2 
-## Date of fit:     Thu Jan 31 16:45:24 2019 
-## Date of summary: Thu Jan 31 16:45:24 2019 
+
## mkin version used for fitting:    0.9.49.1 
+## R version used for fitting:       3.5.3 
+## Date of fit:     Thu Apr  4 17:06:46 2019 
+## Date of summary: Thu Apr  4 17:06:46 2019 
 ## 
 ## Equations:
 ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
@@ -455,9 +455,10 @@ print(FOCUS_2006_D)
## ## Model predictions using solution type deSolve ## -## Fitted with method Port using 153 model solutions performed in 0.684 s +## Fitted with method using 202 model solutions performed in 0.554 s ## -## Weighting: none +## Error model: +## NULL ## ## Starting values for parameters to be optimised: ## value type @@ -465,6 +466,7 @@ print(FOCUS_2006_D)
## k_parent_sink 0.1000 deparm ## k_parent_m1 0.1001 deparm ## k_m1_sink 0.1002 deparm +## sigma 1.0000 error ## ## Starting values for the transformed parameters actually optimised: ## value lower upper @@ -472,6 +474,7 @@ print(FOCUS_2006_D) ## log_k_parent_sink -2.302585 -Inf Inf ## log_k_parent_m1 -2.301586 -Inf Inf ## log_k_m1_sink -2.300587 -Inf Inf +## sigma 1.000000 0 Inf ## ## Fixed parameter values: ## value type @@ -479,33 +482,40 @@ print(FOCUS_2006_D) ## ## Optimised, transformed parameters with symmetric confidence intervals: ## Estimate Std. Error Lower Upper -## parent_0 99.600 1.61400 96.330 102.900 -## log_k_parent_sink -3.038 0.07826 -3.197 -2.879 -## log_k_parent_m1 -2.980 0.04124 -3.064 -2.897 -## log_k_m1_sink -5.248 0.13610 -5.523 -4.972 +## parent_0 99.600 1.53000 96.490 102.700 +## log_k_parent_sink -3.038 0.07433 -3.189 -2.887 +## log_k_parent_m1 -2.980 0.03931 -3.060 -2.901 +## log_k_m1_sink -5.248 0.12980 -5.511 -4.984 +## sigma 3.046 0.34060 2.355 3.738 ## ## Parameter correlation: -## parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink -## parent_0 1.00000 0.6075 -0.06625 -0.1701 -## log_k_parent_sink 0.60752 1.0000 -0.08740 -0.6253 -## log_k_parent_m1 -0.06625 -0.0874 1.00000 0.4716 -## log_k_m1_sink -0.17006 -0.6253 0.47164 1.0000 -## -## Residual standard error: 3.211 on 36 degrees of freedom +## parent_0 log_k_parent_sink log_k_parent_m1 +## parent_0 1.000e+00 6.067e-01 -6.372e-02 +## log_k_parent_sink 6.067e-01 1.000e+00 -8.550e-02 +## log_k_parent_m1 -6.372e-02 -8.550e-02 1.000e+00 +## log_k_m1_sink -1.688e-01 -6.252e-01 4.731e-01 +## sigma -1.333e-06 -2.592e-08 -1.153e-06 +## log_k_m1_sink sigma +## parent_0 -1.688e-01 -1.333e-06 +## log_k_parent_sink -6.252e-01 -2.592e-08 +## log_k_parent_m1 4.731e-01 -1.153e-06 +## log_k_m1_sink 1.000e+00 -5.292e-07 +## sigma -5.292e-07 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 99.600000 61.720 2.024e-38 96.330000 1.029e+02 -## k_parent_sink 0.047920 12.780 3.050e-15 0.040890 5.616e-02 -## k_parent_m1 0.050780 24.250 3.407e-24 0.046700 5.521e-02 -## k_m1_sink 0.005261 7.349 5.758e-09 0.003992 6.933e-03 +## parent_0 99.600000 65.080 2.070e-38 96.490000 1.027e+02 +## k_parent_sink 0.047920 13.450 1.071e-15 0.041210 5.573e-02 +## k_parent_m1 0.050780 25.440 1.834e-24 0.046880 5.500e-02 +## k_m1_sink 0.005261 7.705 2.408e-09 0.004042 6.846e-03 +## sigma 3.046000 8.944 7.220e-11 2.355000 3.738e+00 ## ## Chi2 error levels in percent: ## err.min n.optim df -## All data 6.398 4 15 +## All data 6.572 5 14 ## parent 6.827 3 6 ## m1 4.490 1 9 ## @@ -522,16 +532,16 @@ print(FOCUS_2006_D) ## ## Data: ## time variable observed predicted residual -## 0 parent 99.46 99.59848 -1.385e-01 -## 0 parent 102.04 99.59848 2.442e+00 -## 1 parent 93.50 90.23787 3.262e+00 -## 1 parent 92.50 90.23787 2.262e+00 -## 3 parent 63.23 74.07320 -1.084e+01 -## 3 parent 68.99 74.07320 -5.083e+00 +## 0 parent 99.46 99.59847 -1.385e-01 +## 0 parent 102.04 99.59847 2.442e+00 +## 1 parent 93.50 90.23786 3.262e+00 +## 1 parent 92.50 90.23786 2.262e+00 +## 3 parent 63.23 74.07319 -1.084e+01 +## 3 parent 68.99 74.07319 -5.083e+00 ## 7 parent 52.32 49.91207 2.408e+00 ## 7 parent 55.13 49.91207 5.218e+00 -## 14 parent 27.27 25.01257 2.257e+00 -## 14 parent 26.64 25.01257 1.627e+00 +## 14 parent 27.27 25.01258 2.257e+00 +## 14 parent 26.64 25.01258 1.627e+00 ## 21 parent 11.50 12.53462 -1.035e+00 ## 21 parent 11.64 12.53462 -8.946e-01 ## 35 parent 2.85 3.14787 -2.979e-01 @@ -544,22 +554,22 @@ print(FOCUS_2006_D) ## 0 m1 0.00 0.00000 0.000e+00 ## 1 m1 4.84 4.80296 3.704e-02 ## 1 m1 5.64 4.80296 8.370e-01 -## 3 m1 12.91 13.02400 -1.140e-01 -## 3 m1 12.96 13.02400 -6.400e-02 -## 7 m1 22.97 25.04476 -2.075e+00 -## 7 m1 24.47 25.04476 -5.748e-01 -## 14 m1 41.69 36.69002 5.000e+00 -## 14 m1 33.21 36.69002 -3.480e+00 -## 21 m1 44.37 41.65310 2.717e+00 -## 21 m1 46.44 41.65310 4.787e+00 +## 3 m1 12.91 13.02399 -1.140e-01 +## 3 m1 12.96 13.02399 -6.399e-02 +## 7 m1 22.97 25.04475 -2.075e+00 +## 7 m1 24.47 25.04475 -5.748e-01 +## 14 m1 41.69 36.69001 5.000e+00 +## 14 m1 33.21 36.69001 -3.480e+00 +## 21 m1 44.37 41.65309 2.717e+00 +## 21 m1 46.44 41.65309 4.787e+00 ## 35 m1 41.22 43.31312 -2.093e+00 ## 35 m1 37.95 43.31312 -5.363e+00 ## 50 m1 41.19 41.21831 -2.831e-02 ## 50 m1 40.01 41.21831 -1.208e+00 -## 75 m1 40.09 36.44704 3.643e+00 -## 75 m1 33.85 36.44704 -2.597e+00 -## 100 m1 31.04 31.98163 -9.416e-01 -## 100 m1 33.13 31.98163 1.148e+00 +## 75 m1 40.09 36.44703 3.643e+00 +## 75 m1 33.85 36.44703 -2.597e+00 +## 100 m1 31.04 31.98162 -9.416e-01 +## 100 m1 33.13 31.98162 1.148e+00 ## 120 m1 25.15 28.78984 -3.640e+00 ## 120 m1 33.31 28.78984 4.520e+00 -- cgit v1.2.1