View source: R/forecast.rlgtfit.R
forecast.rlgtfit | R Documentation |
produce forecasts from an rlgtfit
object
## S3 method for class 'rlgtfit'
forecast(
object,
xreg = NULL,
h = ifelse(frequency(object$x) > 1, 2 * frequency(object$x), 10),
level = c(80, 95),
NUM_OF_TRIALS = 2000,
...
)
object |
rlgtfit object |
xreg |
input regression matrix |
h |
forecasting horizon (the default is 10 for annual and 2*periods otherwise) |
level |
confidence levels for prediction intervals a.k.a. coverage percentiles. Musat be between 0 and 100. |
NUM_OF_TRIALS |
number of simulations to run. Suggested range is between (1000,5000), but it needs to be higher for good coverage for very high levels, e.g. 99.8. |
... |
currently not used |
returns a forecast object compatible with the forecast package in R
# The following is a toy example that runs within a few seconds. To get good
# fitting results the number of iterations should be set to at least 2000, and
# 4 chains should be used (the default). To speed up computation the number of
# cores should also be adjusted (default is 4).
rlgt_model <- rlgt(lynx,
control=rlgt.control(MAX_NUM_OF_REPEATS=1, NUM_OF_ITER=50, NUM_OF_CHAINS = 1,
NUM_OF_CORES = 1), verbose=TRUE)
# print the model details
print(rlgt_model)
# Produce Forecasts for the next 10 years
forecast_result <- forecast(rlgt_model, h = 10, level=c(80, 95, 98))
plot(forecast_result,main="Forecasting lynx dataset with LGT model")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.