FcBayesianStructuralTimeSeries: Forecasting with Bayesian Structural Time Series

View source: R/FcBayesianStructuralTimeSeries.R

FcBayesianStructuralTimeSeriesR Documentation

Forecasting with Bayesian Structural Time Series

Description

Forecasting with Bayesian Structural Time Series

Usage

FcBayesianStructuralTimeSeries(DataVec, SplitAt, Time, Frequency = "months", ForecastHorizon, nseasons = 12, niter = 250, burn = 100, PlotIt=FALSE)

Arguments

DataVec

[1:n] numerical vector of time series data.

SplitAt

Index of row where the DataVec is divided into test and train data. If not given n is used

Time

[1:n] character vector of Time in the length of data

Frequency

Either days, weeks, months or quarters or years, see ConvertNumerical2TSobject.

nseasons

Optional, number of seasons. See AddSeasonal

niter

Optional, number of Iterations. See bsts

burn

Optional, Number of MCMC iterations to be discarded as burn-in. See predict.bsts

PlotIt

FALSE (default), do nothing. TRUE: plots the forecast versus test data of time series data.

Details

Wrapper for functions of the bsts package.

Value

List with

Forecast

[1:ForecastHorizon] forecasted values

ForecastTime

[1:ForecastHorizon] Time values of forecasts

UpperLower

[1:2,1:ForecastHorizon] matrix of upper and lower bounds of the credible interval for the prediction, see predict.bsts

ModelPrediction

Object of class predict of bsts package, see predict.bsts

Model

Model object of class bsts, see bsts

Note

doku to be written...

Author(s)

Michael Thrun

References

[Scott/Varian, 2014] Scott, S. L., & Varian, H. R.: Predicting the present with bayesian structural time series, International Journal of Mathematical Modelling and Numerical Optimisation, Vol. 5(1-2), pp. 4-23. 2014.

See Also

bsts

Examples


data("AirPassengers")
AirPassengers=TSAT::ConvertTS2DF(AirPassengers)
ff=FcBayesianStructuralTimeSeries(log(AirPassengers$Data),AirPassengers$Time,SplitDataAt=144-12,PlotIt=TRUE)

##New Data
data("AirPassengers")
AirPassengers=TSAT::ConvertTS2DF(AirPassengers)

ff=FcBayesianStructuralTimeSeries(log(AirPassengers$Data),AirPassengers$Time,SplitDataAt=144,PlotIt=TRUE)

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.