aboutsummaryrefslogtreecommitdiff
path: root/man/transform_odeparms.Rd
blob: 710b0875740f59267822462758923baca75ff91a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/transform_odeparms.R
\name{transform_odeparms}
\alias{transform_odeparms}
\alias{backtransform_odeparms}
\title{Functions to transform and backtransform kinetic parameters for fitting}
\usage{
transform_odeparms(
  parms,
  mkinmod,
  transform_rates = TRUE,
  transform_fractions = TRUE
)

backtransform_odeparms(
  transparms,
  mkinmod,
  transform_rates = TRUE,
  transform_fractions = TRUE
)
}
\arguments{
\item{parms}{Parameters of kinetic models as used in the differential
equations.}

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

\item{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.}

\item{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 \code{\link{ilr}} transformation.}

\item{transparms}{Transformed parameters of kinetic models as used in the
fitting procedure.}
}
\value{
A vector of transformed or backtransformed parameters
}
\description{
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 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 \code{\link{ilr}} transformation is used.
}
\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 \code{\link{mkinfit}}.
}
\examples{

SFO_SFO <- mkinmod(
  parent = list(type = "SFO", to = "m1", sink = TRUE),
  m1 = list(type = "SFO"))
# 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)
print(fit.s$bpar, 3)

\dontrun{
# 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)
print(fit.2.s$bpar, 3)
}

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)
backtransform_odeparms(transformed, SFO_SFO)

\dontrun{
# 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")

fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
fit.ff.s <- summary(fit.ff)
print(fit.ff.s$par, 3)
print(fit.ff.s$bpar, 3)
initials <- c("f_parent_to_m1" = 0.5)
transformed <- transform_odeparms(initials, SFO_SFO.ff)
backtransform_odeparms(transformed, SFO_SFO.ff)

# And without sink
SFO_SFO.ff.2 <- mkinmod(
  parent = list(type = "SFO", to = "m1", sink = FALSE),
  m1 = list(type = "SFO"),
  use_of_ff = "max")


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)
print(fit.ff.2.s$bpar, 3)
}

}
\author{
Johannes Ranke
}

Contact - Imprint