powered by
Plot original series plus dashed lines for in‑sample adjustment and optional out‑of‑sample predictions.
plot_ts_pred( x = NULL, y, yadj, ypred = NULL, label_x = "", label_y = "", color = "black", color_adjust = "blue", color_prediction = "green" )
returns a ggplot2::ggplot graphic
time index (numeric vector) or NULL to use 1:length(y)
numeric time series
fitted/adjusted values for the training window
optional predicted values after the training window
x‑axis title
y‑axis title
color for the original series
color for the adjusted values (dashed)
color for the predictions (dashed)
yadj length defines the training segment; ypred (if provided) is appended after yadj.
yadj
ypred
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, ypred=prediction) plot(grf)
Run the code above in your browser using DataLab