predict.visitation_model {VisitorCounts} | R Documentation |
Predict Visitation Model
Description
Methods for generating predictions from objects of the class "visitation_model".
Usage
## S3 method for class 'visitation_model'
predict(
object,
n_ahead,
only_new = TRUE,
past_observations = c("fitted", "reference"),
...
)
Arguments
object |
An object of class "visitation_model". |
n_ahead |
An integer indicating how many observations to forecast. |
only_new |
A Boolean specifying whether to include only the forecasts (if TRUE) or the full reconstruction (if FALSE). The default option is TRUE. |
past_observations |
A character string; one of "fitted" or "reference". Here, "fitted" uses the fitted values of the visitation model, while "reference" uses values supplied in ‘ref_series’. |
... |
Additional arguments. |
Value
A predictions for the automatic decomposition.
forecasts |
A vector with forecast values. |
n_ahead |
A numeric that shows the number of steps ahead. |
proxy_forecasts |
A vector for the proxy of trend forecasts. |
onsite_usage_forecasts |
A vector for the visitation forecasts. |
beta |
A numeric for the seasonality adjustment factor. |
constant |
A numeric for the value of the constant in the model. |
slope |
A numeric for the value of the slope term in the model when trend is set to "linear". |
criterion |
A string which specifies the method used to select the appropriate lag. Only applicable if the trend component is part of the forecasts. |
past_observations |
A vector which specifies the fitted values for the past observations. |
lag_estimate |
A numeric for the estimated lag. Only applicable if the trend component is part of the forecasts. |
Examples
data("park_visitation")
data("flickr_userdays")
n_ahead <- 36
park <- "ROMO"
pud_ts <- ts(park_visitation[park_visitation$park == park,]$pud, start = 2005, frequency = 12)
pud_ts <- log(pud_ts)
nps_ts <- ts(park_visitation[park_visitation$park == park,]$nps, start = 2005, frequency = 12)
nps_ts <- log(nps_ts)
popularity_proxy <- log(flickr_userdays)
vm <- visitation_model(pud_ts,popularity_proxy, ref_series = nps_ts, trend = "linear")
predict_vm <- predict(vm,n_ahead,
only_new = FALSE, past_observations = "reference")
plot(predict_vm, )
predict_vm2 <- predict(vm,n_ahead,
only_new = FALSE, past_observations = "reference")
plot(predict_vm2)