plotTimeSeriesResults {BayesianTools} | R Documentation |
Creates a time series plot typical for an MCMC / SMC fit
Description
Creates a time series plot typical for an MCMC / SMC fit
Usage
plotTimeSeriesResults(
sampler,
model,
observed,
error = NULL,
plotResiduals = TRUE,
start = 1,
prior = FALSE,
...
)
Arguments
sampler |
Either a) a matrix b) an MCMC object (list or not), or c) an SMC object |
model |
function that calculates model predictions for a given parameter vector |
observed |
observed values as vector |
error |
function with signature f(mean, par) that generates observations with error (error = stochasticity according to what is assumed in the likelihood) from mean model predictions. Par is a vector from the matrix with the parameter samples (full length). f needs to know which of these parameters are parameters of the error function. See example in |
plotResiduals |
logical determining whether residuals should be plotted |
start |
numeric start value for the plot (see |
prior |
if a prior sampler is implemented, setting this parameter to TRUE will draw model parameters from the prior instead of the posterior distribution |
... |
further arguments passed to |
Author(s)
Florian Hartig
See Also
Examples
# Create time series
ts <- VSEMcreatePAR(1:100)
# create fake "predictions"
pred <- ts + rnorm(length(ts), mean = 0, sd = 2)
# plot time series
par(mfrow=c(1,2))
plotTimeSeries(observed = ts, main="Observed")
plotTimeSeries(observed = ts, predicted = pred, main = "Observed and predicted")
par(mfrow=c(1,1))