Generates future predictions of the time series from an inzightts object. The output object includes predicted means, prediction intervals, raw data, and fitted values.

# S3 method for inz_ts
predict(
  object,
  var = NULL,
  h = 8,
  mult_fit = FALSE,
  pred_model = "auto",
  confint_width = 0.95,
  model_range = NULL,
  ...
)

# S3 method for inz_frct
plot(x, t_range = NULL, xlab = NULL, ylab = NULL, title = NULL, ...)

Arguments

object

An inzightts object representing the time series.

var

A character vector specifying the variable(s) to forecast, or set to NULL to forecast all variables.

h

The forecast horizon, either the number of observations to predict, or a character string specifying the time interval to predict (e.g., "2 years").

mult_fit

Logical; set to TRUE for a multiplicative model, or FALSE for the default additive model.

pred_model

The name of a fable model function or "auto".

confint_width

A decimal representing the width of the prediction interval.

model_range

The range of data to be used for fitting forecasts, specified as dates or years.

...

Additional arguments (ignored).

x

An inz_frct object containing the forecasts.

t_range

The range of data to be plotted, specified as dates or years.

xlab

A title for the x-axis of the plot.

ylab

A title for the y-axis of the plot.

title

A title for the graph.

Value

An inz_frct object containing the forecasts.

See also

Examples

t <- inzightts(visitorsQ, var = c(2, 4))
## The following two examples are equivalent
pred <- predict(t, names(t)[-1], h = "2 years")
pred <- predict(t, names(t)[-1], h = 8)

if (FALSE) {
plot(pred)
}