| |
- SignifPeriodicities(data=None, data_filter_expr=None, significance_level=None, periodicities=None, **generic_arguments)
- DESCRIPTION:
The SignifPeriodicities() function is a significance
of periodicities statistics test to determine the
optimum data model. It uses the residuals generated
during the model validation/selection phase.
Significance of periodicities statistics test is
usually performed against residuals produced during
the model validation phase, meaning against the
in-sample forecasted data points.
The following procedure is an example of how to use
SignifPeriodicities():
1. Use ArimaEstimate() to identify spectral candidates.
2. Use ArimaValidate() to validate spectral candidates.
3. Use DataFrame.plot() to plot the results.
4. Compute the test statistic.
5. Use SignifPeriodicities() on the periodicities of interest.
More than one periodicities can be entered using the
"periodicities" parameter.
PARAMETERS:
data:
Required Argument.
Specifies a single univariate series with calculated residuals
from original regression or TDAnalyticResult object on the
residual output generated by the UAF functions.
Types: TDSeries, TDAnalyticResult
data_filter_expr:
Optional Argument.
Specifies the filter expression for "data".
Types: ColumnExpression
significance_level:
Required Argument.
Specifies the significance level to be associated with
the statistical F-test. Value must be greater than 0 and
less than 1.
Types: float
periodicities:
Required Argument.
Specifies the significant periodicities to perform
tests for each period.
Types: float OR list of float
**generic_arguments:
Specifies the generic keyword arguments of UAF functions.
Below are the generic keyword arguments:
persist:
Optional Argument.
Specifies whether to persist the results of the
function in a table or not. When set to True,
results are persisted in a table; otherwise,
results are garbage collected at the end of the
session.
Note that, when UAF function is executed, an
analytic result table (ART) is created.
Default Value: False
Types: bool
volatile:
Optional Argument.
Specifies whether to put the results of the
function in a volatile ART or not. When set to
True, results are stored in a volatile ART,
otherwise not.
Default Value: False
Types: bool
output_table_name:
Optional Argument.
Specifies the name of the table to store results.
If not specified, a unique table name is internally
generated.
Types: str
output_db_name:
Optional Argument.
Specifies the name of the database to create output
table into. If not specified, table is created into
database specified by the user at the time of context
creation or configuration parameter. Argument is ignored,
if "output_table_name" is not specified.
Types: str
RETURNS:
Instance of SignifPeriodicities.
Output teradataml DataFrames can be accessed using attribute
references, such as SignifPeriodicities_obj.<attribute_name>.
Output teradataml DataFrame attribute name is:
1. result
RAISES:
TeradataMlException, TypeError, ValueError
EXAMPLES:
# Notes:
# 1. Get the connection to Vantage to execute the function.
# 2. One must import the required functions mentioned in
# the example from teradataml.
# 3. Function will raise error if not supported on the Vantage
# user is connected to.
# Check the list of available UAF analytic functions.
display_analytic_functions(type="UAF")
# Load the example data.
load_example_data("uaf", "timeseriesdatasetsd4")
# Create teradataml DataFrame object.
data = DataFrame.from_table("timeseriesdatasetsd4")
# Create teradataml TDSeries object.
from teradataml import TDSeries
data_series_df = TDSeries(data = data,
id="dataset_id",
row_index="seqno",
row_index_style="SEQUENCE",
payload_field = "Magnitude",
payload_content="REAL")
# Identify spectral candidates using ArimaEstimate().
from teradataml import ArimaEstimate
arima_estimate = ArimaEstimate(data1=data_series_df,
nonseasonal_model_order=[2, 0, 0],
constant=True,
algorithm="MLE",
fit_percentage=70,
fit_metrics=True,
coeff_stats=True,
residuals=True,
max_iterations=100)
# Create teradataml TDAnalyticResult object
# using the output of ArimaEstimate.
from teradataml import TDAnalyticResult
data_art_df = TDAnalyticResult(arima_estimate.result)
# Validate spectral candidates using ArimaValidate().
from teradataml import ArimaValidate
arima_validate = ArimaValidate(data=data_art_df,
fit_metrics=True,
residuals=True)
# Retrieve residuals from ArimaValidate() result.
data_series_df_real = TDSeries(data=arima_validate.fitresiduals,
id="dataset_id",
row_index="ROW_I",
row_index_style="SEQUENCE",
payload_field="RESIDUAL",
payload_content="REAL")
# Example 1: Perform statistical tests using SignifPeriodicities()
# function with TDSeries for multiple periodicities.
uaf_out = SignifPeriodicities(data=data_series_df_real,
periodicities=[2.666666666, 5.333333333, 8.0],
significance_level=0.05)
# Print the result DataFrame.
print(uaf_out.result)
|