Code used in https://arxiv.org/abs/2006.05532
Project description
Masks and COVID-19: a causal framework for imputing value to public-health interventions
Code to reproduce Masks and COVID-19.
This is a refactored version of the original code.
Install
pip install babino2020masks
How to use
Gather data
ny = API(api_settings['NYS'][:2], **api_settings['NYS'][2])
df = ny.get_all_data_statewide()
ax = plot_data_and_fit(df, 'Date', 'Odds', None, None, None, figsize=(10, 7))
ax.set_title(f'{df.tail(1).Date[0]:%B %d, %Y}, Positivity Odds:{df.tail(1).Odds[0]:2.3}');
Fit the model
sdf = df.loc[df.Date<='15-05-2020'].copy()
lics = LassoICSelector(sdf['Odds'], 'bic')
lics.fit_best_alpha()
Positivity Odds in NYS
sdf['Fit'], sdf['Odds_l'], sdf['Odds_u'] = lics.odds_hat_l_u()
ax = plot_data_and_fit(sdf, 'Date', 'Odds', 'Fit', 'Odds_l', 'Odds_u', figsize=(10, 7))
Instantaneous reproduction number, $R_t$
sdf['R'], sdf['Rl'], sdf['Ru'] = lics.rt()
ax = plot_data_and_fit(sdf, 'Date', None, 'R', 'Rl', 'Ru', figsize=(10, 7), logy=False, palette=[colorblind[1],colorblind[1]])
Counterfactual Scenario without Masks
sdf['Cf. Odds'], sdf['cf_odds_l'], sdf['cf_odds_u'] = lics.counterfactual()
ax = plot_data_and_fit(sdf, 'Date', 'Odds', 'Fit', 'Odds_l', 'Odds_u', figsize=(10, 7))
plot_data_and_fit(sdf, 'Date', None, 'Cf. Odds', 'cf_odds_l', 'cf_odds_u', palette=[colorblind[2],colorblind[2]], ax=ax);
Last updated on 11/16/2020 14:24:58
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
babino2020masks-0.0.7.tar.gz
(13.8 kB
view hashes)
Built Distribution
Close
Hashes for babino2020masks-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02c2d95a97cb8e8f03731aa08c74b6533404cb2b9081576fe0eb3851e9bb1b40 |
|
MD5 | 9753544d13d4de9c97fe4ef6c4c7107e |
|
BLAKE2b-256 | b8c0ccf67c16d613670dc9e89bf10b5429387c9a8f20b4f9c3952fb5497f1d8f |