Created
October 24, 2012 09:18
-
-
Save suminb/3945038 to your computer and use it in GitHub Desktop.
Binomial Likelihood Function
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
# | |
# Example from: http://warnercnr.colostate.edu/~gwhite/fw663/BinomialLikelihood.PDF | |
# | |
from math import factorial | |
# Number of flips | |
n = 11 | |
# Number of heads | |
y = 7 | |
# Binomial likelihood function | |
L = lambda p: C(n, y) * p**y * (1-p)**(n-y) | |
# Combinations | |
C = lambda n, y: factorial(n)/(factorial(y) * factorial(n-y)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment