|
75 | 75 | "cell_type": "markdown", |
76 | 76 | "metadata": {}, |
77 | 77 | "source": [ |
78 | | - "In this equation, we call $P(p)$ the prior (distribution), $P(D|p)$ the likelihood and $P(p|D)$ the posterior (distribution). The intuition behind the nomenclature is as follows: the prior is the distribution containing our knowledge about $p$ prior to the introduction of the data $D$ & the posterior is the distribution containing our knowledge about $p$ after considering the data $D$.\n", |
79 | | - "\n", |
| 78 | + "In this equation, we call $P(p)$ the prior (distribution), $P(D|p)$ the likelihood and $P(p|D)$ the posterior (distribution). The intuition behind the nomenclature is as follows: the prior is the distribution containing our knowledge about $p$ prior to the introduction of the data $D$ & the posterior is the distribution containing our knowledge about $p$ after considering the data $D$." |
| 79 | + ] |
| 80 | + }, |
| 81 | + { |
| 82 | + "cell_type": "markdown", |
| 83 | + "metadata": {}, |
| 84 | + "source": [ |
| 85 | + "**Note** that we're _overloading_ the term _probability_ here. In fact, we have 3 distinct usages of the word:\n", |
| 86 | + "- The probability $p$ of seeing a head when flipping a coin;\n", |
| 87 | + "- The resulting binomial probability distribution $P(D|p)$ of seeing the data $D$, given $p$;\n", |
| 88 | + "- The prior & posterior probability distributions of $p$, encoding our _uncertainty_ about the value of $p$." |
| 89 | + ] |
| 90 | + }, |
| 91 | + { |
| 92 | + "cell_type": "markdown", |
| 93 | + "metadata": {}, |
| 94 | + "source": [ |
80 | 95 | "**Key concept:** We only need to know the posterior distribution $P(p|D)$ up to multiplication by a constant at the moment: this is because we really only care about the values of $P(p|D)$ relative to each other – for example, what is the most likely value of $p$? To answer such questions, we only need to know what $P(λ|D)$ is proportional to, as a function of $p$. Thus we don’t currently need to worry about the term $P(D)$. In fact,\n", |
81 | 96 | "\n", |
82 | 97 | "$$P(p|D) \\propto P(D|p)P(p) $$\n", |
|
169 | 184 | "cell_type": "markdown", |
170 | 185 | "metadata": {}, |
171 | 186 | "source": [ |
172 | | - "### Other priors" |
| 187 | + "### The choice of the prior" |
173 | 188 | ] |
174 | 189 | }, |
175 | 190 | { |
176 | 191 | "cell_type": "markdown", |
177 | 192 | "metadata": {}, |
178 | 193 | "source": [ |
179 | | - "But wait! We've had to specify a prior. Discuss specification of priors. Motivate Jeffries prior and show equation for it. " |
| 194 | + "You may have noticed that we needed to choose a prior and that, in the small to medium data limit, this choice can affect the posterior. We'll briefly introduce several types of priors and then you'll use one of them for the example above to see the effect of the prior:\n", |
| 195 | + "\n", |
| 196 | + "- **Informative priors** express specific, definite information about a variable, for example, if we got a coin from the mint, we may use an informative prior with a peak at $p=0.5$ and small variance. \n", |
| 197 | + "- **Weakly informative priors** express partial information about a variable, such as a peak at $p=0.5$ (if we have no reason to believe the coin is biased), with a larger variance.\n", |
| 198 | + "- **Uninformative priors** express no information about a variable, except what we know for sure, such as knowing that $0\\leq p \\leq1$.\n", |
| 199 | + "\n", |
| 200 | + "Now you may think that the _uniform distribution_ is uninformative, however, what if I am thinking about this question in terms of the probability $p$ and Eric Ma is thinking about it in terms of the _odds ratio_ $r=\\frac{p}{1-p}$? Eric rightly feels that he has no prior knowledge as to what this $r$ is and thus chooses the uniform prior on $r$.\n", |
| 201 | + "\n", |
| 202 | + "With a bit of algebra (transformation of variables), we can show that choosing the uniform prior on $p$ amounts to choosing a decidedly non-uniform prior on $r$ and vice versa. So Eric and I have actually chosen different priors, using the same philosophy. How do we avoid this happening? Enter the **Jeffreys prior**, which is an uninformative prior that solves this problem. You can read more about the Jeffreys prior [here](https://en.wikipedia.org/wiki/Jeffreys_prior) & in your favourite Bayesian text book (Sivia gives a nice treatment). \n", |
| 203 | + "\n", |
| 204 | + "In the binomial (coin flip) case, the Jeffreys prior is given by $P(p) = \\frac{1}{\\sqrt{p(1-p)}}$.\n", |
| 205 | + "\n" |
180 | 206 | ] |
181 | 207 | }, |
182 | 208 | { |
|
0 commit comments