From af7c6de4db9981ac814362c441fbac22c8faa2d7 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 24 Nov 2022 09:02:26 +0100 Subject: Start online docs of the development version --- docs/dev/reference/transform_odeparms.html | 449 +++++++++++++---------------- 1 file changed, 205 insertions(+), 244 deletions(-) (limited to 'docs/dev/reference/transform_odeparms.html') diff --git a/docs/dev/reference/transform_odeparms.html b/docs/dev/reference/transform_odeparms.html index 75d6a1f9..a7a01043 100644 --- a/docs/dev/reference/transform_odeparms.html +++ b/docs/dev/reference/transform_odeparms.html @@ -1,72 +1,17 @@ - - - - - - - -Functions to transform and backtransform kinetic parameters for fitting — transform_odeparms • mkin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Functions to transform and backtransform kinetic parameters for fitting — transform_odeparms • mkin - - - - - - - - - - + + - - - -
-
- -
- -
+
@@ -154,205 +99,221 @@ restricted values to the full scale of real numbers. For kinetic rate constants and other parameters that can only take on positive values, a simple log transformation is used. For compositional parameters, such as the formations fractions that should always sum up to 1 and can not be negative, -the ilr transformation is used.

+the ilr transformation is used.

+
+ +
+
transform_odeparms(
+  parms,
+  mkinmod,
+  transform_rates = TRUE,
+  transform_fractions = TRUE
+)
+
+backtransform_odeparms(
+  transparms,
+  mkinmod,
+  transform_rates = TRUE,
+  transform_fractions = TRUE
+)
-
transform_odeparms(
-  parms,
-  mkinmod,
-  transform_rates = TRUE,
-  transform_fractions = TRUE
-)
+    
+

Arguments

+
parms
+

Parameters of kinetic models as used in the differential +equations.

-backtransform_odeparms( - transparms, - mkinmod, - transform_rates = TRUE, - transform_fractions = TRUE -)
-

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
parms

Parameters of kinetic models as used in the differential -equations.

mkinmod

The kinetic model of class mkinmod, containing +

mkinmod
+

The kinetic model of class mkinmod, containing the names of the model variables that are needed for grouping the -formation fractions before ilr transformation, the parameter -names and the information if the pathway to sink is included in the model.

transform_rates

Boolean specifying if kinetic rate constants should +formation fractions before ilr transformation, the parameter +names and the information if the pathway to sink is included in the model.

+ + +
transform_rates
+

Boolean specifying if kinetic rate constants should be transformed in the model specification used in the fitting for better compliance with the assumption of normal distribution of the estimator. If TRUE, also alpha and beta parameters of the FOMC model are log-transformed, as well as k1 and k2 rate constants for the DFOP and HS -models and the break point tb of the HS model.

transform_fractions

Boolean specifying if formation fractions +models and the break point tb of the HS model.

+ + +
transform_fractions
+

Boolean specifying if formation fractions constants should be transformed in the model specification used in the fitting for better compliance with the assumption of normal distribution of the estimator. The default (TRUE) is to do transformations. The g parameter of the DFOP model is also seen as a fraction. If a single fraction is transformed (g parameter of DFOP or only a single target variable e.g. a single metabolite plus a pathway to sink), a -logistic transformation is used stats::qlogis(). In other cases, i.e. if +logistic transformation is used stats::qlogis(). In other cases, i.e. if two or more formation fractions need to be transformed whose sum cannot -exceed one, the ilr transformation is used.

transparms

Transformed parameters of kinetic models as used in the -fitting procedure.

+exceed one, the ilr transformation is used.

+ -

Value

+
transparms
+

Transformed parameters of kinetic models as used in the +fitting procedure.

-

A vector of transformed or backtransformed parameters

-

Details

+
+
+

Value

+ +

A vector of transformed or backtransformed parameters

+
+
+

Details

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.

-

Author

