Skip to main content

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}');

png

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))

png

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]])

png

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);

png

Last updated on 04/03/2021 13:33:20

Metadata

Release files for babino2020masks 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for babino2020masks 0.0.8
File Size Uploaded
babino2020masks-0.0.8.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for babino2020masks 0.0.8
File Interpreter ABI Platform
babino2020masks-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / babino2020masks-0.0.8.tar.gz

Download URL babino2020masks-0.0.8.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8d41b11425fd51985ec567106b8c2c33d295d1f5fce44e1c6fa7d4c32202dba7
BLAKE2b-256 checksum
How to use checksums
3acfe93d25b0d90413e84d5002587ec4750a92225955432c949d4c80318e6d45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / babino2020masks-0.0.8-py3-none-any.whl

Download URL babino2020masks-0.0.8-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40ea536180e1d6e78f9c3598dd7fcc7090f80489d5ca6cac42220d33d945b5d2
BLAKE2b-256 checksum
How to use checksums
562cf13f4153fb32851b201274af4c70d7f8c78ee871724c67f37e6b2a796d5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page