Teradata R Package Function Reference - VarMax - Teradata R Package - Look here for syntax, methods and examples for the functions included in the Teradata R Package.

Teradata® R Package Function Reference

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-28
dita:id
B700-4007
lifecycle
previous
Product Category
Teradata Vantage

Description

VARMAX (Vector Autoregressive Moving Average model with eXogenous variables) extends the ARMA/ARIMA model in two ways:
1. To work with time series with multiple response variables (vector time series).
2. To work with exogenous variables, or variables that are independent of the other variables in the system.

Usage

  td_varmax_mle (
      data = NULL,
      response.columns = NULL,
      exogenous.columns = NULL,
      partition.columns = NULL,
      orders = NULL,
      seasonal.orders = NULL,
      period = NULL,
      exogenous.order = NULL,
      lag = 0,
      include.mean = FALSE,
      max.iter.num = 100,
      step.ahead = NULL,
      method = "SSE",
      data.orders = NULL,
      include.drift = FALSE,
      order.p = NULL,
      order.d = NULL,
      order.q = NULL,
      seasonal.order.p = NULL,
      seasonal.order.d = NULL,
      seasonal.order.q = NULL,
      data.sequence.column = NULL,
      data.orders.sequence.column = NULL,
      data.partition.column = "1",
      data.orders.partition.column = "1",
      data.order.column = NULL,
      data.orders.order.column = NULL
  )

Arguments

data

Required Argument.
Specifies the tbl_teradata or view that stores the input sequence.

data.partition.column

Optional Argument.
Specifies Partition By columns for data.
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Default Value: "1"
Types: character OR vector of Strings (character)

data.order.column

Required Argument.
Specifies Order By columns for data.
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

response.columns

Required Argument.
Specifies the data columns containing the response data. Null values are acceptable at the end of the series. If step.ahead is specified, the function will report predicted values for the missing values, taking into account values from the predictor columns for those time periods.
Types: character OR vector of Strings (character)

exogenous.columns

Optional Argument.
Specifies the data columns containing the independent (exogenous) predictors. If it is not specified, the model will be calculated without exogenous vectors.
Types: character OR vector of Strings (character)

partition.columns

Optional Argument.
Specifies the data partition columns that will be passed to the output. If it is not specified, the output will not contain partition columns.
Types: character OR vector of Strings (character)

orders

Optional Argument. This argument is required if data.orders and (order.p, orders.d, orders.q) are not specified.
Specifies the parameters p, d, q for VARMAX model. This argument consists of 3 non-negative integer values separated by commas. The values of p and q must be an integer between 0 and 10, inclusive. The value of d must be between 0 and 1, inclusive.
Types: character

seasonal.orders

Optional Argument.
Specifies seasonal parameters sp, sd, sq for VARMAX model. This argument consists of 3 non-negative integer values separated by commas. The values of sp and sq must be an integer between 0 and 10, inclusive. The value of sd must be between 0 and 3, inclusive. If this argument is not specified, the model will be treated as a non-seasonal model.
If this argument is used, the period argument should also be present.
If data.orders is specified, this argument cannot be specified.
Types: character

period

Optional Argument. This argument is required if seasonal.orders or (seasonl.orders.p, seasonal.orders.d, seasonal.orders.d) is specified.
Specifies the period of each season. It must be a positive integer value. If this argument is not specified, the model will be treated as a non-seasonal model.
If this argument is used, the seasonal.orders or (seasonl.orders.p, seasonal.orders.d, seasonal.orders.d) argument must also be present.
Types: numeric

exogenous.order

Optional Argument.
Specifies the order of exogenous variables. If the current time is t and exogenous.order is b, the following values of the exogenous time series will be used in calculating the response: Xt Xt-1 ... Xt-b+1. If it is not specified, the model will be calculated without exogenous vectors.
Types: numeric

lag

Optional Argument.
Specifies the lag in the effect of the exogenous variables on the response variables. For example, if lag = 3, and exogenous.order is b, Yi will be predicted based on Xi-3 to Xi-b-2, where
1. Yi is a vector of n response variables
2. Xi is a vector of m exegenous variables
Default Value: 0
Types: numeric

include.mean

Optional Argument.
Specifies whether mean vector of the response data series (constant c in the formula) is added in the VARMAX model.
Note that if this argument is TRUE, the difference parameter d (in the orders argument) and sd (in the seasonal.orders argument) should be 0.
This argument cannot be specified along with the data.orders arugment.
Default Value: FALSE
Types: logical

max.iter.num

Optional Argument.
Specifies the maximum number of iterations performed. It must be a positive integer value.
Default Value: 100
Types: numeric

step.ahead

Optional Argument.
Specifies the number of steps to forecast after the end of the time series. Must be a positive integer value. If this argument is not provided, no forecast values are calculated.
Types: numeric

method

Optional Argument.
Specifies the method for fitting the model parameters.
Permitted Values: SSE (Sum of squared error), ML (Maximum likelihood)
Default Value: "SSE"
Types: character

