Usage
pvalueCalc(
data,
sim,
max_time,
tp,
es,
locations,
cpic,
X,
type = "pValue",
normalize = FALSE,
fixed_effects = FALSE,
stat_func = NULL,
model = "none",
conformal_type = "iid",
ns = 1000
)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.
- sim
Time simulation index.
- max_time
Treatment end index.
- tp
Time period index.
- es
Effect Size.
- locations
List of test locations.
- cpic
Cost Per Incremental Conversion.
- X
List of names of covariates.
- type
Method of inference used in the analysis. pValue=Provides conformal inference to provide the aggregate p-value for the null hypothesis of no effect from the intervention. The Default type is pValue. Imbalance=Uses the model's Scaled L2 Imbalance metric.
- 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 FALSE by default.
- stat_func
Function to compute test statistic. NULL by default.
- model
A string indicating the outcome model used in the Augmented Synthetic Control Method. Set to Generalized Synthetic Controls "none" by default.
- 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.
Value
List 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
Examples
geo_pre <- GeoDataRead(GeoLift_PreTest, date_id = "date", location_id = "location",
Y_id = "Y", format = "yyyy-mm-dd")
set.seed(1)
res <- pvalueCalc(geo_pre, sim = 1, max_time = 90, tp = 10, es = 0.1,
locations = list("chicago", "portland"), cpic = 7.5, X = c(),
stat_func = type_of_test("one_sided", "positive"), conformal_type = "iid", ns = 100)
res$pvalue
#> [1] 0