In this jupyter notebook, I will try to estimate how much more infectious Delta is than the 'original' COV-19 strain. Here, I define 'original' as the ensemble of viruses that spread from 2020 through June 2021.
The approach will be as follows:
pywt
package to do this.import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import datetime as dt
sys.path.append('./utils')
# see https://github.com/dangeles/dangeles.github.io/blob/master/jupyter/utils/{covid_utils, cfr}.py
import covid_utils as cv
import cfr
df = cfr.fetch_data()
smooth = cfr.smooth_active(df, level=3) # wavelet reconstruction, per state
pca = cfr.pca_plot(smooth, 'CasesPerPeriod', n_comps=4, plot=False)
groups = cfr.partition(pca, smooth) # leiden clustering
fig, ax = cfr.plot_partitions(smooth, 'CasesPerPeriod', groups,
pivot_kwargs={'transform': lambda x: x})
fig.suptitle('Weekly Recorded Cases', fontsize=20)
ax[0].set_ylabel('Daily Cases Per Million Inhabitants')
plt.tight_layout()
/Users/davidangeles/opt/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py:4468: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy downcast=downcast,
pca = cfr.pca_plot(smooth, 'DeathsPerPeriod', n_comps=4, plot=False)
groups = cfr.partition(pca, smooth)
fig, ax = cfr.plot_partitions(smooth, 'DeathsPerPeriod', groups,
pivot_kwargs={'transform': lambda x: x})
fig.suptitle('Weekly Recorded Deaths', fontsize=20)
ax[0].set_ylabel('Daily Deaths Per Million Inhabitants')
plt.tight_layout()