Description Usage Arguments Details Value See Also Examples
Fit the parameters (and optionally initial states) for a ordinary differential equation model with data sampled across different contexts.
1 2 |
x |
|
op |
|
x0 |
A vector (or matrix) of non-negative initialisation(s) for the initial state in the optimisation problem, see details. |
params |
A list of initialisations for the parameter arguments in the optimisation problem, see details. A list of matrices if multiple initialisations are desired. Sparse matrix "dgCMatrix" is allowed. |
trace |
Logical indicating if status messages should be printed during |
... |
Additional arguments passed to |
For running a single initialisation of the optimisation procedure, supply x0
as vector (where the initial states for the contexts are concatinated) and params
as a list with a vector entry for each parameter. The resulting estimates are stored in matrices, with each column representing a lambda-value. The convergence codes, steps and losses are stored as vectors, one entry for each value of lambda.
For running multiple initialisations, supply x0
as matrix with the individual initialisations as columns (each column vector as described above) and params
as list of matrices with initialisations stored column-wise.
The initial state estimates (for the different lambda-values) are returned as a matrix (array) (row = coordinate, column = lambda-value, (slice = initialisation)) and the parameter estimates are returned as a list of (lists with) sparse matrices (row = coordinate, column = lambda-value). The convergence codes, steps and losses are stored as matrices (row = lambda, column = initialisation).
For details on the loss function, optimisation, etc. See documentation of opt
.
If explicitly setting x0
to NULL
, the system uses the first observation of each context (throws error if non finites).
If explicitly setting params
to NULL
, 0 initialisations are used.
An object with S3 class "rodeo":
o |
Original |
op |
Original |
params |
Parameter estimates, stored as list of sparse column format matrices, "dgCMatrix" (or a list of those if multiple initialisations). Rows represent coordinates and columns represent the |
x0s |
Initial state estimates stored in a matrix (or array). Rows represent coordinates, columns represent the |
dfs |
A matrix (or array, if multiple initialisations) of degrees of freedom. Row represents a parameter (the first is always the initial state parameter), columns represent lambda, slices represent initialisation, if multiple are provided. |
codes |
A matrix (or array) of convergence codes organised as
|
steps |
A matrix (or array) holding number of steps used in optimisation procedure. Organised as |
losses |
A vector (or matrix) of unpenalised losses at optimum for each lambda value (stored row-wise if multiple are provided). |
penalties |
A matrix (or array) of penalties for each parameter, organised as |
jerr |
A matrix (or array) of summary codes (for internal debugging), organised as |
rodeo, rodeo.aim
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 | set.seed(123)
# Example: Michaelis-Menten system with two 0-rate reactions
A <- matrix(c(1, 1, 0, 0,
0, 0, 1, 0,
0, 0, 1, 0,
0, 1, 0, 0,
0, 0, 0, 1), ncol = 4, byrow = TRUE)
B <- matrix(c(0, 0, 1, 0,
1, 1, 0, 0,
1, 0, 0, 1,
0, 0, 0, 1,
0, 0, 1, 0), ncol = 4, byrow = TRUE)
k <- c(1, 2, 0.5, 0, 0); x0 <- c(E = 2, S = 8, ES = 0.5, P = 0.5)
Time <- seq(0, 10, by = 1)
# Simulate data, in second context the catalytic rate has been doubled
m <- mak(A, B)
contexts <- cbind(1, c(1, 1, 2, 1, 1))
y <- numsolve(m, c(Time, Time), cbind(x0, x0 + c(2, -2, 0, 0)), contexts * k)
y[, -1] <- y[, -1] + matrix(rnorm(prod(dim(y[, -1])), sd = .1), nrow = nrow(y))
# Fit data using rodeo on mak-object
op <- opt(y)
fit <- rodeo(m, op, x0 = NULL, params = NULL)
# Example: fit data knowing doubled catalytic rate
m_w_doubled <- mak(A, B, r = reg(contexts = contexts))
fit <- rodeo(m_w_doubled, op, x0 = NULL, params = NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.