Plots Kalman filter output from ctKalman.
ctKalmanPlot(x, subjects, kalmanvec = c("y", "etaprior"),
errorvec = "auto", errormultiply = 1.96, ltyvec = "auto",
colvec = "auto", lwdvec = "auto", subsetindices = NULL,
pchvec = "auto", typevec = "auto", grid = FALSE, add = FALSE,
plotcontrol = list(ylab = "Value", xlab = "Time", xaxs = "i"),
polygoncontrol = list(steps = 20), polygonalpha = 0.3,
legend = TRUE, legendcontrol = list(x = "topright", bg = "white"))
vector of integers denoting which subjects (from 1 to N) to plot predictions for.
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.
vector of names of covariance elements to use for uncertainty indication around the kalmanvec items. 'auto' uses the latent covariance when plotting latent states, and total covariance when plotting expectations of observed states. Use NA to skip uncertainty plotting.
Numeric denoting the multiplication factor of the std deviation of errorvec objects. Defaults to 1.96, for 95% intervals.
vector of line types, varying over dimensions of the kalmanvec object.
color vector, varying either over subject if multiple subjects, or otherwise over the dimensions of the kalmanvec object.
vector of line widths, varying over the kalmanvec objects.
Either NULL, or vector of integers to use for subsetting the (columns) of kalmanvec objects.
vector of symbol types, varying over the dimensions of the kalmanvec object.
vector of plot types, varying over the kalmanvec objects. 'auto' plots lines for any 'prior', 'upd', or 'smooth' objects, and points otherwise.
Logical. Plot a grid?
Logical. Create a new plot or update existing plot?
List of graphical arguments (see par
),
though lty,col,lwd,x,y, will all be ignored.
List of arguments to the ctPoly
function for filling the uncertainty region.
Numeric for the opacity of the uncertainty region.
Logical, whether to include a legend if plotting.
List of arguments to the legend
function.
Nothing. Generates plots.
# NOT RUN {
### Get output from ctKalman
x<-ctKalman(ctstantestfit,subjects=2)
### Plot with ctKalmanPlot
ctKalmanPlot(x, subjects=2)
###Single step procedure:
ctKalman(ctstantestfit,subjects=2,plot=TRUE)
# }
Run the code above in your browser using DataLab