if (FALSE) {
library(MarketMatching)
##-----------------------------------------------------------------------
## Create a pseudo power curve for various levels of lift
## Since this is weather data it is a not a very meaningful example.
## This is merely to demonstrate the function.
##-----------------------------------------------------------------------
data(weather, package="MarketMatching")
mm <- best_matches(data=weather,
id="Area",
markets_to_be_matched=c("CPH", "SFO"),
date_variable="Date",
matching_variable="Mean_TemperatureF",
warping_limit=1, # warping limit=1
dtw_emphasis=0, # rely only on dtw for pre-screening
matches=5, # request 5 matches
start_match_period="2014-01-01",
end_match_period="2014-10-01")
library(CausalImpact)
results <- test_fake_lift(matched_markets=mm,
test_market="CPH",
lift_pattern_type="constant",
control_matches=5, # use all 5 matches for inference
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