From b5ee48a86e4b1d4c05aaadb80b44954e2e994ebc Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 27 May 2020 07:12:51 +0200 Subject: Add docs generated using released version 0.9.52 --- docs/reference/mkinfit.html | 216 ++++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 109 deletions(-) (limited to 'docs/reference/mkinfit.html') diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html index ced0cb54..c38c5cca 100644 --- a/docs/reference/mkinfit.html +++ b/docs/reference/mkinfit.html @@ -41,11 +41,9 @@ @@ -80,7 +78,7 @@ likelihood function." /> mkin - 0.9.50.3 + 0.9.50.2 @@ -117,9 +115,6 @@ likelihood function." />
  • Example evaluation of NAFTA SOP Attachment examples
  • -
  • - Some benchmark timings -
  • @@ -153,11 +148,9 @@ likelihood function." />

    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.

    @@ -195,7 +188,7 @@ likelihood function.

    mkinmod -

    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.

    +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 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.

    method.ode -

    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.

    use_compiled

    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.

    control -

    A list of control arguments passed to stats::nlminb().

    +

    A list of control arguments passed to nlminb.

    transform_rates @@ -311,7 +306,7 @@ fitting for better compliance with the assumption of normal distribution of the estimator. The default (TRUE) is to do transformations. If TRUE, the g parameter of the DFOP and HS models are also transformed, as they can also be seen as compositional data. The transformation used for these -transformations is the ilr() transformation.

    +transformations is the ilr transformation.

    quiet @@ -320,14 +315,13 @@ log-likelihood after each improvement?

    atol -

    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.

    rtol -

    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.

    error_model @@ -348,9 +342,11 @@ normal distribution as assumed by this method.

    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 "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.

    Value

    -

    A list with "mkinfit" in the class attribute.

    +

    A list with "mkinfit" in the class attribute. A summary can be +obtained by summary.mkinfit.

    Details

    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.

    See also

    -

    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"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # 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.423
    parms(fit)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma -#> 99.598483222 0.098697734 0.005260651 0.514475962 3.125503875
    #> $ff +#> 0.400 0.004 0.404
    parms(fit)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598481046 0.098697740 0.005260651 0.514475962 3.125503875
    #> $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
    #> Optimisation successfully terminated.
    #> user system elapsed -#> 0.351 0.000 0.352
    parms(fit.deSolve)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma -#> 99.598480759 0.098697739 0.005260651 0.514475958 3.125503874
    endpoints(fit.deSolve)
    #> $ff +#> Sum of squared residuals at call 167: 371.2134 +#> Negative log-likelihood at call 177: 97.22429
    #> Optimisation successfully terminated.
    #> user system elapsed +#> 0.360 0.000 0.361
    parms(fit.deSolve)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598480300 0.098697739 0.005260651 0.514475968 3.125503874
    endpoints(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")
    #> Successfully compiled differential equation model from auto-generated C code.
    f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.noweight)
    #> mkin version used for fitting: 0.9.50.3 + m1 = mkinsub("SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(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+00
    f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.obs)
    #> mkin version used for fitting: 0.9.50.3 +#> 120 m1 33.31 28.78984 4.520e+00
    f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(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+00
    f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.tc)
    #> mkin version used for fitting: 0.9.50.3 +#> 120 m1 33.31 28.80429 4.506e+00
    f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(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 #> -- cgit v1.2.1