- \begin{cas}
- \begin{enumerate}[leftmargin=3mm]
- \item Spreadsheet
- \item In cell A1:\\ \path{mean(randNorm(sd, mean, sample size))}
- \item Edit \(\rightarrow\) Fill \(\rightarrow\) Fill Range
- \item Input range as A1:An where \(n\) is the number of samples
- \item Graph \(\rightarrow\) Histogram
- \end{enumerate}
- \end{cas}
-
- \subsubsection*{Sample size of \(n\)}
-
- \[ \overline{X} = \sum_{i=1}^n \frac{x_i}{n} = \dfrac{\sum x}{n} \]
-
- Sample mean is distributed with mean \(\mu\) and sd \(\frac{\sigma}{\sqrt{n}}\) (approaches these values for increasing sample size \(n\)).
-
- For a new distribution with mean of \(n\) trials, \(\operatorname{E}(X^\prime) = \operatorname{E}(X), \quad \operatorname{sd}(X^\prime) = \dfrac{\operatorname{sd}(X)}{\sqrt{n}}\)
-
- \begin{cas}
-
- \begin{itemize}
- \item Spreadsheet \(\rightarrow\) Catalog \(\rightarrow\) \verb;randNorm(sd, mean, n); where \verb;n; is the number of samples. Show histogram with Histogram key in top left
- \item To calculate parameters of a dataset: Calc \(\rightarrow\) One-variable
- \end{itemize}
-
- \end{cas}
-
- \subsection*{Normal distributions}
-
-
- \[ Z = \frac{X - \mu}{\sigma} \]
-
- Normal distributions must have area (total prob.) of 1 \(\implies \int^\infty_{-\infty} f(x) \> dx = 1\) \\
- \(\text{mean} = \text{mode} = \text{median}\)
-
- \begin{warning}
- Always express \(z\) as +ve. Express confidence \textit{interval} as ordered pair.
- \end{warning}
-
- \pgfmathdeclarefunction{gauss}{2}{%
- \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
- }
- \pgfkeys{/pgf/decoration/.cd,
- distance/.initial=10pt
- }
- \pgfdeclaredecoration{add dim}{final}{
- \state{final}{%
- \pgfmathsetmacro{\dist}{5pt*\pgfkeysvalueof{/pgf/decoration/distance}/abs(\pgfkeysvalueof{/pgf/decoration/distance})}
- \pgfpathmoveto{\pgfpoint{0pt}{0pt}}
- \pgfpathlineto{\pgfpoint{0pt}{2*\dist}}
- \pgfpathmoveto{\pgfpoint{\pgfdecoratedpathlength}{0pt}}
- \pgfpathlineto{\pgfpoint{(\pgfdecoratedpathlength}{2*\dist}}
- \pgfsetarrowsstart{latex}
- \pgfsetarrowsend{latex}
- \pgfpathmoveto{\pgfpoint{0pt}{\dist}}
- \pgfpathlineto{\pgfpoint{\pgfdecoratedpathlength}{\dist}}
- \pgfusepath{stroke}
- \pgfpathmoveto{\pgfpoint{0pt}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgfdecoratedpathlength}{0pt}}
- }}
- \tikzset{dim/.style args={#1,#2}{decoration={add dim,distance=#2},
- decorate,
- postaction={decorate,decoration={text along path,
- raise=#2,
- text align={align=center},
- text={#1}}}}
- }
- \begin{figure*}[hb]
- \centering
- \begin{tikzpicture}
- \begin{axis}[every axis plot post/.style={
- mark=none,domain=-3:3,samples=50,smooth},
- axis x line=bottom,
- axis y line=left,
- enlargelimits=upper,
- x=\textwidth/10,
- ytick={0.55},
- yticklabels={\(\frac{1}{\sigma \sqrt{2\pi}}\)},
- xtick={-2,-1,0,1,2},
- x tick label style = {font=\footnotesize},
- xticklabels={\((\mu-2\sigma)\), \((\mu-\sigma)\), \(\mu\), \((\mu+\sigma)\), \((\mu+2\sigma)\)},
- xlabel={\(x\)},
- every axis x label/.style={at={(current axis.right of origin)},anchor=north west},
- every axis y label/.style={at={(axis description cs:-0.02,0.2)}, anchor=south west, rotate=90},
- ylabel={\(\Pr(X=x)\)}]
- \addplot {gauss(0,0.75)};
- \fill[red!30] (-3,0) -- plot[id=f3,domain=-3:3,samples=50] function {1/(0.75*sqrt(2*pi))*exp(-((x)^2)/(2*0.75^2))} -- (3,0) -- cycle;
- \fill[darkgray!30] (3,0) -- plot[id=f3,domain=-3:3,samples=50] function {1/(0.75*sqrt(2*pi))*exp(-x*x*0.5/(0.75*0.75))} -- (3,0) -- cycle;
- \fill[lightgray!30] (-2,0) -- plot[id=f3,domain=-2:2,samples=50] function {1/(0.75*sqrt(2*pi))*exp(-x*x*0.5/(0.75*0.75))} -- (2,0) -- cycle;
- \fill[white!30] (-1,0) -- plot[id=f3,domain=-1:1,samples=50] function {1/(0.75*sqrt(2*pi))*exp(-x*x*0.5/(0.75*0.75))} -- (1,0) -- cycle;
- \begin{scope}[<->]
- \draw (-1,0.35) -- (1,0.35) node [midway, fill=white] {68.3\%};
- \draw (-2,0.25) -- (2,0.25) node [midway, fill=white] {95.5\%};
- \draw (-3,0.15) -- (3,0.15) node [midway, fill=white] {99.7\%};
- \end{scope}
- \begin{scope}[-, dashed, gray]
- \draw (-1,0) -- (-1, 0.35);
- \draw (1,0) -- (1, 0.35);
- \draw (-2,0) -- (-2, 0.25);
- \draw (2,0) -- (2, 0.25);
- \draw (-3,0) -- (-3, 0.15);
- \draw (3,0) -- (3, 0.15);
- \end{scope}
- \end{axis}
- \begin{axis}[every axis plot post/.append style={
- mark=none,domain=-3:3,samples=50,smooth},
- axis x line=bottom,
- enlargelimits=upper,
- x=\textwidth/10,
- xtick={-2,-1,0,1,2},
- axis x line shift=30pt,
- hide y axis,
- x tick label style = {font=\footnotesize},
- xlabel={\(Z\)},
- every axis x label/.style={at={(axis description cs:1,-0.25)},anchor=south west}]
- \addplot {gauss(0,0.75)};
- \end{axis}
- \end{tikzpicture}
- \end{figure*}
-
- \subsection*{Confidence intervals}