Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A simple way to calculate Bayesian confidence intervals is sampling from Beta distributions. This is using the Beta(1,1) prior (uniform random) for both vaccine and control population.

The data suggests it is unlikely that the vaccine reduces infection by >=50% (<5% probability) and a probability close to zero it reduces infection by >=70%.

    import numpy as np
    import pandas as pd
    
    # number of infections, and obs
    infect_ctrl,obs_ctrl=714, 20 
    infect_test, obs_test=748, 19

    sample_C=np.random.beta(infect_ctrl+1, obs_ctrl-infect_ctrl+1, 100_000) # sample 100k times from posterior Beta distributions
    sample_T=np.random.beta(infect_test+1,obs_test-infect_test+1, 100_000) 
    
    # percentage reduction in each sample
    perc_reduce = (val_C-val_T) /val_C

    # histogram of % reduction in infection
    pd.Series(perc_reduce).plot.hist(bins=20)
    
    # how likely, given this data, is > 50% reduction in infection from vaccine 
    (perc_reduce >= 0.5).mean()
    # c. 3%

   (perc_reduce >= 0.7).mean()
    # <0.1%


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: