The transformations are intended to map parameters that should only take on restricted values to the full scale of real numbers. For kinetic rate constants and other paramters 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 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.

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

Arguments

parms

Parameters of kinetic models as used in the differential equations.

transparms

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

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

Value

A vector of transformed or backtransformed parameters with the same names as the original parameters.

Examples

SFO_SFO <- mkinmod( parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Fit the model to the FOCUS example dataset D using defaults fit <- mkinfit(SFO_SFO, FOCUS_2006_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.6137 96.33 102.87 #> log_k_parent_sink -3.04 0.0783 -3.20 -2.88 #> log_k_parent_m1 -2.98 0.0412 -3.06 -2.90 #> log_k_m1_sink -5.25 0.1361 -5.52 -4.97
print(fit.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.613712 61.72 2.02e-38 96.32572 1.03e+02 #> k_parent_sink 0.04792 0.003750 12.78 3.05e-15 0.04089 5.62e-02 #> k_parent_m1 0.05078 0.002094 24.25 3.41e-24 0.04670 5.52e-02 #> k_m1_sink 0.00526 0.000716 7.35 5.76e-09 0.00399 6.93e-03
# Compare to the version without transforming rate parameters fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE) fit.2.s <- summary(fit.2) print(fit.2.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.59848 1.613710 96.32573 1.03e+02 #> k_parent_sink 0.04792 0.003750 0.04031 5.55e-02 #> k_parent_m1 0.05078 0.002094 0.04653 5.50e-02 #> k_m1_sink 0.00526 0.000716 0.00381 6.71e-03
print(fit.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.613710 61.72 2.02e-38 96.32573 1.03e+02 #> k_parent_sink 0.04792 0.003750 12.78 3.05e-15 0.04031 5.55e-02 #> k_parent_m1 0.05078 0.002094 24.25 3.41e-24 0.04653 5.50e-02 #> k_m1_sink 0.00526 0.000716 7.35 5.76e-09 0.00381 6.71e-03
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
# The case of formation fractions SFO_SFO.ff <- mkinmod( parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE) fit.ff.s <- summary(fit.ff) print(fit.ff.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.598 1.6137 96.3257 102.871 #> log_k_parent -2.316 0.0419 -2.4006 -2.231 #> log_k_m1 -5.248 0.1361 -5.5235 -4.972 #> f_parent_ilr_1 0.041 0.0648 -0.0904 0.172
print(fit.ff.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.613712 61.72 2.02e-38 96.32574 1.03e+02 #> k_parent 0.09870 0.004132 23.88 5.70e-24 0.09066 1.07e-01 #> k_m1 0.00526 0.000716 7.35 5.76e-09 0.00399 6.93e-03 #> f_parent_to_m1 0.51448 0.022880 22.49 4.37e-23 0.46808 5.61e-01
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")
#> Successfully compiled differential equation model from auto-generated C code.
fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_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 2.9651 78.78 90.80 #> log_k_parent -2.76 0.0809 -2.92 -2.59 #> log_k_m1 -4.21 0.1115 -4.44 -3.99
print(fit.ff.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 84.7916 2.96505 28.60 3.94e-27 78.7838 90.7994 #> k_parent 0.0635 0.00514 12.36 5.24e-15 0.0539 0.0748 #> k_m1 0.0148 0.00165 8.97 4.11e-11 0.0118 0.0185