Equilibrium | R Documentation |
An R6 class to calculate the equilibrium of a model
An R6 class to calculate the equilibrium of a model
Calculate the equilibrium of the model with a given initial condition
REpiSim::Simulator
-> REpiSim::ODE
-> Equilibrium
new()
constructor
Equilibrium$new( model, vary = NULL, range = NULL, max.iter = 100, error = 1e-06 )
model
the model to simulate. It must be an object of a subclass of 'Model'.
vary
the name of a parameter to value, a character
range
the range of the varying parameter, a numerical vector
max.iter
the maximum iterations to search for the equilibrium
error
a numeric value giving the 2-norm of the tolerance
simulate()
simulate the model
Equilibrium$simulate(t, y0, parms = NULL, vars = names(y0), ...)
t
a numeric vector of times.
y0
a numeric vector of initial conditions.
parms
a numeric vector of parameter values.
vars
a character vector specifying the variable names to be returned. A variable can be either a compartment or a substitution
...
extra arguments to be passed to the 'ode' method substitutions that depend on the compartments are calculated and returned
a data frame which rows correspond to each time in 't', and columns correspond to the variables specified in vars.
clone()
The objects of this class are cloneable with this method.
Equilibrium$clone(deep = FALSE)
deep
Whether to make a deep clone.
## an SIR model
SIR = Model$new(title="SIR")
SIR$compartment(S ~ -beta*S*I/N)$
compartment(I ~ beta*S*I/N - gamma*I)$
compartment(R ~ gamma*I)$
where(N = S + I + R)
eq = Equilibrium$new(SIR, vary="beta", range=seq(0, 0.4, by=0.01))
ode$simulate(
time=0:40,
y0=c(S=10000, I=1, R=0),
parms=c(beta=0.4, gamma=0.2),
alias = FALSE) # N is not returned.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.