Covid19 rapid tests and the probability of disease

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sensibility = 0.9851
specificity = 0.9991
prevalence_example = 0.012878 # 23181 / 1.8e6
def ppv(prevalence: np.array, sens: float = sensibility, spec: float = specificity) -> np.array:
return prevalence*sens / (prevalence*sens + (1-prevalence)*(1-spec))
print(f"PPV computed in the example scenario: {ppv(prevalence_example)*100:.1f}%")
prevalences = np.arange(0, 0.05, 0.0001)
ppvs = ppv(prevalences)
data = pd.DataFrame(data={'Prevalence': prevalences, 'PPV': ppvs})
sns.relplot(data=data, x='Prevalence', y='PPV', kind='line')
plt.axvline(0.005, color='r')
PPV highly depends on the prevalence

--

--

--

M.D., P.h.D. student, Bioinformatics researcher

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Multi-layer forecasting to predict business outcomes during times of market volatility

Telethings are trendy in 2020

Building Summary Endpoints for the Education Data Portal

10 Things You Didn’t Know About Scikit-Learn

Learn Data Science from Top Universities for Free

Where to learn Maths for Machine Learning in 2021?

Confusion Matrix,

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eugen Ursu

Eugen Ursu

M.D., P.h.D. student, Bioinformatics researcher

More from Medium

How many Senses Do Humans Use?

The Benefits of having white hair — don’t fear getting older

Frozen in the Spotlight: Scientists from the GIST Develop Catalyst that Turns Off when Illuminated

Inhale~ Exhale, the mystical breath!