
Plot of k-step predictions from a ctsmTMB prediction object
Source:R/S3_plot.R
plot.ctsmTMB.pred.RdPlot of k-step predictions from a ctsmTMB prediction object
Usage
# S3 method for class 'ctsmTMB.pred'
plot(
x,
y = NULL,
plot.series.i = 0,
type = c("states", "observations", "both"),
state.name = attributes(pred)$state.names[1],
obs.name = attributes(pred)$obs.names[1],
against.obs = NULL,
ggtheme = getggplot2theme(),
...
)Arguments
- x
a ctsmTMB.pred object
- y
not used
- plot.series.i
an integer determining with prediction series to plot, corresponding to the index ".i" in the prediction data.frame.
- type
which series to plot (states, observations or both of those).
- state.name
the name of the state variable to plot
- obs.name
the name of the observation variable to plot
- against.obs
the name of the observations variable whose data series to plot against.
- ggtheme
a ggplot2 theme to use for the plots.
- ...
additional arguments
Examples
if (FALSE) { # \dontrun{
data(Ornstein)
df <- Ornstein
model <- create.Ornstein1D.model()
# Given a prediction
pred <- model$predict(df, k.ahead=100)
# plot the first series (starting from the posterior at i=0)
plot(pred)
# We can also plot the observations instead, and compare with the data
plot(pred, type="obs", against.obs="y")
# or plot a later series (startering from the posterior at i=50), for both obs and state
plot(pred, type="both", against.obs="y", plot.series.i=50)
} # }