This function is used to predict future observations based on a tsd_onset
object.
It uses the time_interval
attribute from the tsd_onset
object to make predictions.
Usage
# S3 method for class 'tsd_onset'
predict(object, n_step = 3, ...)
Arguments
- object
A
tsd_onset
object created using theseasonal_onset()
function.- n_step
An integer specifying the number of future time steps for which you want to predict observations.
- ...
Additional arguments (not used).
Value
A tibble-like object called tsd_predict
containing the predicted observations, including reference time,
lower confidence interval, and upper confidence interval for the specified number of future time steps.
Examples
# Generate predictions of time series data
set.seed(123)
time_series <- generate_seasonal_data(
years = 1,
time_interval = "day"
)
# Apply `seasonal_onset` analysis
time_series_with_onset <- seasonal_onset(
tsd = time_series,
k = 7
)
# Predict observations for the next 7 time steps
predict(object = time_series_with_onset, n_step = 7)
#> # A tibble: 8 × 5
#> t reference_time estimate lower upper
#> <int> <date> <dbl> <dbl> <dbl>
#> 1 0 2022-05-25 100 100 100
#> 2 1 2022-05-26 102. 98.0 106.
#> 3 2 2022-05-27 104. 96.1 112.
#> 4 3 2022-05-28 106. 94.2 118.
#> 5 4 2022-05-29 107. 92.3 125.
#> 6 5 2022-05-30 109. 90.5 132.
#> 7 6 2022-05-31 111. 88.7 140.
#> 8 7 2022-06-01 113. 87.0 148.