From 9ac853c7ceece333099021974025d07e75be2b33 Mon Sep 17 00:00:00 2001
From: Johannes Ranke
A named vector of initial values for the parameters,
- including parameters to be optimised and potentially also fixed parameters
- as indicated by fixed_parms
. If set to "auto", initial values for
- rate constants are set to default values. Using parameter names that are
- not in the model gives an error.
fixed_parms
. If set to "auto", initial values for
+rate constants are set to default values. Using parameter names that are
+not in the model gives an error.
It is possible to only specify a subset of the parameters that the model - needs. You can use the parameter lists "bparms.ode" from a previously - fitted model, which contains the differential equation parameters from - this model. This works nicely if the models are nested. An example is - given below.
lsoda
.
If the error model is "const", a constant standard - deviation is assumed.
+deviation is assumed.If the error model is "obs", each observed variable is assumed to have its - own variance.
+own variance.If the error model is "tc" (two-component error model), a two component - error model similar to the one described by Rocke and Lorenzato (1995) is - used for setting up the likelihood function. Note that this model - deviates from the model by Rocke and Lorenzato, as their model implies - that the errors follow a lognormal distribution for large values, not a - normal distribution as assumed by this method.
If "auto", the selected algorithm depends on - the error model. If the error model is "const", unweighted nonlinear - least squares fitting ("OLS") is selected. If the error model is "obs", or - "tc", the "d_3" algorithm is selected.
-The algorithm "d_3" will directly minimize the negative log-likelihood and - - independently - also use the three step algorithm described below. The - fit with the higher likelihood is returned.
+the error model. If the error model is "const", unweighted nonlinear +least squares fitting ("OLS") is selected. If the error model is "obs", or +"tc", the "d_3" algorithm is selected. +The algorithm "d_3" will directly minimize the negative log-likelihood and
independently - also use the three step algorithm described below. The +fit with the higher likelihood is returned.
The algorithm "direct" will directly minimize the negative log-likelihood.
The algorithm "twostep" will minimize the negative log-likelihood after an - initial unweighted least squares optimisation step.
+initial unweighted least squares optimisation step.The algorithm "threestep" starts with unweighted least squares, then - optimizes only the error model using the degradation model parameters - found, and then minimizes the negative log-likelihood with free - degradation and error model parameters.
+optimizes only the error model using the degradation model parameters +found, and then minimizes the negative log-likelihood with free +degradation and error model parameters.The algorithm "fourstep" starts with unweighted least squares, then - optimizes only the error model using the degradation model parameters - found, then optimizes the degradation model again with fixed error model - parameters, and finally minimizes the negative log-likelihood with free - degradation and error model parameters.
+optimizes only the error model using the degradation model parameters +found, then optimizes the degradation model again with fixed error model +parameters, and finally minimizes the negative log-likelihood with free +degradation and error model parameters.The algorithm "IRLS" (Iteratively Reweighted Least Squares) starts with - unweighted least squares, and then iterates optimization of the error - model parameters and subsequent optimization of the degradation model - using those error model parameters, until the error model parameters - converge.
Rocke, David M. und Lorenzato, Stefan (1995) A two-component model - for measurement error in analytical chemistry. Technometrics 37(2), 176-184.
A list with "mkinfit" in the class attribute. A summary can be
- obtained by summary.mkinfit
.
summary.mkinfit
.
Per default, parameters in the kinetic models are internally transformed in @@ -399,33 +397,40 @@ estimators.
When using the "IORE" submodel for metabolites, fitting with - "transform_rates = TRUE" (the default) often leads to failures of the - numerical ODE solver. In this situation it may help to switch off the - internal rate transformation.
+"transform_rates = TRUE" (the default) often leads to failures of the +numerical ODE solver. In this situation it may help to switch off the +internal rate transformation. +Rocke DM and Lorenzato S (1995) A two-component model +for 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.
Plotting methods plot.mkinfit
and
- mkinparplot
.
mkinparplot
.
Comparisons of models fitted to the same data can be made using
- AIC
by virtue of the method logLik.mkinfit
.
AIC
by virtue of the method logLik.mkinfit
.
Fitting of several models to several datasets in a single call to
- mmkin
.
mmkin
.
# Use shorthand notation for parent only degradation fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) -summary(fit)#> mkin version used for fitting: 0.9.50 +summary(fit)#> mkin version used for fitting: 0.9.50.1 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 11 05:14:26 2020 -#> Date of summary: Mon May 11 05:14:26 2020 +#> Date of fit: Tue May 12 08:36:07 2020 +#> Date of summary: Tue May 12 08:36:07 2020 #> #> 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.043 s +#> Fitted using 222 model solutions performed in 0.047 s #> #> Error model: Constant variance #> @@ -502,7 +507,7 @@ estimators. m1 = mkinsub("SFO"))#># Fit the model to the FOCUS example dataset D using defaults print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE)))#> Warning: Observations with value of zero were removed from the data#> User System verstrichen -#> 0.407 0.002 0.409parms(fit)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 0.408 0.008 0.416parms(fit)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma #> 99.598483222 0.098697734 0.005260651 0.514475962 3.125503875endpoints(fit)#> $ff #> parent_m1 parent_sink #> 0.514476 0.485524 @@ -592,7 +597,7 @@ estimators. #> Sum of squared residuals at call 166: 371.2134 #> Sum of squared residuals at call 168: 371.2134 #> Negative log-likelihood at call 178: 97.22429#>#> User System verstrichen -#> 0.349 0.000 0.350parms(fit.deSolve)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 0.350 0.001 0.351parms(fit.deSolve)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma #> 99.598480759 0.098697739 0.005260651 0.514475958 3.125503874endpoints(fit.deSolve)#> $ff #> parent_m1 parent_sink #> 0.514476 0.485524 @@ -622,12 +627,12 @@ estimators. fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)#> Warning: Observations with value of zero were removed from the data#> Warning: Initial parameter(s) k_parent_free_sink not used in the model# } # \dontrun{ -# Weighted fits, including IRLS +# Weighted fits, including IRLS (error_model = "obs") SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO"), use_of_ff = "max")#>f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.noweight)#>f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.noweight)#> mkin version used for fitting: 0.9.50.1 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 11 05:14:31 2020 -#> Date of summary: Mon May 11 05:14:31 2020 +#> Date of fit: Tue May 12 08:36:12 2020 +#> Date of summary: Tue May 12 08:36:12 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -635,7 +640,7 @@ estimators. #> #> Model predictions using solution type analytical #> -#> Fitted using 421 model solutions performed in 0.124 s +#> Fitted using 421 model solutions performed in 0.146 s #> #> Error model: Constant variance #> @@ -746,10 +751,10 @@ estimators. #> 100 m1 31.04 31.98163 -9.416e-01 #> 100 m1 33.13 31.98163 1.148e+00 #> 120 m1 25.15 28.78984 -3.640e+00 -#> 120 m1 33.31 28.78984 4.520e+00f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.obs)#> mkin version used for fitting: 0.9.50 +#> 120 m1 33.31 28.78984 4.520e+00f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.obs)#> mkin version used for fitting: 0.9.50.1 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 11 05:14:32 2020 -#> Date of summary: Mon May 11 05:14:32 2020 +#> Date of fit: Tue May 12 08:36:13 2020 +#> Date of summary: Tue May 12 08:36:13 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -757,7 +762,7 @@ estimators. #> #> Model predictions using solution type analytical #> -#> Fitted using 978 model solutions performed in 0.336 s +#> Fitted using 978 model solutions performed in 0.337 s #> #> Error model: Variance unique to each observed variable #> @@ -883,10 +888,10 @@ estimators. #> 100 m1 31.04 31.98773 -9.477e-01 #> 100 m1 33.13 31.98773 1.142e+00 #> 120 m1 25.15 28.80429 -3.654e+00 -#> 120 m1 33.31 28.80429 4.506e+00f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.tc)#> mkin version used for fitting: 0.9.50 +#> 120 m1 33.31 28.80429 4.506e+00f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)#> Warning: Observations with value of zero were removed from the datasummary(f.tc)#> mkin version used for fitting: 0.9.50.1 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 11 05:14:32 2020 -#> Date of summary: Mon May 11 05:14:32 2020 +#> Date of fit: Tue May 12 08:36:14 2020 +#> Date of summary: Tue May 12 08:36:14 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -894,7 +899,7 @@ estimators. #> #> Model predictions using solution type analytical #> -#> Fitted using 1875 model solutions performed in 0.642 s +#> Fitted using 1875 model solutions performed in 0.647 s #> #> Error model: Two-component variance function #> -- cgit v1.2.1