Download and load into ipython notebook to make these interactive.

Bias

In [23]:
import numpy as np
import pandas as pd
from IPython.html.widgets import interact
import matplotlib.pyplot as plt
%matplotlib inline
@interact
def plot(alpha=(0,0.3,0.01),power=(0.05,1,0.05), bias=(0,0.5,0.05)):
    R = np.arange(0,1.05,0.05)
    beta = 1-power
    PPV = ((1-beta)*R + bias*beta*R)/((1-beta)*R + alpha + bias - bias*alpha + bias*beta*R)
    plt.plot(R,PPV)
    plt.ylim(0,1)
    plt.xlabel('R')
    plt.ylabel('PPV')
    plt.text(0.65, 0.1,
            "alpha={0:.2f}\npower={1:.2f}\nbias={2}".format(alpha, power,bias),
            fontsize=14, color='gray')
    plt.show()

n Independent Studies

In [24]:
@interact
def plot(alpha=(0,0.3,0.01),power=(0.05,1,0.05), n=(1,10)):
    R = np.arange(0,1.05,0.05)
    beta = 1-power
    PPV = R*(1-beta**n)/(R + 1 - (1-alpha)**n - R*beta**n)
    plt.plot(R,PPV)
    plt.ylim(0,1)
    plt.xlabel('R')
    plt.ylabel('PPV')
    plt.text(0.65, 0.1,
        "alpha={0:.2f}\npower={1:.2f}\nn={2}".format(alpha, power,n),
        fontsize=14, color='gray')
    plt.show()