- +This is no problem for the internal use in mkinfit.

+
+
+

Author

Johannes Ranke

+
-

Examples

-
-SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = TRUE), - m1 = list(type = "SFO"), use_of_ff = "min") -
#> Temporary DLL for differentials generated and loaded
-# Fit the model to the FOCUS example dataset D using defaults -FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning -fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE) -fit.s <- summary(fit) -# Transformed and backtransformed parameters -print(fit.s$par, 3) -
#> Estimate Std. Error Lower Upper -#> parent_0 99.60 1.5702 96.40 102.79 -#> log_k_parent_sink -3.04 0.0763 -3.19 -2.88 -#> log_k_parent_m1 -2.98 0.0403 -3.06 -2.90 -#> log_k_m1_sink -5.25 0.1332 -5.52 -4.98 -#> sigma 3.13 0.3585 2.40 3.85
print(fit.s$bpar, 3) -
#> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 102.7931 -#> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04103 0.0560 -#> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04678 0.0551 -#> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
-# \dontrun{ -# Compare to the version without transforming rate parameters (does not work -# with analytical solution, we get NA values for m1 in predictions) -fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE, - solution_type = "deSolve", quiet = TRUE) -fit.2.s <- summary(fit.2) -print(fit.2.s$par, 3) -
#> Estimate Std. Error Lower Upper -#> parent_0 99.59848 1.57022 96.40384 1.03e+02 -#> k_parent_sink 0.04792 0.00365 0.04049 5.54e-02 -#> k_parent_m1 0.05078 0.00205 0.04661 5.49e-02 -#> k_m1_sink 0.00526 0.00070 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 2.39609 3.85e+00
print(fit.2.s$bpar, 3) -
#> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 1.03e+02 -#> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04049 5.54e-02 -#> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04661 5.49e-02 -#> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.85e+00
# } - -initials <- fit$start$value -names(initials) <- rownames(fit$start) -transformed <- fit$start_transformed$value -names(transformed) <- rownames(fit$start_transformed) -transform_odeparms(initials, SFO_SFO) -
#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink -#> 100.750000 -2.302585 -2.301586 -2.300587
backtransform_odeparms(transformed, SFO_SFO) -
#> parent_0 k_parent_sink k_parent_m1 k_m1_sink -#> 100.7500 0.1000 0.1001 0.1002
-# \dontrun{ -# The case of formation fractions (this is now the default) -SFO_SFO.ff <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = TRUE), - m1 = list(type = "SFO"), - use_of_ff = "max") -
#> Temporary DLL for differentials generated and loaded
-fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE) -fit.ff.s <- summary(fit.ff) -print(fit.ff.s$par, 3) -
#> Estimate Std. Error Lower Upper -#> parent_0 99.5985 1.5702 96.404 102.79 -#> log_k_parent -2.3157 0.0409 -2.399 -2.23 -#> log_k_m1 -5.2475 0.1332 -5.518 -4.98 -#> f_parent_qlogis 0.0579 0.0893 -0.124 0.24 -#> sigma 3.1255 0.3585 2.396 3.85
print(fit.ff.s$bpar, 3) -
#> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40383 102.7931 -#> k_parent 0.09870 0.00403 24.47 4.96e-23 0.09082 0.1073 -#> k_m1 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 -#> f_parent_to_m1 0.51448 0.02230 23.07 3.10e-22 0.46912 0.5596 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
initials <- c("f_parent_to_m1" = 0.5) -transformed <- transform_odeparms(initials, SFO_SFO.ff) -backtransform_odeparms(transformed, SFO_SFO.ff) -
#> f_parent_to_m1 -#> 0.5
-# And without sink -SFO_SFO.ff.2 <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = FALSE), - m1 = list(type = "SFO"), - use_of_ff = "max") -
#> Temporary DLL for differentials generated and loaded
- -fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE) -fit.ff.2.s <- summary(fit.ff.2) -print(fit.ff.2.s$par, 3) -
#> Estimate Std. Error Lower Upper -#> parent_0 84.79 3.012 78.67 90.91 -#> log_k_parent -2.76 0.082 -2.92 -2.59 -#> log_k_m1 -4.21 0.123 -4.46 -3.96 -#> sigma 8.22 0.943 6.31 10.14
print(fit.ff.2.s$bpar, 3) -
#> Estimate se_notrans t value Pr(>t) Lower Upper -#> parent_0 84.7916 3.01203 28.15 1.92e-25 78.6704 90.913 -#> k_parent 0.0635 0.00521 12.19 2.91e-14 0.0538 0.075 -#> k_m1 0.0148 0.00182 8.13 8.81e-10 0.0115 0.019 -#> sigma 8.2229 0.94323 8.72 1.73e-10 6.3060 10.140
# } - -
+
+

