compareModels: compare several models

Description Usage Arguments Details Examples

View source: R/promotion_impact.R

Description

compareModels

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
compareModels(
  data,
  promotion,
  fix = list(logged = TRUE, differencing = TRUE),
  time.field = "dt",
  target.field = "sales",
  dummy.field = NULL,
  trend.param = 0.05,
  period.param = 3,
  var.type = "smooth",
  smooth.except.date = NULL,
  smooth.bandwidth = 2,
  smooth.var.sum = TRUE,
  allow.missing = TRUE
)

Arguments

data

Dataframe containing date, target variable, and some additional time dummies that the researcher wants to account for.

promotion

Dataframe containing promotion ID, start date, end date, promotion tag(type). Might include daily payments associated with the promotion.

fix

A List of constraints to find the best model. Constraints can only be in following list: 'period','trend','logged','synergy.var','differencing','smooth.origin','structural.change','synergy.promotion'

time.field

Specify the date field of 'data'.

target.field

Specify the target field of 'data'.

dummy.field

Specify the additional time dummies of 'data'.

trend.param

Flexibility of trend component. Default is 0.05, and as this value becomes larger, the trend component will be more flexible.

period.param

Flexibility of period component. Default is 3, and as this value becomes larger, the period component will be more flexible.

var.type

'smooth' to use smoothed promotion variables, 'dummy' to use dummy promotion variables

smooth.except.date

Date value that will be excluded from the smoothing process. eg) '01' to exclude every start day of a month

smooth.bandwidth

Bandwidth of local polynomial regression used in the smoothing process. Default value is 2.

smooth.var.sum

If TRUE, the smoothing values for times when multiple promotions in a single tag overlap will be the values from the latest promotion. Otherwise, the values will be added(default).

allow.missing

TRUE to allow missing data in promotion sales during the promotion period

Details

compareModels compares several models under user-defined conditions and suggests the best options.

Examples

1
2
3
4
5
6
comparison <- compareModels(data = sim.data, promotion = sim.promotion.sales,
                            fix = list(logged = TRUE, differencing = TRUE, smooth.origin='all',
                                       trend = FALSE, period = NULL), 
                            time.field = 'dt', target.field = 'simulated_sales', 
                            trend.param = 0.02, period.param = 2)
 

promotionImpact documentation built on April 13, 2021, 5:06 p.m.