hanaml.LRSeasonalAdjust.Rd
hanaml.LRSeasonalAdjust is a R wrapper for SAP HANA PAL Linear regression with damped trend and seasonal adjust.
hanaml.LRSeasonalAdjust(
data,
key,
endog = NULL,
forecast.length = NULL,
trend = NULL,
affect.future.only = NULL,
seasonality = NULL,
seasonal.period = NULL,
accuracy.measure = NULL,
seasonal.handle.method = NULL,
expost.flag = NULL,
ignore.zero = NULL
)
DataFrame
DataFrame containting the data.
character
Name of the ID column.
character, optional
The endogenous variable, i.e. time series.
Defaults to the first non-ID column.
integer, optional
Length of the final forecast results.
Defaults to 1.
double, optional
Damped trend factor. Value range is (0,1].
Defaults to 1.
logical, optional
Specifies whether the damped trend affects the history.
FALSE
: Affects all.
TRUE
: Affects the future only.
Defaults to TRUE.
integer, optional
Specifies whether the data represents seasonality.
0
: Non-seasonality.
1
: Seasonality exists and user inputs the value of periods.
2
: Automatically detects seasonality.
Defaults to 0.
integer, optional
Length of seasonal period. seasonal.period
is only valid when seasonality is 1.
If this parameter is not specified, the seasonality value will be changed from 1 to 2,
that is, from user-defined to automatically-detected.
No default value.
character or list of characters, optional
Specifies the method of accuracy evaluation. The criterion used for the optimization.
"mpe"
: Mean percentage error.
"mse"
: Mean squared error.
"rmse"
: Root mean squared error.
"et"
: Error total.
"mad"
: Mean absolute deviation.
"mase"
: Out-of-sample mean absolute scaled error.
"wmape"
: Weighted mean absolute percentage error.
"smape"
: Symmetric mean absolute percentage error.
"mape"
: Mean absolute percentage error.
No default value.
character, optional
Method used for calculating the index value in the seasonal.period.
"average"
: Average method.
"lr"
: Fitting linear regression.
Defaults to "average".
logical, optional
FALSE
: Does not output the expost forecast, and just outputs the forecast values.
TRUE
: Outputs the expost forecast and the forecast values.
Defaults to TRUE.
logical, optional
FALSE
: Uses zero values in the input dataset when calculating "mpe" or "mape".
TRUE
: Ignores zero values in the input dataset when calculating "mpe" or "mape".
Defaults to FALSE.
Returns a list of two DataFrames:
DataFrame 1
Forecast values.
DataFrame 2
Statistics analysis content.
Input DataFrame data:
> data$Collect()
TIMESTAMP Y
1 1 5328.172
2 2 7701.608
3 3 11248.606
4 4 9478.945
5 5 6138.471
6 6 8829.956
7 7 2838.390
Invoke the function:
> lr <- hanaml.LRSeasonalAdjust(data,
key = "TIMESTAMP",
endog = "Y",
forecast.length = 1,
trend = 0.9,
affect.future.only = TRUE,
seasonality = 2,
seasonal.handle.method = "lr",
accuracy.measure = list("mape", "mpe"),
expost.flag = TRUE,
ignore.zero = TRUE)
Ouput:
> lr[[1]]$Collect()
TIMESTAMP VALUE
1 1 8472.320
2 2 8103.649
3 3 7734.978
4 4 7366.307
5 5 6997.636
6 6 6628.965
7 7 6260.294
8 8 5928.490
> lr[[2]]$Collect()
STAT_NAME STAT_VALUE
1 Intercept 8840.9904286
2 Slope -368.6708929
3 MAPE 0.3960495
4 MPE -0.1719060
5 HandleZero 0.0000000