rtTimeMatrix: Create model matrix for repeat transaction approach

Description Usage Arguments Value Further Details Examples

View source: R/rtTimeMatrix.R

Description

Generates the array necessary to estimate a repeat transactions model

Usage

1
rtTimeMatrix(rt_df)

Arguments

rt_df

object of class 'rtdata': repeat transaction data.frame created by rtCreateTrans()

Value

matrix to be used on the right hand side of a repeat sales regression model

Further Details

Time periods are calculated from the data provided.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  # Load data
  data(ex_sales)

  # With a raw transaction data.frame
  rt_data <- rtCreateTrans(trans_df = ex_sales,
                           prop_id = 'pinx',
                           trans_id = 'sale_id',
                           price = 'sale_price',
                           periodicity = 'monthly',
                           date = 'sale_date')
 # Create Matrix
 rt_matrix <- rtTimeMatrix(rt_data)

hpiR documentation built on April 1, 2020, 5:09 p.m.