Learn R Programming

dMod (version 0.1)

Pi: Parameter transformation (implicit)

Description

Parameter transformation (implicit)

Usage

Pi(trafo, parameters = NULL, compile = FALSE)

Arguments

trafo
Named character vector defining the equations to be set to zero. Names correspond to dependent variables.
parameters
Character vector, the independent variables.
compile
Logical, compile the function (see funC0)

Value

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

Details

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

See Also

P for explicit parameter transformations and concatenation for the concatenation of parameter transformations

Examples

Run this code
########################################################################
## Example 1: Steady-state trafo
########################################################################
f <- c(A = "-k1*A + k2*B",
       B = "k1*A - k2*B")
P.steadyState <- Pi(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 <- Pi(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 %o% P.log)(p.outerValue)

Run the code above in your browser using DataLab