Examples

+

+SFO_SFO <- mkinmod(
+  parent = list(type = "SFO", to = "m1", sink = TRUE),
+  m1 = list(type = "SFO"), use_of_ff = "min")
+#> Temporary DLL for differentials generated and loaded
+
+# Fit the model to the FOCUS example dataset D using defaults
+FOCUS_D <- subset(FOCUS_2006_D, value != 0) # remove zero values to avoid warning
+fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE)
+fit.s <- summary(fit)
+# Transformed and backtransformed parameters
+print(fit.s$par, 3)
+#>                   Estimate Std. Error Lower  Upper
+#> parent_0             99.60     1.5702 96.40 102.79
+#> log_k_parent_sink    -3.04     0.0763 -3.19  -2.88
+#> log_k_parent_m1      -2.98     0.0403 -3.06  -2.90
+#> log_k_m1_sink        -5.25     0.1332 -5.52  -4.98
+#> sigma                 3.13     0.3585  2.40   3.85
+print(fit.s$bpar, 3)
+#>               Estimate se_notrans t value   Pr(>t)    Lower    Upper
+#> parent_0      99.59848    1.57022   63.43 2.30e-36 96.40384 102.7931
+#> k_parent_sink  0.04792    0.00365   13.11 6.13e-15  0.04103   0.0560
+#> k_parent_m1    0.05078    0.00205   24.80 3.27e-23  0.04678   0.0551
+#> k_m1_sink      0.00526    0.00070    7.51 6.16e-09  0.00401   0.0069
+#> sigma          3.12550    0.35852    8.72 2.24e-10  2.39609   3.8549
+
+# \dontrun{
+# Compare to the version without transforming rate parameters (does not work
+# with analytical solution, we get NA values for m1 in predictions)
+fit.2 <- mkinfit(SFO_SFO, FOCUS_D, transform_rates = FALSE,
+  solution_type = "deSolve", quiet = TRUE)
+fit.2.s <- summary(fit.2)
+print(fit.2.s$par, 3)
+#>               Estimate Std. Error    Lower    Upper
+#> parent_0      99.59848    1.57022 96.40384 1.03e+02
+#> k_parent_sink  0.04792    0.00365  0.04049 5.54e-02
+#> k_parent_m1    0.05078    0.00205  0.04661 5.49e-02
+#> k_m1_sink      0.00526    0.00070  0.00384 6.69e-03
+#> sigma          3.12550    0.35852  2.39609 3.85e+00
+print(fit.2.s$bpar, 3)
+#>               Estimate se_notrans t value   Pr(>t)    Lower    Upper
+#> parent_0      99.59848    1.57022   63.43 2.30e-36 96.40384 1.03e+02
+#> k_parent_sink  0.04792    0.00365   13.11 6.13e-15  0.04049 5.54e-02
+#> k_parent_m1    0.05078    0.00205   24.80 3.27e-23  0.04661 5.49e-02
+#> k_m1_sink      0.00526    0.00070    7.51 6.16e-09  0.00384 6.69e-03
+#> sigma          3.12550    0.35852    8.72 2.24e-10  2.39609 3.85e+00
+# }
+
+initials <- fit$start$value
+names(initials) <- rownames(fit$start)
+transformed <- fit$start_transformed$value
+names(transformed) <- rownames(fit$start_transformed)
+transform_odeparms(initials, SFO_SFO)
+#>          parent_0 log_k_parent_sink   log_k_parent_m1     log_k_m1_sink 
+#>        100.750000         -2.302585         -2.301586         -2.300587 
+backtransform_odeparms(transformed, SFO_SFO)
+#>      parent_0 k_parent_sink   k_parent_m1     k_m1_sink 
+#>      100.7500        0.1000        0.1001        0.1002 
+
+# \dontrun{
+# The case of formation fractions (this is now the default)
+SFO_SFO.ff <- mkinmod(
+  parent = list(type = "SFO", to = "m1", sink = TRUE),
+  m1 = list(type = "SFO"),
+  use_of_ff = "max")
+#> Temporary DLL for differentials generated and loaded
+
+fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_D, quiet = TRUE)
+fit.ff.s <- summary(fit.ff)
+print(fit.ff.s$par, 3)
+#>                 Estimate Std. Error  Lower  Upper
+#> parent_0         99.5985     1.5702 96.404 102.79
+#> log_k_parent     -2.3157     0.0409 -2.399  -2.23
+#> log_k_m1         -5.2475     0.1332 -5.518  -4.98
+#> f_parent_qlogis   0.0579     0.0893 -0.124   0.24
+#> sigma             3.1255     0.3585  2.396   3.85
+print(fit.ff.s$bpar, 3)
+#>                Estimate se_notrans t value   Pr(>t)    Lower    Upper
+#> parent_0       99.59848    1.57022   63.43 2.30e-36 96.40383 102.7931
+#> k_parent        0.09870    0.00403   24.47 4.96e-23  0.09082   0.1073
+#> k_m1            0.00526    0.00070    7.51 6.16e-09  0.00401   0.0069
+#> f_parent_to_m1  0.51448    0.02230   23.07 3.10e-22  0.46912   0.5596
+#> sigma           3.12550    0.35852    8.72 2.24e-10  2.39609   3.8549
+initials <- c("f_parent_to_m1" = 0.5)
+transformed <- transform_odeparms(initials, SFO_SFO.ff)
+backtransform_odeparms(transformed, SFO_SFO.ff)
+#> f_parent_to_m1 
+#>            0.5 
+
+# And without sink
+SFO_SFO.ff.2 <- mkinmod(
+  parent = list(type = "SFO", to = "m1", sink = FALSE),
+  m1 = list(type = "SFO"),
+  use_of_ff = "max")
+#> Temporary DLL for differentials generated and loaded
+
+
+fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_D, quiet = TRUE)
+fit.ff.2.s <- summary(fit.ff.2)
+print(fit.ff.2.s$par, 3)
+#>              Estimate Std. Error Lower Upper
+#> parent_0        84.79      3.012 78.67 90.91
+#> log_k_parent    -2.76      0.082 -2.92 -2.59
+#> log_k_m1        -4.21      0.123 -4.46 -3.96
+#> sigma            8.22      0.943  6.31 10.14
+print(fit.ff.2.s$bpar, 3)
+#>          Estimate se_notrans t value   Pr(>t)   Lower  Upper
+#> parent_0  84.7916    3.01203   28.15 1.92e-25 78.6704 90.913
+#> k_parent   0.0635    0.00521   12.19 2.91e-14  0.0538  0.075
+#> k_m1       0.0148    0.00182    8.13 8.81e-10  0.0115  0.019
+#> sigma      8.2229    0.94323    8.72 1.73e-10  6.3060 10.140
+# }
+
+
+
+
- - - + + -- cgit v1.2.1