From: Andrew Lorimer Date: Mon, 28 Jan 2019 06:45:12 +0000 (+1100) Subject: add to sampling notes (combiantorics & permutations) X-Git-Tag: yr12~277 X-Git-Url: https://git.lorimer.id.au/notes.git/diff_plain/ad1a07cfa82a26f0609e811c32b1847e38c42800 add to sampling notes (combiantorics & permutations) --- diff --git a/spec/sampling.md b/spec/sampling.md index 2205b4b..6ba0e05 100644 --- a/spec/sampling.md +++ b/spec/sampling.md @@ -1,21 +1,30 @@ +--- +header-includes: +- \usepackage{amsmath} +- \newcommand*{\perm}[2]{{}^{#1}\!P_{#2}}% +- \newcommand*{\comb}[2]{{}^{#1}C_{#2}}% +--- + # Sampling and Distributions **Population** - set of all eligible members **Sample** - subset of population, may be representative of population -**Random sample** - every element of population has equal chance of selection -**Population proportion $p$** - proportion of individuals in population with an attribute -**Sample proportion $\^p$** - +**Random sample** - every element of population has equal chance of selection (exactly representative) +**Population mean $\mu$** - mean of all values of one attribute in population. $\mu = {\Sigma \text{values} \over |\text{population}|}$ +**Sample mean $\overline{x}$** - mean of all values in a sample. Random variable. +**Population proportion $p$** - proportion of defectives in population (100% certainty) +**Sample proportion $\hat{p}$** - proportion of defectives in one sample (varies between samples) **Discrete random variable** - countable number of distinct values $$\sum \Pr(n)=1$$ ### Hypergeometric distribution -$$\Pr(X=x) = {{{\begin{Bmatrix} - D \\ - x \\ - \end{Bmatrix}}\begin{Bmatrix} {N-D} \\ {n-x} \end{Bmatrix} }\over\begin{Bmatrix}N \\ n \end{Bmatrix}}$$ +$$\Pr(X=x) = {{\binom Dx \binom {N-d}{N-x}} \over{\binom Nn}}$$ + +where $N$ is the size of population, $n$ is the size of the sample, and $D$ is the number of defectives in population +On CAS: Interactive -> Distribution -> HyperGeoPdf ### Generating random numbers Catalog -> `rand(a,b)` generates a random number between $a$ and $b$ @@ -23,7 +32,10 @@ Catalog -> `rand(a,b)` generates a random number between $a$ and $b$ ### Combinations -CAS: Advanced -> `nCr(n,r)` $= ^nC_r$ +$$^n C_r = {n! \over {r!\cdot (n-r)!}} = \binom nr$$ + +$n$ is population, $r$ is sample (i.e. no of combinations of $r$ in $n$) +CAS: Advanced -> `nCr(n,r)` $= ^nC_r$ ### Binomial distributions @@ -31,10 +43,12 @@ with replacement. probability of achieving $x$ successes in $n$ trials for random variable $X$: -$$\Pr(X=x)=\begin{Bmatrix} n \\ x \end{Bmatrix} p^x (1-p)^{n-x} \quad \text{for }x = 0,1,2, \dots, n$$ +$$\Pr(X=x)=\binom nx p^x (1-p)^{n-x} \quad \text{for }x = 0,1,2, \dots, n$$ where $p$ = probability of success on each trial -#### on CAS: +##### Simulate on CAS: + +`randBin(sample size, p^, no of samples)` -`randBin(sample size, p^, no of samples)` \ No newline at end of file +Can be used from Stats: Menu -> Stats -> Cal (bottom) -> Catalog -> Random Bin \ No newline at end of file