
Last chance! 50% off unlimited learning
Sale ends in
Parameter transformation (implicit)
Pimpl(trafo, parameters = NULL, condition = NULL, keep.root = TRUE,
positive = TRUE, compile = FALSE, modelname = NULL, verbose = FALSE)
Named character vector defining the equations to be set to zero. Names correspond to dependent variables.
Character vector, the independent variables.
character, the condition for which the transformation is generated
logical, applies for method = "implicit"
. The root of the last
evaluation of the parameter transformation function is saved as guess for the next
evaluation.
logical, returns projection to the (semi)positive range. Comes with a warning if the steady state has been found to be negative.
Logical, compile the function (see funC0)
Character, used if compile = TRUE
, sets a fixed filename for the
C file.
Print compiler output to R command line.
a function p2p(p, fixed = NULL, deriv = TRUE)
representing the parameter
transformation. Here, p
is a named numeric vector with the values of the outer parameters,
fixed
is a named numeric vector with values of the outer parameters being considered
as fixed (no derivatives returned) and deriv
is a logical determining whether the Jacobian
of the parameter transformation is returned as attribute "deriv".
Usually, the equations contain the dependent variables, the independent variables and
other parameters. The argument p
of p2p
must provide values for the independent
variables and the parameters but ALSO FOR THE DEPENDENT VARIABLES. Those serve as initial guess
for the dependent variables. The dependent variables are then numerically computed by
multiroot. The Jacobian of the solution with respect to dependent variables
and parameters is computed by the implicit function theorem. The function p2p
returns
all parameters as they are with corresponding 1-entries in the Jacobian.
Pexpl for explicit parameter transformations
# NOT RUN {
########################################################################
## Example 1: Steady-state trafo
########################################################################
f <- c(A = "-k1*A + k2*B",
B = "k1*A - k2*B")
P.steadyState <- Pimpl(f, "A")
p.outerValues <- c(k1 = 1, k2 = 0.1, A = 10, B = 1)
P.steadyState(p.outerValues)
########################################################################
## Example 2: Steady-state trafo combined with log-transform
########################################################################
f <- c(A = "-k1*A + k2*B",
B = "k1*A - k2*B")
P.steadyState <- Pimpl(f, "A")
logtrafo <- c(k1 = "exp(logk1)", k2 = "exp(logk2)", A = "exp(logA)", B = "exp(logB)")
P.log <- P(logtrafo)
p.outerValue <- c(logk1 = 1, logk2 = -1, logA = 0, logB = 0)
(P.log)(p.outerValue)
(P.steadyState * P.log)(p.outerValue)
########################################################################
## Example 3: Steady-states with conserved quantitites
########################################################################
f <- c(A = "-k1*A + k2*B", B = "k1*A - k2*B")
replacement <- c(B = "A + B - total")
f[names(replacement)] <- replacement
pSS <- Pimpl(f, "total")
pSS(c(k1 = 1, k2 = 2, A = 5, B = 5, total = 3))
# }
Run the code above in your browser using DataLab