spec / sampling.mdon commit Merge branch 'master' of ssh://charles/tank/andrew/school/notes (3c2583b)
   1---
   2header-includes:
   3- \usepackage{amsmath}
   4- \newcommand*{\perm}[2]{{}^{#1}\!P_{#2}}%
   5- \newcommand*{\comb}[2]{{}^{#1}C_{#2}}%
   6---
   7
   8# Sampling and Distributions
   9
  10**Population** - set of all eligible members  
  11**Sample** - subset of population, may be representative of population  
  12**Random sample** - every element of population has equal chance of selection (exactly representative)  
  13**Population mean $\mu$** - mean of all values of one attribute in population. $\mu = {\Sigma \text{values} \over |\text{population}|}$  
  14**Sample mean $\overline{x}$** - mean of all values in a sample. Random variable.  
  15**Population proportion $p$** - proportion of defectives in population (100% certainty)  
  16**Sample proportion $\hat{p}$** - proportion of defectives in one sample (varies between samples)   
  17**Discrete random variable** - countable number of distinct values
  18
  19$$\sum \Pr(n)=1$$
  20
  21### Hypergeometric distribution
  22
  23$$\Pr(X=x) = {{\binom Dx \binom {N-d}{N-x}} \over{\binom Nn}}$$
  24
  25where $N$ is the size of population, $n$ is the size of the sample, and $D$ is the number of defectives in population
  26
  27On CAS: Interactive -> Distribution -> HyperGeoPdf
  28
  29### Generating random numbers
  30Catalog -> `rand(a,b)` generates a random number between $a$ and $b$  
  31`randlist(n,a,b)` generates $n$ random numbers between $a$ and $b$
  32
  33### Combinations
  34
  35$$^n C_r = {n! \over {r!\cdot (n-r)!}} = \binom nr$$
  36
  37$n$ is population, $r$ is sample (i.e. no of combinations of $r$ in $n$)
  38CAS: Advanced -> `nCr(n,r)` $= ^nC_r$  
  39
  40### Binomial distributions
  41
  42with replacement.
  43
  44probability of achieving $x$ successes in $n$ trials for random variable $X$:
  45
  46$$\Pr(X=x)=\binom nx p^x (1-p)^{n-x} \quad \text{for }x = 0,1,2, \dots, n$$
  47
  48where $p$ = probability of success on each trial
  49
  50##### Simulate on CAS:
  51
  52`randBin(sample size, p^, no of samples)`
  53
  54Can be used from Stats: Menu -> Stats -> Cal (bottom) -> Catalog -> Random Bin