plot_ts_pred {daltoolbox} | R Documentation |
Plot a time series chart with predictions
Description
This function plots a time series chart with three lines: the original series, the adjusted series, and the predicted series using ggplot2.
Usage
plot_ts_pred(
x = NULL,
y,
yadj,
ypred = NULL,
label_x = "",
label_y = "",
color = "black",
color_adjust = "blue",
color_prediction = "green"
)
Arguments
x |
time index |
y |
time series |
yadj |
adjustment of time series |
ypred |
prediction of the time series |
label_x |
x-axis title |
label_y |
y-axis title |
color |
color for the time series |
color_adjust |
color for the adjusted values |
color_prediction |
color for the predictions |
Value
returns a ggplot2::ggplot graphic
Examples
x <- base::seq(0, 10, 0.25)
yvalues <- sin(x) + rnorm(41,0,0.1)
adjust <- sin(x[1:35])
prediction <- sin(x[36:41])
grf <- plot_ts_pred(y=yvalues, yadj=adjust, ypre=prediction)
plot(grf)
[Package daltoolbox version 1.2.727 Index]