Plot the observation series along with many other customizable options.

plot_series(fit, r = NULL, features = NULL,
  stateProbability = "smoothed", stateProbabilityFunction = median,
  chain = 1, main = NULL, xlab = NULL, ylab = NULL,
  addLegend = TRUE, legend.cex = 1, ...)

Arguments

fit

An object returned by either draw_samples or optimizing.

r

An optional numeric vector with the numbers of the dimensions of the observation vector to be plotted. It defaults to plotting all variables.

features

An optional vector of character strings with the names of the features to include in the plot. These may be stateShade (shaded background), yColoredLine (colored observation line), yColoredDots (colored observation dots), bottomColoredMarks (colored marks on the lower axis), topColoredMarks (colored marks on the top axis). All colors are based on the hidden state assigned to each time step using the stateProbability quantity. Note that more than one feature may be plotted at the same time. It allows for partial matching. It defaults to none.

stateProbability

An optional character string with the name of the quantity used to classify the observations (either filtered, smoothed, or viterbi). It allows for partial matching. It defaults to the smoothed probability.

stateProbabilityFunction

An optional function applied to the samples corresponding to one time step t, one hidden state k. The observation at time step t is then assigned to the hidden state with largest value. Note that the user needs to supply a function as an argument, and not a character string with the name of the function. It defaults to the median function.

chain

An optional integer number between 1 and the number of chains M. Only the samples generated by the selected chain are considered. It defaults to the first chain.

main

An optional character string with the overall title for the plot.

xlab

An optional character string with the title for the horizontal axis.

ylab

An optional character string with the title for the vertical axis.

addLegend

An optional boolean indicating whether a legend should be included.

legend.cex

A numerical value giving the amount by which plotting legend text and symbols should be magnified relative to the default. It defaults to one.

...

Arguments to be passed to the plot function.

See also

Examples

# NOT RUN {
plot_series(
  myFit,
  features = c("stateShade", "yColoredLine", "bottomColoredMarks")
)
# }