if (FALSE) {
##-----------------------------------------------------------------------
## Generate the suggested test/control pairs
##-----------------------------------------------------------------------
library(MarketMatching)
data(weather, package="MarketMatching")
mm <- best_matches(data=weather,
id="Area",
date_variable="Date",
matching_variable="Mean_TemperatureF",
parallel=FALSE,
suggest_market_splits=TRUE,
start_match_period="2014-01-01",
end_match_period="2014-10-01")
##-----------------------------------------------------------------------
## Roll up the pairs to generate test and control markets
## Synthetic=FALSE means that the control markets will be aggregated
## -- i.e., equal weighhs in CausalImpact
##-----------------------------------------------------------------------
rollup <- roll_up_optimal_pairs(matched_markets=mm,
percent_cutoff=1,
synthetic=FALSE)
##-----------------------------------------------------------------------
## Pseudo power analysis (fake lift analysis)
##-----------------------------------------------------------------------
results <- test_fake_lift(matched_markets=rollup,
test_market="TEST",
lift_pattern_type="constant",
end_fake_post_period="2015-12-15",
prior_level_sd=0.002,
max_fake_lift=0.1)
}
Run the code above in your browser using DataLab