Description Usage Arguments Details Value See Also Examples
Parameter transformation (implicit)
1 2 3 4 5 6 7 8 9 10 |
trafo |
Named character vector defining the equations to be set to zero. Names correspond to dependent variables. |
parameters |
Character vector, the independent variables. |
condition |
character, the condition for which the transformation is generated |
keep.root |
logical, applies for |
positive |
logical, returns projection to the (semi)positive range. Comes with a warning if the steady state has been found to be negative. |
compile |
Logical, compile the function (see funC0) |
modelname |
Character, used if |
verbose |
Print compiler output to R command line. |
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.
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".
Pexpl for explicit parameter transformations
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 | ########################################################################
## 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.