From b5ee48a86e4b1d4c05aaadb80b44954e2e994ebc Mon Sep 17 00:00:00 2001
From: Johannes Ranke
The number of cores to be used for multicore processing. On Windows machines, cores > 1 is currently not supported.
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?
Helper functions to create nlme models from mmkin row objects
Create saemix models from mmkin row objects
This function maximises the likelihood of the observed data using the Port
-algorithm stats::nlminb()
, and the specified initial or fixed
+algorithm nlminb
, and the specified initial or fixed
parameters and starting values. In each step of the optimisation, the
-kinetic model is solved using the function mkinpredict()
, except
-if an analytical solution is implemented, in which case the model is solved
-using the degradation function in the mkinmod object. The
+kinetic model is solved using the function mkinpredict
. The
parameters of the selected error model are fitted simultaneously with the
degradation model parameters, as both of them are arguments of the
likelihood function.
A list of class mkinmod, containing the kinetic +
A list of class mkinmod
, containing the kinetic
model to be fitted to the data, or one of the shorthand names ("SFO",
"FOMC", "DFOP", "HS", "SFORB", "IORE"). If a shorthand name is given, a
parent only degradation model is generated for the variable with the
@@ -231,7 +224,7 @@ given below.
A named vector of initial values for the state variables of
the model. In case the observed variables are represented by more than one
model variable, the names will differ from the names of the observed
-variables (see map
component of mkinmod). The default
+variables (see map
component of mkinmod
). The default
is to set the initial value of the first model variable to the mean of the
time zero values for the variable with the maximum observed value, and all
others to 0. If this variable has no time zero observations, its initial
@@ -270,28 +263,30 @@ observed mean value is the new time zero.
If set to "eigen", the solution of the system of differential equations is based on the spectral decomposition of the coefficient matrix in cases that this is possible. If set to "deSolve", a -numerical ode solver from package deSolve is used. If -set to "analytical", an analytical solution of the model is used. This is -only implemented for relatively simple degradation models. The default is -"auto", which uses "analytical" if possible, otherwise "deSolve" if a -compiler is present, and "eigen" if no compiler is present and the model -can be expressed using eigenvalues and eigenvectors.
deSolve
is used. If set to
+"analytical", an analytical solution of the model is used. This is only
+implemented for simple degradation experiments with only one state
+variable, i.e. with no metabolites. The default is "auto", which uses
+"analytical" if possible, otherwise "deSolve" if a compiler is present,
+and "eigen" if no compiler is present and the model can be expressed using
+eigenvalues and eigenvectors. This argument is passed on to the helper
+function mkinpredict
.
The solution method passed via mkinpredict()
-to deSolve::ode()
in case the solution type is "deSolve". The default
+
The solution method passed via mkinpredict
+to ode
in case the solution type is "deSolve". The default
"lsoda" is performant, but sometimes fails to converge.
If set to FALSE
, no compiled version of the
-mkinmod model is used in the calls to mkinpredict()
even if a compiled
-version is present.
mkinmod
model is used in the calls to
+mkinpredict
even if a compiled version is present.
A list of control arguments passed to stats::nlminb()
.
A list of control arguments passed to nlminb
.
ilr()
transformation.
+transformations is the ilr
transformation.
Absolute error tolerance, passed to deSolve::ode()
. Default
-is 1e-8, which is lower than the default in the deSolve::lsoda()
-function which is used per default.
Absolute error tolerance, passed to ode
. Default
+is 1e-8, lower than in lsoda
.
Absolute error tolerance, passed to deSolve::ode()
. Default
-is 1e-10, much lower than in deSolve::lsoda()
.
Absolute error tolerance, passed to ode
. Default
+is 1e-10, much lower than in lsoda
.
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 "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.
@@ -385,13 +381,14 @@ the error model parameters in IRLS fits.Further arguments that will be passed on to
-deSolve::ode()
.
deSolve
.
A list with "mkinfit" in the class attribute.
+A list with "mkinfit" in the class attribute. A summary can be
+obtained by summary.mkinfit
.
Per default, parameters in the kinetic models are internally transformed in @@ -412,7 +409,8 @@ Degradation Data. Environments 6(12) 124 doi:10.3390/environments6120124.
summary.mkinfit, plot.mkinfit, parms and lrtest.
+Plotting methods plot.mkinfit
and
+mkinparplot
.
Comparisons of models fitted to the same data can be made using
AIC
by virtue of the method logLik.mkinfit
.
Fitting of several models to several datasets in a single call to @@ -422,17 +420,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: 0.9.50.3 +summary(fit)#> mkin version used for fitting: 0.9.50.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 25 12:29:22 2020 -#> Date of summary: Mon May 25 12:29:22 2020 +#> Date of fit: Wed May 27 07:03:45 2020 +#> Date of summary: Wed May 27 07:03:45 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.048 s +#> Fitted using 222 model solutions performed in 0.043 s #> #> Error model: Constant variance #> @@ -467,10 +465,10 @@ Degradation Data. Environments 6(12) 124 #> #> Parameter correlation: #> parent_0 log_alpha log_beta sigma -#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.758e-08 -#> log_alpha -1.565e-01 1.000e+00 9.564e-01 1.007e-07 -#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.568e-08 -#> sigma 4.758e-08 1.007e-07 8.568e-08 1.000e+00 +#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.770e-08 +#> log_alpha -1.565e-01 1.000e+00 9.564e-01 9.974e-08 +#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.468e-08 +#> sigma 4.770e-08 9.974e-08 8.468e-08 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. @@ -509,15 +507,15 @@ Degradation Data. Environments 6(12) 124 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 elapsed -#> 0.407 0.013 0.423parms(fit)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma -#> 99.598483222 0.098697734 0.005260651 0.514475962 3.125503875endpoints(fit)#> $ff +#> 0.400 0.004 0.404parms(fit)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598481046 0.098697740 0.005260651 0.514475962 3.125503875endpoints(fit)#> $ff #> parent_m1 parent_sink #> 0.514476 0.485524 #> #> $distimes #> DT50 DT90 -#> parent 7.022929 23.32967 -#> m1 131.760715 437.69962 +#> parent 7.022929 23.32966 +#> m1 131.760724 437.69965 #># \dontrun{ # deSolve is slower when no C compiler (gcc) was available during model generation print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, @@ -534,19 +532,19 @@ Degradation Data. Environments 6(12) 124 #> Sum of squared residuals at call 29: 1017.417 #> Sum of squared residuals at call 31: 1017.417 #> Sum of squared residuals at call 33: 1017.416 -#> Sum of squared residuals at call 34: 644.0471 -#> Sum of squared residuals at call 36: 644.0469 -#> Sum of squared residuals at call 38: 644.0469 +#> Sum of squared residuals at call 34: 644.0472 +#> Sum of squared residuals at call 36: 644.047 +#> Sum of squared residuals at call 38: 644.047 #> Sum of squared residuals at call 39: 590.5025 #> Sum of squared residuals at call 41: 590.5022 #> Sum of squared residuals at call 43: 590.5016 -#> Sum of squared residuals at call 44: 543.219 -#> Sum of squared residuals at call 45: 543.2187 -#> Sum of squared residuals at call 46: 543.2186 +#> Sum of squared residuals at call 44: 543.2196 +#> Sum of squared residuals at call 45: 543.2193 +#> Sum of squared residuals at call 46: 543.2192 #> Sum of squared residuals at call 50: 391.348 #> Sum of squared residuals at call 51: 391.3479 -#> Sum of squared residuals at call 56: 386.4789 -#> Sum of squared residuals at call 58: 386.4789 +#> Sum of squared residuals at call 56: 386.479 +#> Sum of squared residuals at call 58: 386.479 #> Sum of squared residuals at call 60: 386.4779 #> Sum of squared residuals at call 61: 384.0686 #> Sum of squared residuals at call 63: 384.0686 @@ -565,49 +563,49 @@ Degradation Data. Environments 6(12) 124 #> Sum of squared residuals at call 91: 374.5774 #> Sum of squared residuals at call 93: 374.5774 #> Sum of squared residuals at call 95: 374.5774 -#> Sum of squared residuals at call 96: 373.5433 -#> Sum of squared residuals at call 100: 373.5433 -#> Sum of squared residuals at call 102: 373.2654 -#> Sum of squared residuals at call 104: 373.2654 -#> Sum of squared residuals at call 107: 372.6841 -#> Sum of squared residuals at call 111: 372.684 -#> Sum of squared residuals at call 114: 372.6374 -#> Sum of squared residuals at call 116: 372.6374 -#> Sum of squared residuals at call 119: 372.6223 -#> Sum of squared residuals at call 121: 372.6223 -#> Sum of squared residuals at call 123: 372.6223 -#> Sum of squared residuals at call 124: 372.5903 -#> Sum of squared residuals at call 126: 372.5903 -#> Sum of squared residuals at call 129: 372.5445 -#> Sum of squared residuals at call 130: 372.4921 -#> Sum of squared residuals at call 131: 372.2377 -#> Sum of squared residuals at call 132: 371.5434 -#> Sum of squared residuals at call 134: 371.5434 -#> Sum of squared residuals at call 137: 371.2857 -#> Sum of squared residuals at call 139: 371.2857 -#> Sum of squared residuals at call 143: 371.2247 -#> Sum of squared residuals at call 144: 371.2247 -#> Sum of squared residuals at call 149: 371.2189 -#> Sum of squared residuals at call 150: 371.2145 -#> Sum of squared residuals at call 153: 371.2145 -#> Sum of squared residuals at call 155: 371.2138 -#> Sum of squared residuals at call 156: 371.2138 -#> Sum of squared residuals at call 157: 371.2138 -#> Sum of squared residuals at call 161: 371.2134 -#> Sum of squared residuals at call 162: 371.2134 +#> Sum of squared residuals at call 96: 373.5438 +#> Sum of squared residuals at call 100: 373.5438 +#> Sum of squared residuals at call 102: 373.265 +#> Sum of squared residuals at call 104: 373.265 +#> Sum of squared residuals at call 107: 372.6825 +#> Sum of squared residuals at call 111: 372.6825 +#> Sum of squared residuals at call 114: 372.6356 +#> Sum of squared residuals at call 116: 372.6356 +#> Sum of squared residuals at call 119: 372.6199 +#> Sum of squared residuals at call 121: 372.6199 +#> Sum of squared residuals at call 123: 372.6199 +#> Sum of squared residuals at call 124: 372.5881 +#> Sum of squared residuals at call 126: 372.5881 +#> Sum of squared residuals at call 129: 372.5418 +#> Sum of squared residuals at call 130: 372.4866 +#> Sum of squared residuals at call 131: 372.2242 +#> Sum of squared residuals at call 132: 371.5237 +#> Sum of squared residuals at call 134: 371.5237 +#> Sum of squared residuals at call 137: 371.292 +#> Sum of squared residuals at call 139: 371.292 +#> Sum of squared residuals at call 143: 371.2256 +#> Sum of squared residuals at call 144: 371.2256 +#> Sum of squared residuals at call 146: 371.2256 +#> Sum of squared residuals at call 149: 371.2194 +#> Sum of squared residuals at call 150: 371.2147 +#> Sum of squared residuals at call 153: 371.2147 +#> Sum of squared residuals at call 155: 371.2137 +#> Sum of squared residuals at call 156: 371.2137 +#> Sum of squared residuals at call 157: 371.2137 +#> Sum of squared residuals at call 160: 371.2134 +#> Sum of squared residuals at call 164: 371.2134 #> Sum of squared residuals at call 165: 371.2134 -#> 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 elapsed -#> 0.351 0.000 0.352parms(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 +#> Sum of squared residuals at call 167: 371.2134 +#> Negative log-likelihood at call 177: 97.22429#>#> user system elapsed +#> 0.360 0.000 0.361parms(fit.deSolve)#> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598480300 0.098697739 0.005260651 0.514475968 3.125503874endpoints(fit.deSolve)#> $ff #> parent_m1 parent_sink #> 0.514476 0.485524 #> #> $distimes #> DT50 DT90 #> parent 7.022929 23.32966 -#> m1 131.760731 437.69967 +#> m1 131.760721 437.69964 #># } # Use stepwise fitting, using optimised parameters from parent only fit, FOMC @@ -631,10 +629,10 @@ Degradation Data. Environments 6(12) 124 # \dontrun{ # 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.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 25 12:29:28 2020 -#> Date of summary: Mon May 25 12:29:28 2020 +#> Date of fit: Wed May 27 07:03:50 2020 +#> Date of summary: Wed May 27 07:03:50 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -642,7 +640,7 @@ Degradation Data. Environments 6(12) 124 #> #> Model predictions using solution type analytical #> -#> Fitted using 421 model solutions performed in 0.147 s +#> Fitted using 421 model solutions performed in 0.129 s #> #> Error model: Constant variance #> @@ -681,11 +679,11 @@ Degradation Data. Environments 6(12) 124 #> #> Parameter correlation: #> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma -#> parent_0 1.000e+00 5.174e-01 -1.688e-01 -5.471e-01 -3.214e-07 +#> parent_0 1.000e+00 5.174e-01 -1.688e-01 -5.471e-01 -3.190e-07 #> log_k_parent 5.174e-01 1.000e+00 -3.263e-01 -5.426e-01 3.168e-07 -#> log_k_m1 -1.688e-01 -3.263e-01 1.000e+00 7.478e-01 -1.410e-07 -#> f_parent_ilr_1 -5.471e-01 -5.426e-01 7.478e-01 1.000e+00 5.093e-10 -#> sigma -3.214e-07 3.168e-07 -1.410e-07 5.093e-10 1.000e+00 +#> log_k_m1 -1.688e-01 -3.263e-01 1.000e+00 7.478e-01 -1.406e-07 +#> f_parent_ilr_1 -5.471e-01 -5.426e-01 7.478e-01 1.000e+00 -1.587e-10 +#> sigma -3.190e-07 3.168e-07 -1.406e-07 -1.587e-10 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. @@ -753,10 +751,10 @@ Degradation Data. Environments 6(12) 124 #> 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.3 +#> 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.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 25 12:29:28 2020 -#> Date of summary: Mon May 25 12:29:28 2020 +#> Date of fit: Wed May 27 07:03:50 2020 +#> Date of summary: Wed May 27 07:03:50 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -764,7 +762,7 @@ Degradation Data. Environments 6(12) 124 #> #> Model predictions using solution type analytical #> -#> Fitted using 978 model solutions performed in 0.337 s +#> Fitted using 978 model solutions performed in 0.407 s #> #> Error model: Variance unique to each observed variable #> @@ -890,10 +888,10 @@ Degradation Data. Environments 6(12) 124 #> 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.3 +#> 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.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Mon May 25 12:29:29 2020 -#> Date of summary: Mon May 25 12:29:29 2020 +#> Date of fit: Wed May 27 07:03:51 2020 +#> Date of summary: Wed May 27 07:03:51 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -901,7 +899,7 @@ Degradation Data. Environments 6(12) 124 #> #> Model predictions using solution type analytical #> -#> Fitted using 1875 model solutions performed in 0.644 s +#> Fitted using 2088 model solutions performed in 0.722 s #> #> Error model: Two-component variance function #> diff --git a/docs/reference/mkinmod.html b/docs/reference/mkinmod.html index 79b21d33..40cc2ef4 100644 --- a/docs/reference/mkinmod.html +++ b/docs/reference/mkinmod.html @@ -255,7 +255,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), verbose = TRUE)#> Compilation argument: -#> /usr/lib/R/bin/R CMD SHLIB file61b4ce789c7.c 2> file61b4ce789c7.c.err.txt +#> /usr/lib/R/bin/R CMD SHLIB file5d7f45129ff2.c 2> file5d7f45129ff2.c.err.txt #> Program source: #> 1: #include <R.h> #> 2: diff --git a/docs/reference/mkinparplot-1.png b/docs/reference/mkinparplot-1.png index 6853a4ba..31800c09 100644 Binary files a/docs/reference/mkinparplot-1.png and b/docs/reference/mkinparplot-1.png differ diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html index 89f48a09..e16de283 100644 --- a/docs/reference/mkinpredict.html +++ b/docs/reference/mkinpredict.html @@ -397,10 +397,10 @@ solver is used. c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "analytical", use_compiled = FALSE)[201,]) }#> test relative elapsed -#> 2 deSolve_compiled 1.0 0.005 -#> 4 analytical 1.0 0.005 -#> 1 eigen 4.0 0.020 -#> 3 deSolve 43.6 0.218+#> 2 deSolve_compiled 1.00 0.004 +#> 4 analytical 1.00 0.004 +#> 1 eigen 4.75 0.019 +#> 3 deSolve 54.75 0.219# \dontrun{ # Predict from a fitted model f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) diff --git a/docs/reference/mmkin-3.png b/docs/reference/mmkin-3.png index bce34531..e80448ab 100644 Binary files a/docs/reference/mmkin-3.png and b/docs/reference/mmkin-3.png differ diff --git a/docs/reference/mmkin-5.png b/docs/reference/mmkin-5.png index 56750342..4c771bc9 100644 Binary files a/docs/reference/mmkin-5.png and b/docs/reference/mmkin-5.png differ diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html index 9628c017..67837ea3 100644 --- a/docs/reference/mmkin.html +++ b/docs/reference/mmkin.html @@ -75,7 +75,7 @@ datasets specified in its first two arguments." />@@ -112,9 +112,6 @@ datasets specified in its first two arguments." />
mmkin( models = c("SFO", "FOMC", "DFOP"), datasets, - cores = detectCores(), + cores = round(detectCores()/2), cluster = NULL, ... )@@ -179,8 +176,7 @@ data for
mkinfit
.
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.
These functions facilitate setting up a nonlinear mixed effects model for
an mmkin row object. An mmkin row object is essentially a list of mkinfit
objects that have been obtained by fitting the same model to a list of
-datasets. They are used internally by the nlme.mmkin()
method.
nlme_function(object)
@@ -178,7 +175,7 @@ datasets. They are used internally by the nlme.m
If random is FALSE (default), a named vector containing mean values
of the fitted degradation model parameters. If random is TRUE, a list with
fixed and random effects, in the format required by the start argument of
-nlme for the case of a single grouping variable ds.
+nlme for the case of a single grouping variable ds?
A groupedData
object
See also
@@ -225,28 +222,28 @@ nlme for the case of a single grouping variable ds.
#> Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink)
#> Data: grouped_data
#> AIC BIC logLik
-#> 298.2781 307.7372 -144.1391
+#> 252.7798 262.1358 -121.3899
#>
#> Random effects:
#> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1)
#> Level: ds
#> Structure: Diagonal
-#> parent_0 log_k_parent_sink Residual
-#> StdDev: 0.9374733 0.7098105 3.83543
+#> parent_0 log_k_parent_sink Residual
+#> StdDev: 0.004139378 0.6800778 2.489396
#>
#> Fixed effects: parent_0 + log_k_parent_sink ~ 1
-#> Value Std.Error DF t-value p-value
-#> parent_0 101.76838 1.1445444 45 88.91606 0
-#> log_k_parent_sink -3.05444 0.4195622 45 -7.28008 0
+#> Value Std.Error DF t-value p-value
+#> parent_0 101.74884 0.6456057 44 157.60213 0
+#> log_k_parent_sink -3.05575 0.4015812 44 -7.60929 0
#> Correlation:
#> prnt_0
-#> log_k_parent_sink 0.034
+#> log_k_parent_sink 0.026
#>
#> Standardized Within-Group Residuals:
-#> Min Q1 Med Q3 Max
-#> -2.6169360 -0.2185329 0.0574070 0.5720937 3.0459868
+#> Min Q1 Med Q3 Max
+#> -2.13168782 -0.68780415 0.08282907 0.85913228 2.95298904
#>
-#> Number of Observations: 49
+#> Number of Observations: 48
#> Number of Groups: 3
# augPred does not seem to work on fits with more than one state
# variable
diff --git a/docs/reference/nlme.mmkin.html b/docs/reference/nlme.mmkin.html
index 2ada9501..c0fb499d 100644
--- a/docs/reference/nlme.mmkin.html
+++ b/docs/reference/nlme.mmkin.html
@@ -74,7 +74,7 @@ have been obtained by fitting the same model to a list of datasets." />
@@ -111,9 +111,6 @@ have been obtained by fitting the same model to a list of datasets." />
Example evaluation of NAFTA SOP Attachment examples
-
- Some benchmark timings
-
Ignored, data are taken from the mmkin model
Should the data be printed?
parms(object, ...) # S3 method for mkinfit -parms(object, transformed = FALSE, ...) - -# S3 method for mmkin parms(object, transformed = FALSE, ...)
A fitted model object. Methods are implemented for
-mkinfit()
objects and for mmkin()
objects.
A fitted model object
For mkinfit objects, a numeric vector of fitted model parameters. -For mmkin row objects, a matrix with the parameters with a -row for each dataset. If the mmkin object has more than one row, a list of -such matrices is returned.
+A numeric vector of fitted model parameters
#> parent_0 k_parent_sink sigma ++#> 82.492160 -1.183963 4.673012#>#> Sum of squared residuals at call 1: 2388.077 +#> Sum of squared residuals at call 3: 2388.077 +#> Sum of squared residuals at call 4: 247.1962 +#> Sum of squared residuals at call 7: 200.6791 +#> Sum of squared residuals at call 10: 197.7231 +#> Sum of squared residuals at call 11: 197.0872 +#> Sum of squared residuals at call 14: 196.535 +#> Sum of squared residuals at call 15: 196.535 +#> Sum of squared residuals at call 16: 196.535 +#> Sum of squared residuals at call 17: 196.5334 +#> Sum of squared residuals at call 20: 196.5334 +#> Sum of squared residuals at call 25: 196.5334 +#> Negative log-likelihood at call 31: 26.64668#>parms(fit)#> parent_0 k_parent_sink sigma #> 82.4921598 0.3060633 4.6730124parms(fit, transformed = TRUE)#> parent_0 log_k_parent_sink sigma -#> 82.492160 -1.183963 4.673012-# mmkin objects -ds <- lapply(experimental_data_for_UBA_2019[6:10], - function(x) subset(x$data[c("name", "time", "value")])) -names(ds) <- paste("Dataset", 6:10) -# \dontrun{ -fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE, cores = 1) -parms(fits["SFO", ])#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 -#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 -#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673parms(fits[, 2])#> $SFO -#> Dataset 7 -#> parent_0 82.666781678 -#> k_parent_sink 0.009647805 -#> sigma 7.040168584 -#> -#> $FOMC -#> Dataset 7 -#> parent_0 92.6837649 -#> alpha 0.4967832 -#> beta 14.1451255 -#> sigma 1.9167519 -#> -#> $DFOP -#> Dataset 7 -#> parent_0 91.058971503 -#> k1 0.044946770 -#> k2 0.002868336 -#> g 0.526942415 -#> sigma 2.221302196 -#>parms(fits)#> $SFO -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 -#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 -#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673 -#> -#> $FOMC -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 95.558575 92.6837649 90.719787 98.383939 94.8481458 -#> alpha 1.338667 0.4967832 1.639099 1.074460 0.2805272 -#> beta 13.033315 14.1451255 5.007077 4.397126 6.9052224 -#> sigma 1.847671 1.9167519 1.066063 3.146056 1.6222778 -#> -#> $DFOP -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 96.55213663 91.058971503 90.34509469 98.14858850 94.311323409 -#> k1 0.21954589 0.044946770 0.41232289 0.31697588 0.080663853 -#> k2 0.02957934 0.002868336 0.07581767 0.03260384 0.003425417 -#> g 0.44845068 0.526942415 0.66091965 0.65322767 0.342652880 -#> sigma 1.35690468 2.221302196 1.34169076 2.87159846 1.942067831 -#>parms(fits, transformed = TRUE)#> $SFO -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.522754 82.666782 86.854731 91.777931 82.148094 -#> log_k_parent_sink -2.848234 -4.641025 -1.559232 -2.093737 -4.933090 -#> sigma 5.152745 7.040169 3.676964 6.466923 6.504577 -#> -#> $FOMC -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 95.5585751 92.6837649 90.7197870 98.38393897 94.848146 -#> log_alpha 0.2916741 -0.6996015 0.4941466 0.07181816 -1.271085 -#> log_beta 2.5675088 2.6493701 1.6108523 1.48095106 1.932278 -#> sigma 1.8476712 1.9167519 1.0660627 3.14605557 1.622278 -#> -#> $DFOP -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 96.5521366 91.05897150 90.3450947 98.1485885 94.311323 -#> log_k1 -1.5161940 -3.10227638 -0.8859485 -1.1489296 -2.517465 -#> log_k2 -3.5206791 -5.85402317 -2.5794240 -3.4233253 -5.676532 -#> g_ilr -0.1463234 0.07627854 0.4719196 0.4477805 -0.460676 -#> sigma 1.3569047 2.22130220 1.3416908 2.8715985 1.942068 -#># } -
#> mkin version used for fitting: 0.9.50.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Tue May 12 15:31:20 2020 -#> Date of summary: Tue May 12 15:31:20 2020 +#> Date of fit: Wed May 27 07:05:18 2020 +#> Date of summary: Wed May 27 07:05:18 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent #> #> Model predictions using solution type analytical #> -#> Fitted using 131 model solutions performed in 0.027 s +#> Fitted using 131 model solutions performed in 0.026 s #> #> Error model: Constant variance #> @@ -271,9 +271,9 @@ EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, #> #> Parameter correlation: #> parent_0 log_k_parent sigma -#> parent_0 1.000e+00 5.428e-01 1.642e-07 -#> log_k_parent 5.428e-01 1.000e+00 2.507e-07 -#> sigma 1.642e-07 2.507e-07 1.000e+00 +#> parent_0 1.000e+00 5.428e-01 1.648e-07 +#> log_k_parent 5.428e-01 1.000e+00 2.513e-07 +#> sigma 1.648e-07 2.513e-07 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. diff --git a/docs/reference/synthetic_data_for_UBA_2014.html b/docs/reference/synthetic_data_for_UBA_2014.html index 17d2f973..1444be76 100644 --- a/docs/reference/synthetic_data_for_UBA_2014.html +++ b/docs/reference/synthetic_data_for_UBA_2014.html @@ -290,8 +290,8 @@ Compare also the code in the example section to see the degradation models." /> quiet = TRUE) plot_sep(fit)summary(fit)#> mkin version used for fitting: 0.9.50.2 #> R version used for fitting: 4.0.0 -#> Date of fit: Tue May 12 15:31:29 2020 -#> Date of summary: Tue May 12 15:31:29 2020 +#> Date of fit: Wed May 27 07:05:27 2020 +#> Date of summary: Wed May 27 07:05:27 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -300,7 +300,7 @@ Compare also the code in the example section to see the degradation models." /> #> #> Model predictions using solution type deSolve #> -#> Fitted using 819 model solutions performed in 0.619 s +#> Fitted using 817 model solutions performed in 0.627 s #> #> Error model: Constant variance #> @@ -352,15 +352,15 @@ Compare also the code in the example section to see the degradation models." /> #> log_k_M2 2.819e-02 7.166e-02 -3.929e-01 1.000e+00 -2.658e-01 #> f_parent_ilr_1 -4.624e-01 -5.682e-01 7.478e-01 -2.658e-01 1.000e+00 #> f_M1_ilr_1 1.614e-01 4.102e-01 -8.109e-01 5.419e-01 -8.605e-01 -#> sigma 1.285e-07 1.054e-07 -1.671e-07 3.644e-08 -2.503e-07 +#> sigma -1.384e-07 -2.581e-07 9.499e-08 1.518e-07 1.236e-07 #> f_M1_ilr_1 sigma -#> parent_0 1.614e-01 1.285e-07 -#> log_k_parent 4.102e-01 1.054e-07 -#> log_k_M1 -8.109e-01 -1.671e-07 -#> log_k_M2 5.419e-01 3.644e-08 -#> f_parent_ilr_1 -8.605e-01 -2.503e-07 -#> f_M1_ilr_1 1.000e+00 2.636e-07 -#> sigma 2.636e-07 1.000e+00 +#> parent_0 1.614e-01 -1.384e-07 +#> log_k_parent 4.102e-01 -2.581e-07 +#> log_k_M1 -8.109e-01 9.499e-08 +#> log_k_M2 5.419e-01 1.518e-07 +#> f_parent_ilr_1 -8.605e-01 1.236e-07 +#> f_M1_ilr_1 1.000e+00 8.795e-09 +#> sigma 8.795e-09 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. @@ -397,8 +397,8 @@ Compare also the code in the example section to see the degradation models." /> #> #> Data: #> time variable observed predicted residual -#> 0 parent 101.5 1.021e+02 -0.56249 -#> 0 parent 101.2 1.021e+02 -0.86249 +#> 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 @@ -407,8 +407,8 @@ Compare also the code in the example section to see the degradation models." /> #> 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.531e-10 0.60000 -#> 120 parent 3.5 -5.940e-10 3.50000 +#> 90 parent 0.6 9.535e-10 0.60000 +#> 120 parent 3.5 -5.941e-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 @@ -418,9 +418,9 @@ Compare also the code in the example section to see the degradation models." /> #> 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 +#> 90 M1 3.2 -9.676e-10 3.20000 +#> 120 M1 1.5 7.671e-10 1.50000 +#> 120 M1 0.6 7.671e-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 diff --git a/docs/reference/test_data_from_UBA_2014.html b/docs/reference/test_data_from_UBA_2014.html index 237149a5..6059a4d2 100644 --- a/docs/reference/test_data_from_UBA_2014.html +++ b/docs/reference/test_data_from_UBA_2014.html @@ -191,26 +191,26 @@ M3 = mkinsub("SFO"), use_of_ff = "max")#>#> Warning: Observations with value of zero were removed from the data#> Estimate se_notrans t value Pr(>t) Lower -#> parent_0 76.55425585 0.859186419 89.1008682 1.113862e-26 74.755958727 -#> k_parent 0.12081956 0.004601919 26.2541704 1.077361e-16 0.111561576 -#> k_M1 0.84258631 0.806165101 1.0451783 1.545282e-01 0.113778787 -#> k_M2 0.04210878 0.017083048 2.4649453 1.170195e-02 0.018013823 -#> k_M3 0.01122919 0.007245869 1.5497365 6.885076e-02 0.002909418 -#> f_parent_to_M1 0.32240194 0.240785506 1.3389591 9.819219e-02 NA -#> f_parent_to_M2 0.16099854 0.033691990 4.7785405 6.531222e-05 NA -#> f_M1_to_M3 0.27921506 0.269425556 1.0363347 1.565282e-01 0.022977927 -#> f_M2_to_M3 0.55641328 0.595121733 0.9349571 1.807710e-01 0.008002321 +#> parent_0 76.55425584 0.859186419 89.1008681 1.113862e-26 74.755958720 +#> k_parent 0.12081956 0.004601919 26.2541703 1.077361e-16 0.111561576 +#> k_M1 0.84258629 0.806165149 1.0451783 1.545282e-01 0.113778910 +#> k_M2 0.04210878 0.017083049 2.4649452 1.170195e-02 0.018013823 +#> k_M3 0.01122919 0.007245870 1.5497364 6.885076e-02 0.002909418 +#> f_parent_to_M1 0.32240193 0.240785518 1.3389590 9.819221e-02 NA +#> f_parent_to_M2 0.16099854 0.033691991 4.7785404 6.531224e-05 NA +#> f_M1_to_M3 0.27921506 0.269425582 1.0363346 1.565282e-01 0.022977955 +#> f_M2_to_M3 0.55641331 0.595121774 0.9349571 1.807710e-01 0.008002320 #> sigma 1.14005399 0.149696423 7.6157731 1.727024e-07 0.826735778 #> Upper -#> parent_0 78.35255298 +#> parent_0 78.35255297 #> k_parent 0.13084582 -#> k_M1 6.23975442 -#> k_M2 0.09843270 -#> k_M3 0.04334016 +#> k_M1 6.23974738 +#> k_M2 0.09843271 +#> k_M3 0.04334017 #> f_parent_to_M1 NA #> f_parent_to_M2 NA -#> f_M1_to_M3 0.86450919 -#> f_M2_to_M3 0.99489910 +#> f_M1_to_M3 0.86450905 +#> f_M2_to_M3 0.99489911 #> sigma 1.45337221mkinerrmin(f_soil)#> err.min n.optim df #> All data 0.09649963 9 20 #> parent 0.04721283 2 6 diff --git a/docs/reference/transform_odeparms.html b/docs/reference/transform_odeparms.html index 7a9198de..9b84d6bf 100644 --- a/docs/reference/transform_odeparms.html +++ b/docs/reference/transform_odeparms.html @@ -77,7 +77,7 @@ the ilr transformation is used." />@@ -114,9 +114,6 @@ the ilr transformation is used." />
A vector of transformed or backtransformed parameters
+A vector of transformed or backtransformed parameters with the same +names as the original parameters.
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
.
backtransform_odeparms
: Backtransform the set of transformed parameters
@@ -241,7 +245,7 @@ This is no problem for the internal use inmkinfit< #> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
# \dontrun{ # Compare to the version without transforming rate parameters -fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)#> Warning: Observations with value of zero were removed from the data#> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", cost.current, "\n", sep = "")}: missing value where TRUE/FALSE needed#>#> Error in summary(fit.2): object 'fit.2' not found#> Error in print(fit.2.s$par, 3): object 'fit.2.s' not found#> Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found#> Warning: Observations with value of zero were removed from the data#> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", cost.current, "\n", sep = "")}: missing value where TRUE/FALSE needed#>#> Error in summary(fit.2): object 'fit.2' not found#> Error in print(fit.2.s$par, 3): object 'fit.2.s' not found#> Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found# } initials <- fit$start$value names(initials) <- rownames(fit$start) diff --git a/docs/reference/update.mkinfit.html b/docs/reference/update.mkinfit.html index f958fc14..83b8c466 100644 --- a/docs/reference/update.mkinfit.html +++ b/docs/reference/update.mkinfit.html @@ -177,7 +177,7 @@ remove arguments given in the original call-- cgit v1.2.1#> parent_0 k_parent_sink sigma -#> 99.44423885 0.09793574 3.39632469plot_err(fit)plot_err(fit)#> parent_0 k_parent_sink sigma_low rsd_high #> 1.008549e+02 1.005665e-01 3.752222e-03 6.763434e-02plot_err(fit_2)# }