spec / sampling.mdon commit add summary notes for end of ICB (e2c1584)
   1# Sampling and Distributions
   2
   3**Population** - set of all eligible members  
   4**Sample** - subset of population, may be representative of population  
   5**Random sample** - every element of population has equal chance of selection  
   6**Population proportion $p$** - proportion of individuals in population with an attribute  
   7**Sample proportion $\^p$** -
   8**Discrete random variable** - countable number of distinct values
   9
  10$$\sum \Pr(n)=1$$
  11
  12### Hypergeometric distribution
  13
  14$$\Pr(X=x) = {{{\begin{Bmatrix}
  15  D \\
  16  x \\
  17  \end{Bmatrix}}\begin{Bmatrix} {N-D} \\ {n-x} \end{Bmatrix} }\over\begin{Bmatrix}N \\ n \end{Bmatrix}}$$
  18
  19
  20### Generating random numbers
  21Catalog -> `rand(a,b)` generates a random number between $a$ and $b$  
  22`randlist(n,a,b)` generates $n$ random numbers between $a$ and $b$
  23
  24### Combinations
  25
  26CAS: Advanced -> `nCr(n,r)` $= ^nC_r$
  27
  28### Binomial distributions
  29
  30with replacement.
  31
  32probability of achieving $x$ successes in $n$ trials for random variable $X$:
  33
  34$$\Pr(X=x)=\begin{Bmatrix} n \\ x \end{Bmatrix} p^x (1-p)^{n-x} \quad \text{for }x = 0,1,2, \dots, n$$
  35
  36where $p$ = probability of success on each trial
  37
  38#### on CAS:
  39
  40`randBin(sample size, p^, no of samples)`