Probability and statistics formulas

 Discrete random variables (Lecture 3) 

expected value of X (mean)

Median value

Variance

Binomial probability P(X): probability of getting X successes

Mean, variance and Sd of Binomial

Poisson distribution probability 

Poisson mean and variance


Continuous random variables (Lecture 4) 

f(x) is probability density function (pdf)

Uniform distribution

Normal distribution probability

Exponential distribution

Introduction to statistics (Lecture 5)

Nominal – categories only
Ordinal – categories with some order
Interval – differences but no natural starting point
Ratio – differences and a natural starting point


Python code for Binomial and Poisson
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import operator as op
from functools import reduce
import math

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def binomial(n, p, x):
    return ncr(n,x)*math.pow(p,x)*math.pow(1-p,n-x)

def poisson(lamda, x):
    return math.pow(math.e,-lamda)* (math.pow(lamda,x)/math.factorial(x))

Comments

Popular posts from this blog

Lecture and Tutorial Links (sem 3)

Lecture and Tutorial links (sem 4)