data.orders

Optional Argument.
Specifies the output tbl_teradata from TimeSeriesParameters.

data.orders.partition.column

Optional Argument.
Specifies Partition By columns for data.orders.
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Default Value: "1"
Types: character OR vector of Strings (character)

data.orders.order.column

Optional Argument.
Specifies Order By columns for data.orders.
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

include.drift

Optional Argument.
Specify whether drift term is included in the VARMAX model.
Note that this argument can only be TRUE when d is non-zero and less than 2.
This argument cannot be specified along with the data.orders arugment.
Default Value: FALSE
Types: logical

order.p

Optional Argument.This argument is required if data.orders and orders are not specified.
Specifies the p value of the non-seasonal order parameter. The p value must be an integer between 0 and 10, inclusive.
Note: "order.p" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

order.d

Optional Argument. This argument is required if data.orders and orders are not specified.
Specifies the d value of the non-seasonal order parameter. The d value must be an integer between 0 and 1, inclusive.
Note: "order.d" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

order.q

Optional Argument.This argument is required if data.orders and orders are not specified.
Specifies the q value of the non-seasonal order parameter. The q value must be an integer between 0 and 10, inclusive.
Note: "order.q" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

seasonal.order.p

Optional Argument.
Specifies the sp value of the seasonal order parameter. The sp value must be an integer between 0 and 10, inclusive.
If data.orders or seasonal.orders is specified, this argument cannot be specified.
Note: "seasonal.order.p" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

seasonal.order.d

Optional Argument.
Specifies the sd value of the seasonal order parameter. The sd value must be an integer between 0 and 3, inclusive.
If data.orders or seasonal.orders is specified, this argument cannot be specified.
Note: "seasonal.order.d" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

seasonal.order.q

Optional Argument.
Specifies the sq value of the seasonal order parameter. The sq value must be an integer between 0 and 10, inclusive.
If data.orders or seasonal.orders is specified, this argument cannot be specified.
Note: "seasonal.order.q" argument support is only available when tdplyr is connected to Vantage 1.1 or later versions.
Types: numeric

data.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "data". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

data.orders.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "data.orders". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_varmax_mle" which is a named list containing Teradata tbl object.
Named list member can be referenced directly with the "$" operator using name: result.

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("varmax_example", "finance_data3", "orders_ex")
    
    # Create remote tibble objects.
    finance_data3 <- tbl(con, "finance_data3")
    orders_ex <- tbl(con, "orders_ex")
    
    # Example 1 - Without exogenous.columns
    varmax_out1 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure","income","investment"),
                                 partition.columns = c("id"),
                                 orders = "1,1,1",
                                 include.mean = FALSE,
                                 step.ahead = 3
                                 )
    
    # Example 2 - Without seasonal.orders
    varmax_out2 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure"),
                                 exogenous.columns = c("income","investment"),
                                 partition.columns = c("id"),
                                 orders = "1,1,1",
                                 exogenous.order = 3,
                                 lag = 3,
                                 include.mean = FALSE,
                                 step.ahead = 3
                                 )
    
    # Example 3 - With both orders and seasonal.orders
    varmax_out3 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure"),
                                 exogenous.columns = c("income","investment"),
                                 partition.columns = c("id"),
                                 orders = "1,1,1",
                                 seasonal.orders = "1,0,0",
                                 period = 4,
                                 exogenous.order = 3,
                                 lag = 3,
                                 include.mean = FALSE,
                                 step.ahead = 3
                                 )
    
    # Example 4 - Using data.orders.
    varmax_out4 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure"),
                                 partition.columns = c("id"),
                                 max.iter.num = 1000,
                                 method = "ML",
                                 data.orders = orders_ex,
                                 data.orders.partition.column = c("id")
                                 )
    
    # Example 5 - Using order.p, order.d and order.q
    varmax_out5 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure"),
                                 exogenous.columns = c("income","investment"),
                                 partition.columns = c("id"),
                                 order.p = 1,
                                 order.d = 1,
                                 order.q = 1,
                                 seasonal.orders = "1,0,0",
                                 period = 4,
                                 exogenous.order = 3,
                                 lag = 3,
                                 include.mean = FALSE,
                                 step.ahead = 3
    )
    
    # Example 6 - Using seasonal.order.p, seasonal.order.d and seasonal.order.q
    varmax_out6 <- td_varmax_mle(data = finance_data3,
                                 data.partition.column = c("id"),
                                 data.order.column = c("period"),
                                 response.columns = c("expenditure"),
                                 exogenous.columns = c("income","investment"),
                                 partition.columns = c("id"),
                                 orders = "1,1,1",
                                 seasonal.order.p = 1,
                                 seasonal.order.d = 0,
                                 seasonal.order.q = 0,
                                 period = 4,
                                 exogenous.order = 3,
                                 lag = 3,
                                 include.mean = FALSE,
                                 step.ahead = 3
    )