Description
The CumulativeMovAvg function computes the cumulative moving average of a value
from the beginning of a series.
When computing cumulative moving average, the data are added to the data set in an
ordered data stream over time. The objective is to compute the average of all the data
at each point in time when new data arrived.
Usage
td_cumulative_mov_avg_mle (
data = NULL,
target.columns = NULL,
data.sequence.column = NULL,
data.partition.column = NULL,
data.order.column = NULL
)
Arguments
data |
Required Argument. |
data.partition.column |
Required Argument. |
data.order.column |
Required Argument. |
target.columns |
Optional Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_cumulative_mov_avg_mle" which
is a named list containing object of class "tbl_teradata".
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("cumulativemovavg_example", "ibm_stock")
# Create object(s) of class "tbl_teradata".
ibm_stock <- tbl(con, "ibm_stock")
# Compute the cumulative moving average for "stockprice".
td_cumulative_mov_avg_out <- td_cumulative_mov_avg_mle(data = ibm_stock,
data.partition.column = c("name"),
data.order.column = c("period"),
target.columns = c("stockprice")
)