The point of detecting a regime change is usually that the earlier
regime should no longer inform what happens next. predict() on a
ggcpt forecasts from one segment only (by default the last), with
the segment's own model.
Usage
# S3 method for class 'ggcpt'
predict(
object,
newdata = NULL,
h = 1,
segment = "last",
models = NULL,
level = 0.95,
...
)Arguments
- object
A
ggcptobject.- newdata
Optional data frame of covariates (for a formula fit, or a segment model with covariates), or of
timepositions.- h
Forecast horizon, when
newdatais not given: the positionsn + 1ton + h. Defaults to1.- segment
Which segment to forecast from:
"last"(the default) or a segment number.- models
Optional
cpt_segment_models()result; built with its defaults when omitted.- level
Level of the prediction interval. Defaults to
0.95.- ...
Further arguments for the model's
predict()method.
Value
A tibble with time (when forecasting by horizon),
.pred, and .lower/.upper when the model supplies
a prediction interval.
See also
Other segment models:
cpt_segment_models()
