Usage
ctStanKalmanPlot(x, subjects, kalmanvec = c("y", "yprior"), errorvec = "auto", errormultiply = 2, ltyvec = "auto", colvec = "auto", lwdvec = "auto", subsetindices = NULL, pchvec = "auto", typevec = "auto", grid = TRUE, add = FALSE, plotcontrol = list(ylab = "Value", xlab = "Time"), polygoncontrol = list(border = NA), polygonalpha = 0.1, legend = TRUE, legendcontrol = list(x = "topright", bg = "white"))
Arguments
x
Output from ctStanKalman
. In general it is easier to call
ctStanKalman
directly with the plot=TRUE
argument, which calls this function. subjects
vector of integers denoting which subjects (from 1 to N) to plot predictions for.
kalmanvec
string vector of names of any elements of the output you wish to plot,
the defaults of 'y' and 'yprior' plot the original data, 'y',
and the prior from the Kalman filter for y. Replacing 'y' by 'eta' will
plot latent variables instead (though 'eta' alone does not exist) and replacing 'prior'
with 'upd' or 'smooth' respectively plotting updated (conditional on all data up to current time point)
or smoothed (conditional on all data) estimates.
errorvec
vector of names of covariance elements to use for uncertainty indication
around the kalmanvec items. 'auto' includes the latent covariance when plotting
latent states, and total covariance when plotting expectations of observed states.
errormultiply
Numeric denoting the multiplication factor of the std deviation of errorvec objects.
Defaults to 1.96, for 95% credible intervals.
ltyvec
vector of line types, varying over dimensions of the kalmanvec object.
colvec
color vector, varying either over subject if multiple subjects, or otherwise over
the dimensions of the kalmanvec object.
lwdvec
vector of line widths, varying over the kalmanvec objects.
subsetindices
Either NULL, or vector of integers to use for subsetting the (columns) of kalmanvec objects.
pchvec
vector of symbol types, varying over the dimensions of the kalmanvec object.
typevec
vector of plot types, varying over the kalmanvec objects. 'auto' plots lines for
any 'prior', 'upd', or 'smooth' objects, and points otherwise.
grid
Logical. Plot a grid?
add
Logical. Create a new plot or update existing plot?
plotcontrol
List of graphical arguments (see par
),
though lty,col,lwd,x,y, will all be ignored. polygoncontrol
List of arguments to the polygon
function for filling the uncertainty region. polygonalpha
Numeric for the opacity of the uncertainty region.
legend
Logical, whether to include a legend if plotting.
legendcontrol
List of arguments to the legend
function.