Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
BDA/BDA 3.10.7.ipynb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
71 lines (71 sloc)
2.22 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Problem 3.10.7\n", | |
"\n", | |
"Poisson and binomial distributions: a student sits on a street corner for an hour and records the number of bicycles $ b $ and the number of other vehicles $v$ that go by. Two models are considered: \n", | |
"\n", | |
"* The outcomes $b$ and $v$ have independent Poisson distributions, with unknown means $\\theta_b$ and $\\theta_v$ . \n", | |
"\n", | |
"* The outcome $b$ has a binomial distribution, with unknown probability $p$ and sample size $b + v$. \n", | |
"\n", | |
"Show that the two models have the same likelihood if we define $p = \\theta_b/( \\theta_b +\\theta_v)$.\n", | |
"\n", | |
"Gelman, Andrew; Carlin, John B.; Stern, Hal S.; Dunson, David B.; Vehtari, Aki; Rubin, Donald B.. Bayesian Data Analysis, Third Edition (Chapman & Hall/CRC Texts in Statistical Science) (Page 81). CRC Press. Kindle Edition. " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This problem has no computational element, it's a fact about poisson distributions. In the first case we have\n", | |
"$$\n", | |
"P(b=b_0)=\\frac{\\theta_b^{b_0}e^{-\\theta_b)}}{b_0!}\n", | |
"$$\n", | |
"and\n", | |
"$$\n", | |
"P(v=v_0)=\\frac{\\theta_v^{v_0}e^{-\\theta_v)}}{v_0!}\n", | |
"$$\n", | |
"It's also a fact that the sum of two poisson variables with rates $\\theta_v$ and $\\theta_b$ is poisson with \n", | |
"rate $\\theta_v+\\theta_b$. \n", | |
"\n", | |
"A direct calculation gives \n", | |
"$$\n", | |
"P(b=b_0,v=v_0|b_0+v_0=N)=\\binom{N}{b_0}\\frac{\\theta_b^{b_0}\\theta_v^{N-b_0}}{(\\theta_b+\\theta_v)^{N}}\n", | |
"$$\n", | |
"which is what we're supposed to show." | |
] | |
}, | |
{ | |
"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.6.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |