{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# The Efficacy of the Moderna Vaccine\n",
    "\n",
    "Approximate analysis. \n",
    "\n",
    "False assumptions:\n",
    "\n",
    "+ all subjects on trial for the same amount of time\n",
    "+ subjects \"independent\" (e.g., aren't co-workers working in an office, or paramedics riding together in an ambulance)\n",
    "+ randomization was not stratified\n",
    "+ ignore anybody who was \"lost\": treat final number as if it were initial number\n",
    "\n",
    "See the [FDA Briefing Document](https://www.fda.gov/media/144434/download) for\n",
    "Moderna at the Vaccines and Related Biological Products Advisory Committee Meeting,\n",
    "December 17, 2020."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math\n",
    "import numpy as np\n",
    "import scipy as sp\n",
    "from scipy.optimize import brentq  # Brent's root-finding algorithm\n",
    "# from scipy.stats import binom as sp.binom      # the Binomial distribution\n",
    "from scipy.special import binom "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "N_v, N_u = 13934, 13993  # vaccinated, unvaccinated\n",
    "x_v, x_u = 11, 185       # infected among vax, unvax\n",
    "r_v = x_v/N_v            # risk\n",
    "r_u = x_u/N_u\n",
    "rr = r_v/r_u"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9402887744928795"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 - rr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}