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

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
Attribution

Description

The Attribution function is used in web page analysis, where it allows companies to assign weights to pages before certain events, such as buying a product.

Usage

  td_attribution_sqle (
      data = NULL,
      data.optional = NULL,
      conversion.data = NULL,
      excluding.data = NULL,
      optional.data = NULL,
      model1.type = NULL,
      model2.type = NULL,
      event.column = NULL,
      timestamp.column = NULL,
      window.size = NULL,
      data.partition.column = NULL,
      data.optional.partition.column = NULL,
      data.order.column = NULL,
      data.optional.order.column = NULL,
      conversion.data.order.column = NULL,
      excluding.data.order.column = NULL,
      optional.data.order.column = NULL,
      model1.type.order.column = NULL,
      model2.type.order.column = NULL
  )

Arguments

data

Required Argument.
Specifies the tbl_teradata that contains the click stream data, which the function uses to compute attributions.

data.partition.column

Required Argument.
Specifies Partition By columns for "data".
Values to this argument can be provided as a vector, if multiple columns are used for partition.
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)

data.optional

Optional Argument.
Specifies the tbl_teradata that contains the click stream data, which the function uses to compute attributions.

data.optional.partition.column

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

data.optional.order.column

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

conversion.data

Required Argument.
Specifies the tbl_teradata that contains one varchar column (conversion.event) containing conversion event values.

conversion.data.order.column

Optional Argument.
Specifies Order By columns for "conversion.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)

excluding.data

Optional Argument.
Specifies the tbl_teradata that contains one varchar column (excluding.events) containing excluding cause event values.

excluding.data.order.column

Optional Argument.
Specifies Order By columns for "excluding.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)

optional.data

Optional Argument.
Specifies the tbl_teradata that contains one varchar column (optional.events) containing optional cause event values.

optional.data.order.column

Optional Argument.
Specifies Order By columns for "optional.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)

model1.type

Required Argument.
Specifies the tbl_teradata that defines the type and distributions of the first model.
For example:
model1.data ("EVENT_REGULAR", "email:0.19:LAST_CLICK:NA", "impression:0.81:WEIGHTED:0.4,0.3,0.2,0.1")

model1.type.order.column

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

model2.type

Optional Argument.
Specifies the tbl_teradata that defines the type and distributions of the second model.
For example:
model2.data ("EVENT_OPTIONAL", "OrganicSearch:0.5:UNIFORM:NA", "Direct:0.3:UNIFORM:NA", "Referral:0.2:UNIFORM:NA")

model2.type.order.column

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

event.column

Required Argument.
Specifies the name of the input column that contains the clickstream events.
Types: character

timestamp.column

Required Argument.
Specifies the name of the input column that contains the timestamps of the clickstream events.
Types: character

window.size

Required Argument.
Specifies how to determine the maximum window size for the attribution calculation:

  • rows:K: Considers the maximum number of events to be attributed, excluding events of types specified in "excluding.data", which means assigning attributions to atmost K effective events before the current impact event.

  • seconds:K: Consider the maximum time difference between the current impact event and the earliest effective event to be attributed.

  • rows:K&seconds:K2: Consider both constraints and comply with the stricter one.

Types: character

Value

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

Examples

  
    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load the data to run the example
    loadExampleData("attribution_example", "attribution_sample_table1",
                    "attribution_sample_table2" , "conversion_event_table",
                    "optional_event_table", "model1_table", "model2_table")
    
    # Create object(s) of class "tbl_teradata".
    attribution_sample_table1 <- tbl(con, "attribution_sample_table1")
    attribution_sample_table2 <- tbl(con, "attribution_sample_table2")
    conversion_event_table <- tbl(con, "conversion_event_table")
    optional_event_table <- tbl(con, "optional_event_table")
    model1_table <- tbl(con, "model1_table")
    model2_table <- tbl(con, "model2_table")
    
    # This example uses models to assign attribution weights to events (conversion,           
    # optional and excluding).
    td_attribution_out <- td_attribution_sqle(data=attribution_sample_table1,
                             data.partition.column="user_id",
                             data.order.column="time_stamp",
                             data.optional=attribution_sample_table2,
                             data.optional.partition.column='user_id',
                             data.optional.order.column='time_stamp',
                             event.column="event",
                             conversion.data=conversion_event_table,
                             optional.data=optional_event_table,
                             timestamp.column = "time_stamp",
                             window.size = "rows:10&seconds:20",
                             model1.type=model1_table,
                             model2.type=model2_table
                             )