plotPosteriorFit | R Documentation |
Plot posterior distribution of observation generated under model's posterior parameter distribution.
plotPosteriorFit(
trace,
fitmodel,
initState,
data,
posteriorSummary = c("sample", "median", "mean", "max"),
summary = TRUE,
sampleSize = 100,
nonExtinct = NULL,
alpha = min(1, 10/sampleSize),
plot = TRUE,
allVars = FALSE,
initDate = NULL
)
trace |
a |
fitmodel |
a |
initState |
named numeric vector. Initial values of the state
variables. Names should match |
data |
data frame. Observation times and observed data. The time column
must be named |
posteriorSummary |
character. Set to |
summary |
logical, if |
sampleSize |
number of theta sampled from posterior distribution (if
|
nonExtinct |
character vector. Names of the infected states which must
be non-zero so the epidemic is still ongoing. When the names of these
states are provided, the extinction probability is plotted by computing the
proportion of faded-out epidemics over time. An epidemic has faded-out
when all the infected states (whose names are provided) are equal to 0.
This is only relevant for stochastic models. In addition, if |
alpha |
transparency of the trajectories (between 0 and 1). |
plot |
if |
allVars |
logical, if |
initDate |
character. Date of the first point of the time series
(default to |
If plot == FALSE
, a list of 2 elements is returned:
theta
the theta
(s) used for plotting (either a
vector
or a data.frame
)
traj
a data.frame
with the trajectories (and
observations) sampled from the posterior distribution.
plot
the plot of the fit displayed.
data(fluTdc1971)
data(epi)
data(mcmcEpi)
data(models)
initState <- c(S = 999, I = 1, R = 0)
plotPosteriorFit(
trace = mcmcEpi1, fitmodel = sirDeter, initState = initState,
data = epi1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.