predict.BSTS.Rd
This function predicts the time series based on a trained BSTS model, i.e. a fitted "hanaml.BSTS" object.
# S3 method for BSTS
predict(model, data = NULL, key = NULL, exog = NULL, horizon = NULL)
R6Class object
A "hanaml.BSTS" object for prediction.
DataFrame
Input DataFrame containing the time-series data for BSTS prediction.
character
The ID column that representing the order of time-series values in data
.
character or list of characters, optional
An optional array of exogenous variables.
integer, optional
Number of predictions for future observations.
Defaults to 1.
Named list of DataFrames
result: DataFrame containing the forecast values and other related statistics(like standard error estimation, upper/lower quantiles).
components: DataFrame containing the trend/seasonal/regression components w.r.t. the forecast values.
Assuming bs
is a fitted "hanaml.BSTS" object:
> data_pred
TIME_STAMP FEATURE_01 FEATURE_02 FEATURE_03 ... FEATURE_07 FEATURE_08 FEATURE_09 FEATURE_10
0 50 0.471 -0.660 -0.086 ... -1.107 -0.559 -1.404 -1.646
1 51 0.872 0.062 0.481 ... -0.729 0.894 -0.754 1.107
2 52 0.976 -0.003 0.824 ... -0.589 0.133 0.007 -0.115
3 53 0.446 0.231 0.098 ... -0.014 0.182 -0.465 -1.062
4 54 0.248 -0.142 0.174 ... -0.380 1.236 -0.552 -1.051
5 55 -0.319 -0.867 0.334 ... -0.160 -0.488 -0.650 -0.769
6 56 -0.194 -0.822 0.523 ... -0.566 -0.289 -0.596 -0.559
7 57 -0.357 -0.564 -0.391 ... -0.980 0.578 -0.948 -0.870
8 58 -0.760 -1.113 -0.178 ... -0.477 -0.705 -1.199 -0.517
9 59 -0.611 -1.163 0.186 ... -0.976 -0.576 -0.927 -1.577
> res <- predict(bs, data_pred, key = 'TIME_STAMP')
> res[[1]]
TIME_STAMP FORECAST SE LOWER_80 UPPER_80 LOWER_95 UPPER_95
0 50 0.143151 0.591231 -0.614542 0.900844 -1.015640 1.301943
1 51 0.469405 0.765558 -0.511697 1.450508 -1.031060 1.969871
2 52 0.155813 1.004786 -1.131872 1.443499 -1.813531 2.125158
3 53 0.055188 1.160655 -1.432251 1.542627 -2.219653 2.330029
4 54 0.064481 1.385078 -1.710569 1.839531 -2.650222 2.779185
5 55 0.045844 1.660894 -2.082678 2.174365 -3.209448 3.301135
6 56 -0.039227 1.905115 -2.480732 2.402277 -3.773185 3.694731
7 57 0.124084 2.193157 -2.686560 2.934728 -4.174424 4.422592
8 58 -0.200588 2.479858 -3.378655 2.977478 -5.061020 4.659843
9 59 0.339182 2.763764 -3.202725 3.881089 -5.077696 5.756059