fitmodel.Rd
A fitmodel
object is a list
that stores some variables and
functions that will be useful to simulate and fit your model during the
course.
fitmodel(
name = NULL,
stateNames = NULL,
thetaNames = NULL,
simulate = NULL,
rPointObs = NULL,
dPrior = NULL,
dPointObs = NULL
)
character. Name of the model (required).
character vector. Names of the state variables i.e.
c("S","I","R")
(required).
character vector. Names of the parameters i.e.
c("R_0","infectiousPeriod")
(required).
R-function to simulate forward the model (required). This function takes 3 arguments:
theta
named numeric vector. Values of the parameters. Names
should match thetaNames
.
initState
named numeric vector. Initial values of the state
variables. Names should match stateNames
.
times
numeric vector. Time sequence for which the state of the
model is wanted; the first value of times must be the initial time, i.e.
the time of initState
.
and returns a data.fame
containing the simulated trajectories that is
the values of the state variables (1 per column) at each observation time
(1 per row). The first column is time
.
R-function that generates a (randomly sampled) observation
point from a model point, using an observation model (optional). It thus
acts as an inverse of dPointObs
(see below). This function takes 2
arguments
modelPoint
named numeric vector. State of the model at a given
point in time.
theta
named numeric vector. Values of the parameters. Names
should match thetaNames
.
and returns an observation point
R-function that evaluates the prior density of the parameters
at a given theta
(optional). The function should take 2 arguments:
theta
named numeric vector. Values of the parameters. Names
should match thetaNames
.
log
boolean. determines whether the logarithm of the prior
density should be returned.
and returns the (logged, if requested) value of the prior density distribution.
R-function that evaluates the likelihood of one data point given the state of the model at the same time point. This function takes 4 arguments:
dataPoint
named numeric vector. Observation time and observed
data point.
modelPoint
named numeric vector containing the state of the
model at the observation time point.
theta
named numeric vector. Parameter values. Useful since
parameters are usually needed to compute the likelihood (i.e. reporting
rate).
log
boolean. determines whether the logarithm of the likelihood
should be returned.
and returns the (log-)likelihood. (optional)
a fitmodel
object that is a list
of 7 elements:
name
character, name of the model
stateNames
vector, names of the state variables.
thetaNames
vector, names of the parameters.
simulate
R-function to simulate forward the model; usage:
simulate(theta,initState,times)
.
rPointObs
R-function to generate simulated observations;
usage: rPointObs(modelPoint, theta)
.
dPrior
R-function to evaluate the log-prior of the parameter
values; usage: dPrior(theta)
.
dPointObs
R-function to evaluate the log-likelihood of one
data point; usage: dPointObs(dataPoint, modelPoint, theta, log)
.