predict.decomposition {VisitorCounts} | R Documentation |
Predict Decomposition
Description
Methods for generating predictions from objects of the class "decomposition".
Usage
## S3 method for class 'decomposition'
predict(object, n_ahead, only_new = TRUE, ...)
Arguments
object |
An object of class "decomposition". |
n_ahead |
An integer describing the number of forecasts to make. |
only_new |
A Boolean describing whether or not to include past values. |
... |
Additional arguments. |
Value
forecasts |
A vector with overall forecast values. |
trend_forecasts |
A vector with trend forecast values. |
seasonality_forecasts |
A vector with seasonality forecast values. |
Examples
data("park_visitation")
suspected_periods <- c(12,6,4,3)
proportion_of_variance_type = "leave_out_first"
max_proportion_of_variance <- 0.995
log_ratio_cutoff <- 0.2
park <- "DEVA"
nps_ts <- ts(park_visitation[park_visitation$park == park,]$nps, start = 2005, freq = 12)
nps_ts <- log(nps_ts)
pud_ts <- ts(park_visitation[park_visitation$park == park,]$pud, start = 2005, freq = 12)
pud_ts <- log(pud_ts)
nps_ts <- ts(park_visitation[park_visitation$park == park,]$nps, start = 2005, freq = 12)
nps_ts <- log(nps_ts)
decomp_pud <- auto_decompose(pud_ts,
suspected_periods,
proportion_of_variance_type = proportion_of_variance_type,
max_proportion_of_variance,
log_ratio_cutoff)
n_ahead = 36
pud_predictions <- predict(decomp_pud,n_ahead = n_ahead, only_new = FALSE)
[Package VisitorCounts version 2.0.0 Index]