```
+## Useful Formulas
+Sample Mean (sample statistic):
+$\bar{x}=\frac{\sum_{i=1}^n x_i}{n}$
+
+Standard deviation:
+$s=\sqrt{\frac{\sum_{i=1}^n (x_i-\bar{x})^2}{n-1}}$
+
+Variance:
+$var = s^2$
+
+Useful probability axioms:
+
+Complement:
+$\mbox{Pr}(A^c)=1-\mbox{Pr}(A)$
+
+Probability of two *independent* events both happening:
+Pr(A and B) = Pr(A) $\times$ Pr(B)
+
+Probability of one of two events happening:
+Pr(A or B) = Pr(A) + Pr(B) - Pr(A and B)
+
+Conditional probability:
+$\mbox{Pr}(A|B)=\frac{\mbox{Pr(A and B)}}{\mbox{Pr(B)}}$
+
+Population mean (population statistic):
+$\mu = \sum_{i=1}^{n}x\mbox{Pr}(x)$
+
+Z-score:
+$z=\frac{x-\mu}{\sigma}$
+
+Standard errors:
+
+$SE=\frac{\sigma}{\sqrt{n}}$
+
+$SE_{proportion}=\sqrt{\frac{p(1-p)}{n}}$
+
+Identifying outliers using Interquartile Range (IRQ):
+$Q_1 - 1.5 \times IQR, \quad Q_3 + 1.5 \times IQR$
+
+
## Section 2: Writing and Debugging R Code
### Debugging a Function
-## Useful Formulas
-Sample Mean (sample statistic):
-$\bar{x}=\frac{\sum_{i=1}^n x_i}{n}$ |
-Standard deviation:
-$s=\sqrt{\frac{\sum_{i=1}^n (x_i-\bar{x})^2}{n-1}}$ |
-Variance:
-$var = s^2$
-
-Useful probability axioms:
-$\mbox{Pr}(A^c)=1-\mbox{Pr}(A)$ | Pr(A and B) = Pr(A) $\times$ Pr(B) | Pr(A or B) = Pr(A) + Pr(B) - Pr(A and B)
-
-$\mbox{Pr}(A|B)=\frac{\mbox{Pr(A and B)}}{\mbox{Pr(B)}}$\\
-
-Population mean (population statistic):
-$\mu = \sum_{i=1}^{n}x\mbox{Pr}(x)$
-
-Z-score:
-$z=\frac{x-\mu}{\sigma}$
-
-$x=\mu + z\sigma$\\
-
-$\mbox{P}(x)=\frac{n!}{x!(n-x)!}p^x(1-p)^{n-x}$
- ~for~ $x=0,1,2,...,n$
-
-$\mu=np$, $\sigma=\sqrt{np(1-p)}$\\
-
-$\sigma_{\bar{x}}=\frac{\sigma}{\sqrt{n}}$
-
-$\sigma_{\hat{p}}=\sqrt{\frac{p(1-p)}{n}}$
-
-$Q_1 - 1.5 \times IQR, \quad Q_3 + 1.5 \times IQR$