run_simulations: Run simulations for treatment markets.

View source: R/pre_test_power.R

run_simulationsR Documentation

Run simulations for treatment markets.

Description

[Stable]

run_simulations computes simulations for each treatment market.

Usage

run_simulations(
  data,
  treatment_combinations,
  treatment_durations,
  effect_sizes = 0,
  side_of_test = "two_sided",
  conformal_type = conformal_type,
  ns = ns,
  lookback_window = 1,
  parallel = TRUE,
  ProgressBar = FALSE,
  cpic = 0,
  X = c(),
  normalize = FALSE,
  fixed_effects = TRUE,
  model = "none"
)

Arguments

data

A data.frame containing the historical conversions by geographic unit. It requires a "locations" column with the geo name, a "Y" column with the outcome data (units), a time column with the indicator of the time period (starting at 1), and covariates.

treatment_combinations

A matrix of treatment locations. Each row symbolizes a combination, each column one element of the combination.

treatment_durations

Expected durations of the experiment.

effect_sizes

A vector of effect sizes to simulate.

side_of_test

A string indicating whether confidence will be determined using a one sided or a two sided test.

  • "two_sided": The test statistic is the sum of all treatment effects, i.e. sum(abs(x)). Defualt.

  • "one_sided": One-sided test against positive or negaative effects i.e. If the effect being applied is negative, then defaults to -sum(x). H0: ES >= 0; HA: ES < 0. If the effect being applied is positive, then defaults to sum(x). H0: ES <= 0; HA: ES > 0.

conformal_type

Type of conformal inference used. Can be either "iid" for Independent and identically distributed or "block" for moving block permutations. Set to "iid" by default.

ns

Number of resamples for "iid" permutations if ⁠conformal_type = "iid⁠. Set to 1000 by default.

lookback_window

A number indicating how far back in time the simulations for the power analysis should go. For instance, a value equal to 5 will simulate power for the last five possible tests. By default lookback_window = 1 which will only execute the most recent test based on the data.

parallel

A logic flag indicating whether to use parallel computing to speed up calculations. Set to TRUE by default.

ProgressBar

A logic flag indicating whether to display a progress bar to track progress. Set to FALSE by default.

cpic

Number indicating the Cost Per Incremental Conversion.

X

List of names of covariates.

normalize

A logic flag indicating whether to scale the outcome which is useful to accelerate computing speed when the magnitude of the data is large. The default is FALSE.

fixed_effects

A logic flag indicating whether to include unit fixed effects in the model. Set to TRUE by default.

model

A string indicating the outcome model used to augment the Augmented Synthetic Control Method. Augmentation through a prognostic function can improve fit and reduce L2 imbalance metrics.

  • "None": ASCM is not augmented by a prognostic function. Defualt.

  • "Ridge": Augments with a Ridge regression. Recommended to improve fit for smaller panels (less than 40 locations and 100 time-stamps.))

  • "GSYN": Augments with a Generalized Synthetic Control Method. Recommended to improve fit for larger panels (more than 40 locations and 100 time-stamps.

Value

DataFrame that contains:

  • "location": Test locations.

  • "pvalue": P Value.

  • "tp": Time period index.

  • "es": Effect Size used for the simulation.

  • "treatment_start_time": Treatment start time for the simulation

  • "investment": Estimated Investment

  • "ScaledL2Imbalance": Scaled L2 Imbalance metric

  • "att_estimator": Detected Average Treatment on the Treated

  • "detected_lift": Detected % Lift by GeoLift for an effect size


facebookincubator/GeoLift documentation built on May 31, 2024, 10:09 a.m.