hpiR (version 0.2.0)

rtTimeMatrix: Create model matrix for repeat transaction approach

Description

Generates the array necessary to estimate a repeat transactions model

Usage

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

Run this code
# NOT RUN {
  # 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)

# }

Run the code above in your browser using DataLab