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"))
#> Error in mkinmod(parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO")): konnte Funktion "mkinmod" nicht finden
# Fit the model to the FOCUS example dataset D using defaults fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Error in mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE): konnte Funktion "mkinfit" nicht finden
summary(fit, data=FALSE) # See transformed and backtransformed parameters
#> Error in summary(fit, data = FALSE): Objekt 'fit' nicht gefunden
fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
#> Error in mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE): konnte Funktion "mkinfit" nicht finden
summary(fit.2, data=FALSE)
#> Error in summary(fit.2, data = FALSE): Objekt 'fit.2' nicht gefunden
initials <- fit$start$value
#> Error in eval(expr, envir, enclos): Objekt 'fit' nicht gefunden
names(initials) <- rownames(fit$start)
#> Error in rownames(fit$start): Objekt 'fit' nicht gefunden
transformed <- fit$start_transformed$value
#> Error in eval(expr, envir, enclos): Objekt 'fit' nicht gefunden
names(transformed) <- rownames(fit$start_transformed)
#> Error in rownames(fit$start_transformed): Objekt 'fit' nicht gefunden
transform_odeparms(initials, SFO_SFO)
#> Error in transform_odeparms(initials, SFO_SFO): konnte Funktion "transform_odeparms" nicht finden
backtransform_odeparms(transformed, SFO_SFO)
#> Error in backtransform_odeparms(transformed, SFO_SFO): konnte Funktion "backtransform_odeparms" nicht finden
# 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")
#> Error in mkinmod(parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO"), use_of_ff = "max"): konnte Funktion "mkinmod" nicht finden
fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
#> Error in mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE): konnte Funktion "mkinfit" nicht finden
summary(fit.ff, data = FALSE)
#> Error in summary(fit.ff, data = FALSE): Objekt 'fit.ff' nicht gefunden
initials <- c("f_parent_to_m1" = 0.5) transformed <- transform_odeparms(initials, SFO_SFO.ff)
#> Error in transform_odeparms(initials, SFO_SFO.ff): konnte Funktion "transform_odeparms" nicht finden
backtransform_odeparms(transformed, SFO_SFO.ff)
#> Error in backtransform_odeparms(transformed, SFO_SFO.ff): konnte Funktion "backtransform_odeparms" nicht finden
# And without sink SFO_SFO.ff.2 <- mkinmod( parent = list(type = "SFO", to = "m1", sink = FALSE), m1 = list(type = "SFO"), use_of_ff = "max")
#> Error in mkinmod(parent = list(type = "SFO", to = "m1", sink = FALSE), m1 = list(type = "SFO"), use_of_ff = "max"): konnte Funktion "mkinmod" nicht finden
fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
#> Error in mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE): konnte Funktion "mkinfit" nicht finden
summary(fit.ff.2, data = FALSE)
#> Error in summary(fit.ff.2, data = FALSE): Objekt 'fit.ff.2' nicht gefunden