Type: | Package |
Title: | Tools for Ordinary Differential Equations Model Fitting |
Version: | 0.1.1 |
Description: | Methods and functions for fitting ordinary differential equations (ODE) model in 'R'. Sensitivity equations are used to compute the gradients of ODE trajectories with respect to underlying parameters, which in turn allows for more stable fitting. Other fitting methods, such as MCMC (Markov chain Monte Carlo), are also available. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | R (≥ 4.0), bbmle |
Imports: | deSolve, Deriv, MASS, numDeriv, mvtnorm, coda, methods |
Suggests: | knitr, ggplot2, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2022-10-26 16:53:41 UTC; swp2 |
Author: | Sang Woo Park |
Maintainer: | Sang Woo Park <swp2@princeton.edu> |
Repository: | CRAN |
Date/Publication: | 2022-10-29 08:50:05 UTC |
S4 generic for evaluating an object
Description
S4 generic for evaluating an object
Usage
Eval(object, ...)
Arguments
object |
an |
... |
further arguments passed to methods |
Value
The result of evaluating the object.
Evaluate the log-likelihood model
Description
Evaluate the log-likelihood model
Usage
## S4 method for signature 'loglik.ode'
Eval(object, observation, mean, par = NULL, ...)
Arguments
object |
loglik.ode object |
observation |
observations |
mean |
mean values |
par |
additional parameters |
... |
other values if required |
Value
numeric
Data from 2014 Sierra Leone Ebola epidemic
Description
Ebola case reports ...
Usage
SierraLeone2014
Format
A data frame with 67 rows comprising:
- times
decimal dates (year + fraction of year)
- confirmed
confirmed cases
S4 generic for transforming an object
Description
S4 generic for transforming an object
Usage
Transform(object, ...)
Arguments
object |
an |
... |
further arguments passed to methods |
Value
The result of transforming the object.
Transform the model
Description
Transform the model
Usage
## S4 method for signature 'loglik.ode'
Transform(
object,
transforms = NULL,
name,
observation = "X",
mean,
par,
keep_grad = TRUE
)
Arguments
object |
loglik.ode object |
transforms |
list of formulas specifying transformations |
name |
name of the log-likelihood model |
observation |
observation variable name |
mean |
mean variable name |
par |
additional parameter names |
keep_grad |
maintain the gradient as part of the model |
Value
loglik.ode object
Transform the model
Description
Transform the model
Usage
## S4 method for signature 'odemodel'
Transform(
object,
transforms,
observation,
initial,
par,
link,
keep_sensitivity
)
Arguments
object |
odemodel object |
transforms |
list of formulas specifying transformations |
observation |
observation model |
initial |
initial values |
par |
model parameters |
keep_sensitivity |
(logical) maintain the Jacobian as part of the model |
Value
An object of class “odemodel” as described in odemodel-class
.
Transform the prior model
Description
Transform the prior model
Usage
## S4 method for signature 'prior.ode'
Transform(
object,
transforms = NULL,
name,
observation = "X",
par,
keep_grad = TRUE
)
Arguments
object |
object |
transforms |
list of formulas specifying transformations |
name |
name of the log-likelihood model |
observation |
observation variable name |
par |
additional parameter names |
keep_grad |
maintain the gradient as part of the model |
Value
An object of class “prior.ode” as described in prior.ode-class
.
Apply link functions to model parameters
Description
Apply link functions to model parameters – for fitode
internal usage. type=linkfun
applies link functions;
type=linkinv
applies inverse link functions; type=mu.eta
returns derivative of inverse link functions
Usage
apply_link(par, linklist, type = c("linkfun", "linkinv", "mu.eta"))
Arguments
par |
named vector of parameter values |
linklist |
list containing |
type |
string specifying which function should be applied |
Value
vector of parameter values with link transformations
See Also
Nicholson's blowfly data
Description
...
Usage
blowfly
Format
A data frame containing 361 rows comprising:
- eggs
number of eggs
- nonemerging
?
- emerging
?
- deaths
?
- total
?
Check link functions
Description
Check link functions for model parameters – for fitode
internal usage
Usage
check_link(model, link)
Arguments
model |
odemodel object |
link |
named vector specifying link functions |
Extract model coefficients from fitode objects
Description
Extracts estimated parameters (either on response scales or link scales)
Usage
## S4 method for signature 'fitode'
coef(object, type = c("response", "links"))
Arguments
object |
fitode object |
type |
type of coefficients. The default ( |
Value
The estimated coefficients of the fitode object
Extract model coefficients from fitodeMCMC objects
Description
Extracts estimated parameters (median of the marginal posterior distributions)
Usage
## S4 method for signature 'fitodeMCMC'
coef(object)
Arguments
object |
fitodeMCMC object |
Value
The estimated median coefficients of the fitodeMCMC object
Calculate confidence intervals from fitode objects for model parameters and their transformations
Description
Calculate confidence intervals for model parameters and their transformations using (1) delta method, (2) profile likelihood, and (3) importance sampling.
Usage
## S4 method for signature 'fitode'
confint(
object,
parm,
level = 0.95,
method = c("delta", "profile", "impsamp", "wmvrnorm"),
nsim = 1000,
seed,
...
)
Arguments
object |
fitode object |
parm |
character vector specifying model parameters or list of formuals specifying transformations |
level |
the confidence level required |
method |
method for calculating confidence intervals |
nsim |
number of simulations to be used for importance sampling |
seed |
seed |
... |
extra arguments passed to profiling method |
Value
The confidence intervals for model parameters and their transformations of the fitode object
Calculate credible intervals from fitodeMCMC objects for model parameters and their transformations
Description
Calculate credible intervals for model parameters and their transformations from posterior samples.
Usage
## S4 method for signature 'fitodeMCMC'
confint(object, parm, level = 0.95)
Arguments
object |
fitodeMCMC object |
parm |
character vector specifying model parameters or list of formuals specifying transformations |
level |
the credible level required |
Value
The credible intervals of the fitodeMCMC object
Taylor expansion of digamma(a+b) for a>>b
Description
Taylor expansion of digamma(a+b) for a>>b
Usage
dfun(x, y, mag = 1e+08)
Arguments
x |
first argument |
y |
second argument |
mag |
cutoff magnitude for switching approximations |
Value
numeric
Taylor expansion of trigamma(a+b) (?) for a>>b
Description
Taylor expansion of trigamma(a+b) (?) for a>>b
Usage
dfun2(x, y, mag = 1e+08, focal = "x")
Arguments
x |
first argument |
y |
second argument |
mag |
cutoff magnitude for switching approximations |
Value
numeric
Fit ordinary differential equations model
Description
This function fits ordinary differential equations models to a uni- or multi-variate time series by maximum likelihood. It relies on sensitivity equations to compute gradients of the estimated trajectory with respect to model parameters. This allows one to use gradient-based optimization algorithms, which can provide more robust estimation.
Usage
fitode(
model,
data,
start,
tcol = "times",
method = "BFGS",
optimizer = "optim",
link,
fixed = list(),
prior = list(),
prior.density = TRUE,
control = list(maxit = 1e+05),
solver.opts = list(method = "rk4"),
solver = ode,
skip.hessian = FALSE,
force.hessian = FALSE,
use.ginv = TRUE,
quietly = FALSE,
...
)
Arguments
model |
odemodel object |
data |
data frame with a time column and observation columns |
start |
named vector of starting parameter values |
tcol |
(character) time column |
method |
optimization method |
optimizer |
optimizer |
link |
named vector or list of link functions for model parameters |
fixed |
named vector or list of model parameters to fix and their values |
prior |
list of formulas specifying prior distributions |
prior.density |
(logical) should priors represent probability distributions? |
control |
see |
solver.opts |
options for ode integration. See |
solver |
ode solver |
skip.hessian |
skip hessian calculation |
force.hessian |
(logical) calculate the hessian numerically instead of taking the jacobian of the gradients based on sensitivity equations |
use.ginv |
(logical) use generalized inverse ( |
quietly |
suppress progress messages? |
... |
mle2 arguments |
Value
An object of class “fitode” as described in fitode-class
.
See Also
mle2
Class "fitode". Result of ode fitting based on Maximum Likelihood Estimation
Description
Class "fitode". Result of ode fitting based on Maximum Likelihood Estimation
Slots
call
(languge) The call to
fitode
model
odemodel object
data
the time series data
coef
estimated parameters
vcov
estimated variance-covariance matrix
min
minimum negative log-likelihood
mle2
mle2 object
link
list of link functions for model parameters
fixed
list of fixed parameters
prior
list of priors
See Also
mle2-class
Fit ordinary differential equations model using MCMC
Description
This function fits ordinary differential equations models to a uni- or multi-variate time series by MCMC using the Metropolis-Hastings update rule. It searches through the parameter space on link scales, which can provide more efficient posterior sampling.
Usage
fitodeMCMC(
model,
data,
start,
tcol = "times",
proposal.vcov,
prior = list(),
chains = 1,
iter = 2000,
burnin = iter/2,
thin = 1,
refresh = max(iter/10, 1),
prior.only = FALSE,
link,
fixed = list(),
solver.opts = list(method = "rk4"),
solver = ode,
...
)
Arguments
model |
ode model |
data |
data frame with time column and observation column |
start |
named vector of starting parameter values |
tcol |
time column |
proposal.vcov |
variance-covariance matrix of a multivariate normal proposal distribution |
prior |
list of formulas specifying prior distributions |
chains |
(numeric) number of chains |
iter |
(numeric) number of iterations per chain |
burnin |
(numeric) number of burnin interations |
thin |
(numeric) thining interval between consecutive observations |
refresh |
(numeric) refresh interval |
prior.only |
(logical) sample from prior distribution only? |
link |
named vector or list of link functions for model parameters |
fixed |
named vector or list of model parameters to fix and their values |
solver.opts |
options for ode integration. See |
solver |
ode solver |
... |
additional arguments (unused) |
Value
An object of class “fitodeMCMC” as described in fitodeMCMC-class
.
Class "fitodeMCMC". Result of ode fitting based on Markov Chain Monte Carlo (MCMC)
Description
Class "fitodeMCMC". Result of ode fitting based on Markov Chain Monte Carlo (MCMC)
Slots
call
(languge) The call to
fitodeMCMC
model
odemodel object
data
the time series data
coef
estimated parameters (posterior median)
vcov
estimated variance-covariance matrix
mcmc
mcmc.list object containing posterior samples
lp
mcmc.list object containing log-posterior values of posterior samples
link
list of link functions for model parameters
fixed
list of fixed parameters
prior
list of priors
details
a list containing miscellaneous objects for internal uses
Fix parameters of an ODE model
Description
Fix parameters of an ODE model to a constant value by transforming the model (using Transform() function)
Usage
fixpar(model, fixed)
Arguments
model |
odemodel object |
fixed |
named vector or list of model parameters to fix |
S4 generic for computing a gradient
Description
S4 generic for computing a gradient
Usage
grad(object, ...)
Arguments
object |
an |
... |
further arguments passed to methods |
Value
The gradient of the object.
Evaluate the gradient of a likelihood model
Description
Evaluate the gradient of a likelihood model
Usage
## S4 method for signature 'loglik.ode'
grad(object, observation, mean, par, ...)
Arguments
object |
loglik.ode object |
observation |
observations |
mean |
mean values |
par |
additional parameters |
... |
other values if required |
Value
a list with each element as a partial derivative values
Evaluate the gradients of a model
Description
Evaluate the gradients of a model
Usage
## S4 method for signature 'odemodel'
grad(object, state, par)
Arguments
object |
odemodel object |
state |
state |
par |
parameter values |
S4 generic for computing a hessian
Description
S4 generic for computing a hessian
Usage
hessian(object, ...)
Arguments
object |
an |
... |
further arguments passed to methods |
Value
The hessian of the object.
The initializer for loglik.ode
Description
The initializer for loglik.ode
Usage
## S4 method for signature 'loglik.ode'
initialize(
.Object,
name,
model,
observation = "X",
mean,
par = NULL,
keep_grad = TRUE
)
Arguments
.Object |
object |
name |
name of the distribution |
model |
formula specifying the disstribution |
observation |
observation variable name |
mean |
mean variable name |
par |
additional parameter names |
keep_grad |
maintain the gradient as part of the model |
Value
An object of class “loglik.ode” as described in loglik.ode-class
.
Constructor method of "odemodel" class
Description
Constructor method of "odemodel" class
Usage
## S4 method for signature 'odemodel'
initialize(
.Object,
name,
model,
observation,
initial,
par,
link,
diffnames,
keep_sensitivity = TRUE,
call
)
Arguments
.Object |
object |
name |
name of the model |
model |
ode model |
observation |
observation model |
initial |
initial values |
par |
model parameters |
link |
link functions for parameters (log links are used as default) |
diffnames |
optional character vector specifying the names of a variable for which the consecutive difference needs to be calculated |
keep_sensitivity |
(logical) maintain the Jacobian as a part of the model object? |
call |
original function call |
Value
An object of class “odemodel” as described in odemodel-class
.
Examples
SI_model <- odemodel(
name = "SI",
model = list(
S ~ - beta*S*I/N,
I ~ beta*S*I/N - gamma*I
),
observation = list(
susceptible ~ dnorm(mean=S, sd=sigma1),
infected ~ dnorm(mean=I, sd=sigma2)
),
initial = list(
S ~ N * (1 - i0),
I ~ N * i0
),
par = c("beta", "gamma", "N", "i0", "sigma1", "sigma2"),
link = c(i0="logit")
)
the initializer for prior.ode
Description
the initializer for prior.ode
Usage
## S4 method for signature 'prior.ode'
initialize(
.Object,
name,
model,
observation = "X",
par = NULL,
keep_grad = TRUE
)
Arguments
.Object |
object |
name |
name of the distribution |
model |
the formula specifying the model |
observation |
observation variable name |
par |
additional parameter names |
keep_grad |
maintain the gradient as part of the model |
Value
An object of class “prior.ode” as described in prior.ode-class
.
Constructor for solution.ode class
Description
Constructor for solution.ode class
Usage
## S4 method for signature 'solution.ode'
initialize(
.Object,
y,
times,
model,
parms,
solver.opts = list(method = "rk4"),
solver = ode
)
Arguments
.Object |
object |
y |
initial values |
times |
time vector |
model |
ode model |
parms |
parameters of the solution |
solver.opts |
options for ode solver |
solver |
ode solver (must take y, times, func, and parms as arguments) |
Value
An object of class “solution.ode” as described in solution.ode-class
.
S4 generic for computing a jacobian
Description
S4 generic for computing a jacobian
Usage
jacobian(object, ...)
Arguments
object |
an |
... |
further arguments passed to methods |
Value
The jacobian of the object.
Evaluate the jacobian of the gradients
Description
Evaluate the jacobian of the gradients
Usage
## S4 method for signature 'odemodel'
jacobian(object, state, par, type = c("initial", "state", "par"))
Arguments
object |
odemodel object |
state |
state |
par |
parameter values |
type |
state of par? |
Extract log-likelihood
Description
Extract log-likelihood of a fit
Usage
## S4 method for signature 'fitode'
logLik(object)
Arguments
object |
fitode object |
Value
The log-likelihood of the fitode object
Calculate the derivative of the log-likelihood function
Description
Calculate the derivative of the log-likelihood function with respect to model parameters using sensitivity equations and chain rule
Usage
logLik.sensitivity(
parms,
model,
data,
solver.opts = list(method = "rk4"),
solver = ode,
return.NLL = TRUE,
return.traj = FALSE
)
Arguments
parms |
named vector of parameter values |
model |
odemodel object |
data |
data |
solver.opts |
options for the ode solver (see |
solver |
ode solver |
return.NLL |
(logical) return negative log-likelihood |
return.traj |
(logical) return estimated trajectory |
Value
a vector of nll and derivative of nll with respect to model parameters (or a list containing (1) the estimated traejctory and (2) a vector of nll and its derivatives)
Class representing log-likelihood models used to fit ode models
Description
Class representing log-likelihood models used to fit ode models
Slots
name
name of the distribution
expr
an expression specifying the model
observation
observation variable name
mean
mean variable name
par
additional parameter names
grad
the gradient with respect to the parameters
Make a list containing log prior density and its gradient
Description
Make a list containing log prior density and its gradient
Usage
make_prior(model, link, prior, prior.density = TRUE, keep_grad = TRUE)
Arguments
model |
model.ode object |
link |
link |
prior |
list of formulas |
prior.density |
(logical) does this represent a probability density? |
keep_grad |
(logical) keep gradient? |
Calculate the derivative of the mean expression
Description
Calculate the derivative of an expression with respect to model parameters using sensitivity equations and chain rule
Usage
ode.sensitivity(
model,
parms,
times,
solver.opts = list(method = "rk4"),
solver = ode
)
Arguments
model |
odemodel object |
parms |
named vector of parameter values |
times |
time window for which the model should be solved |
solver.opts |
options for the ode solver (see |
solver |
ode solver |
solve ode models
Description
solve ode models
Usage
ode.solve(
model,
times,
parms,
y,
solver.opts = list(method = "rk4"),
solver = ode
)
Arguments
model |
odemodel object |
times |
time vector |
parms |
named vector of parameter values |
y |
initial values |
solver.opts |
options for ode solver |
solver |
ode solver (must take y, times, func, and parms as arguments) |
Value
An object of class “solution.ode” as described in solution.ode-class
.
Class "odemodel" representing ode models
Description
Class "odemodel" representing ode models
Create a new odemodel
Usage
odemodel(...)
Slots
name
name of the model
gfun
gradient function
grad
list of gradients
observation
list of observation models
initial
list of expressions representing the initial values
state
state variables
par
parameters
link
link functions for parameters (log links are used as default)
diffnames
character vector specifying the names of a variable for which the consecutive difference needs to be calculated
call
original function call
jacobian.initial
Jacobian of initial values with respect to its parameters
jacobian.state
Jacobian with respect to its states
jacobian.par
Jacobian with repsect to its parameters
loglik
list of log-likelihood functions
expr
expressions for true trajectories
expr.sensitivity
sensitivity of the expressions with respect to state variables and parameters
keep_sensitivity
(logical) keep sensitivity equations?
Plot a fitode object
Description
Plot a fitode object
Usage
## S4 method for signature 'fitode,missing'
plot(
x,
level,
data,
which,
method = c("delta", "impsamp", "wmvrnorm"),
onepage = TRUE,
xlim,
ylim,
xlabs,
ylabs,
col.traj = "black",
lty.traj = 1,
col.conf = "black",
lty.conf = 4,
add = FALSE,
nsim = 1000,
...
)
Arguments
x |
fitode object |
level |
the confidence level required |
data |
(FIXME) |
which |
which to plot |
method |
confidence interval method |
onepage |
(logical) print all figures on one page? |
xlim |
x coordinates range |
ylim |
y coordinates range |
xlabs |
a label for the x axis |
ylabs |
a label for the y axis |
col.traj |
colour of the estimated trajectory |
lty.traj |
line type of the estimated trajectory |
col.conf |
colour of the confidence intervals |
lty.conf |
line type of the confidence intervals |
add |
add to another plot? |
nsim |
number of simulations for mvrnorm, wmvrnorm methods |
... |
additional arguments to be passed on to the plot function |
Value
No return value, called for side effects
Plot a fitodeMCMC object
Description
Plot a fitodeMCMC object
Usage
## S4 method for signature 'fitodeMCMC,missing'
plot(
x,
level,
data,
which,
onepage = TRUE,
xlim,
ylim,
xlabs,
ylabs,
col.traj = "black",
lty.traj = 1,
col.conf = "black",
lty.conf = 4,
add = FALSE,
...
)
Arguments
x |
fitodeMCMC object |
level |
the confidence level required |
data |
(FIXME) |
which |
which to plot |
onepage |
(logical) print all figures on one page? |
xlim |
x coordinates range |
ylim |
y coordinates range |
xlabs |
a label for the x axis |
ylabs |
a label for the y axis |
col.traj |
colour of the estimated trajectory |
lty.traj |
line type of the estimated trajectory |
col.conf |
colour of the confidence intervals |
lty.conf |
line type of the confidence intervals |
add |
add to another plot? |
... |
additional arguments to be passed on to the plot function |
Value
No return value, called for side effects
Internal function for plotting methods
Description
Internal function for plotting methods
Usage
plot_internal(
pred,
data,
onepage = TRUE,
xlim,
ylim,
xlabs,
ylabs,
col.traj = "black",
lty.traj = 1,
col.conf = "black",
lty.conf = 4,
add = FALSE,
...
)
Arguments
pred |
prediction objects |
data |
observed data |
onepage |
(logical) print all figures on one page? |
xlim |
x coordinates range |
ylim |
y coordinates range |
xlabs |
a label for the x axis |
ylabs |
a label for the y axis |
col.traj |
colour of the estimated trajectory |
lty.traj |
line type of the estimated trajectory |
col.conf |
colour of the confidence intervals |
lty.conf |
line type of the confidence intervals |
add |
add to another plot? |
... |
additional arguments to be passed on to the plot function |
Prediction function for fitode objects
Description
Computes estimated trajectories and their confidence intervals (using either the delta method or importance sampling).
Usage
## S4 method for signature 'fitode'
predict(
object,
level,
times,
method = c("delta", "impsamp", "wmvrnorm"),
nsim = 1000
)
Arguments
object |
fitode object |
level |
the confidence level required |
times |
time vector to predict over. Default is set to the time frame of the data. |
method |
confidence interval method. Default is set to Delta method. |
nsim |
number of simulations for mvrnorm, wmvrnorm methods |
Value
The estimated trajectories and their confidence intervals of the fitode object
Prediction function for fitodeMCMC objects
Description
Computes estimated trajectories and their credible intervals. The estimated trajectories are obtained by taking the median trajectories from the posterior samples.
Usage
## S4 method for signature 'fitodeMCMC'
predict(object, level, times, simplify = TRUE)
Arguments
object |
fitodeMCMC object |
level |
the credible level required |
times |
time vector to predict over. Default is set to the time frame of the data. |
simplify |
(logical) simplify output to return estimated trajectories and their
credible intervals? If |
Value
Estimated trajectories and their credible intervals of the fitodeMCMC object
Class representing prior models used to fit ode models
Description
Class representing prior models used to fit ode models
Slots
name
name of the distribution
expr
an expression specifying the model
observation
observation variable name
par
additional parameter names
keep_grad
keep gradient?
grad
the gradient with respect to the parameters
Profile fitode objects
Description
Profile fitode objects
Usage
## S4 method for signature 'fitode'
profile(fitted, which = 1:p, alpha = 0.05, trace = FALSE, ...)
Arguments
fitted |
fitted model object |
which |
which parameter(s) to profile? (integer value) |
alpha |
critical level |
trace |
trace progress of computations? |
... |
additional arguments passed to mle2 profiling method |
Value
The log-likelihood profile of the fitode object
Select a log-likelihood model
Description
Select a log-likelihood model
Usage
select_model(
dist = c("ols", "dnorm", "dnorm2", "dpois", "dnbinom", "dnbinom1", "dgamma",
"dlnorm")
)
Arguments
dist |
conditional distribution of reported data (dnorm, dnorm2, dpois, dnbinom, dnbinom1, dgamma) |
Select a prior model
Description
Select a prior model
Usage
select_prior(
family = c("dnorm", "dgamma", "dbeta", "dlnorm"),
link = c("identity", "log", "logit"),
prior.density = TRUE,
keep_grad = TRUE
)
Arguments
family |
prior distribution type |
link |
link |
prior.density |
(logical) keep the Jacobian of transformations? |
keep_grad |
(logical) keep gradients? |
Set up link functions for model parameters
Description
Set up link functions for model parameters – for fitode
internal usage; assumes log-link by default if link functions are
not specified
Usage
set_link(link, par)
Arguments
link |
named list or vector of strings specifying link functions |
par |
(character) model parameters |
Value
list of strings specifying link functions for each model parameter
See Also
Show fitode objects
Description
Show fitode objects
Usage
## S4 method for signature 'fitode'
show(object)
Arguments
object |
fitode object |
Value
No return value, called for side effects
Show fitodeMCMC object
Description
Show fitodeMCMC object
Usage
## S4 method for signature 'fitodeMCMC'
show(object)
Arguments
object |
fitodeMCMC object |
Value
No return value, called for side effects
Show the model
Description
Show the model
Usage
## S4 method for signature 'odemodel'
show(object)
Arguments
object |
odemodel object |
Value
No return value, called for side effects
simulate fitode objects
Description
simulate fitode objects
Usage
## S4 method for signature 'fitode'
simulate(object, nsim = 1, seed = NULL, times, parms, y, observation = TRUE)
Arguments
object |
fitode object |
nsim |
number of simulations |
seed |
random-number seed |
times |
time vector |
parms |
named vector of parameter values |
y |
initial values |
observation |
(logical) propagate observation error? |
Value
The numerical simulation of the object
simulate model objects
Description
simulate model objects
Usage
## S4 method for signature 'odemodel'
simulate(
object,
nsim = 1,
seed = NULL,
times,
parms,
y,
solver.opts = list(method = "rk4"),
solver = ode,
observation = TRUE
)
Arguments
object |
odemodel object |
nsim |
number of simulations |
seed |
random-number seed |
times |
time vector |
parms |
named vector of parameter values |
y |
initial values |
solver.opts |
options for ode solver |
solver |
ode solver (must take y, times, func, and parms arguments) |
observation |
(logical) propagate observation error? |
Value
The numerical simulation of the object
Internal function for simulation models
Description
Simulates deterministic trajectories and propagates observation error
Usage
simulate_internal(
model,
times,
parms,
y,
solver.opts = list(method = "rk4"),
solver = ode,
observation = TRUE,
nsim = 1,
seed = NULL
)
Arguments
model |
odemodel object |
times |
time vector |
parms |
named vector of parameter values |
y |
initial values |
solver.opts |
options for ode solver |
solver |
ode solver (must take y, times, func, and parms arguments) |
observation |
(logical) propagate observation error? |
nsim |
number of simulations |
seed |
seed |
Class "solution.ode". Result of solving ode modeld with/without sensitivity equations
Description
Class "solution.ode". Result of solving ode modeld with/without sensitivity equations
Slots
name
name of the model
y
initial values
times
time vector
model
ode model
parms
parameters of the solution
solution
solution of the model
sensitivity
partial derivative of each state variable with respect to the parameters
Extract standard error from fitode objects
Description
Calculates standard error by taking the square root of the diagonal matrix
Usage
## S4 method for signature 'fitode'
stdEr(x, type = c("response", "links"))
Arguments
x |
fitode object |
type |
type of standard error. The default ( |
Value
The standard error of the fitode object
Extract standard error from fitodeMCMC objects
Description
Calculates standard error by taking the square root of the diagonal of the variance-covariance matrix
Usage
## S4 method for signature 'fitodeMCMC'
stdEr(x)
Arguments
x |
fitodeMCMC object |
Value
The standard error of the fitodeMCMC object
Summarize fitode object
Description
Summarize fitode objects; returns estimate, standard error, and confidence intervals
Usage
## S4 method for signature 'fitode'
summary(object)
Arguments
object |
fitode object |
Value
The summary of the fitode object
Summarize fitodeMCMC object
Description
Summarize fitodeMCMC object; returns estimate, standard error, credible intervals, effective sample sizes, and gelman-rubin diagnostic
Usage
## S4 method for signature 'fitodeMCMC'
summary(object)
Arguments
object |
fitodeMCMC object |
Value
The summary of the fitodeMCMC object
See Also
effectiveSize
gelman.diag
Tumor growth data
Description
...
Usage
tumorgrowth
Format
A data frame containing 14 rows comprising:
- day
- volume
Update fitode fits
Description
Update fitode fits
Usage
## S4 method for signature 'fitode'
update(object, observation, initial, par, link, ...)
Arguments
object |
fitode objects |
observation |
observation model |
initial |
initial values |
par |
model parameters |
link |
link functions for parameters (log links are used as default) |
... |
additional arguments to be passed to fitode |
Value
An object of class “fitode” as described in fitode-class
.
Update fitodeMCMC fits
Description
Update fitodeMCMC fits
Usage
## S4 method for signature 'fitodeMCMC'
update(object, observation, initial, par, link, ...)
Arguments
object |
fitodeMCMC objects |
observation |
observation model |
initial |
initial values |
par |
model parameters |
link |
link functions for parameters (log links are used as default) |
... |
additional arguments to be passed to fitode |
Value
An object of class “fitode” as described in fitodeMCMC-class
.
Extract variance-covariance matrix from fitode objects
Description
Extracts variance-covariance matrix (either on response scales or link scales)
Usage
## S4 method for signature 'fitode'
vcov(object, type = c("response", "links"))
Arguments
object |
fitode object |
type |
type of covariance matrix. The default ( |
Value
The variance-covariance matrix of the fitode object
Extract variance-covariance matrix from fitodeMCMC objects
Description
Calculates variance-covariance matrix from posterior samples
Usage
## S4 method for signature 'fitodeMCMC'
vcov(object)
Arguments
object |
fitodeMCMC object |
Value
The variance-covariance matrix of the fitodeMCMC object