# Week 1 Lecture 2 ## Frequency and Relative Frequency In a dataset for some **discrete** (=finite outcomes) variable x: * The **frequency** of any particular value that x can take is defined to be the number of occurrences of that value in the dataset. * The **relative frequency** of a value is defined to be the fraction or proportion of occurrences of that value in the dataset: $$ \begin{array}{c} \text { relative frequency } \\ \text { of a value } k \end{array}=\frac{\text { number of times the value } k \text { occurs }}{\text { total number of observations in the data set }} $$ ### Examples ![](https://i.imgur.com/WrDocnm.png) ## Histograms Steps to construct a histogram: 1. Choose the number of classes for variable x. A general rule of thumb is: $$ \text{number of classes} \approx \sqrt{\text{number of observations}} $$ 2. Determine the frequency and relative frequency of each possible class fo x. 3. Mark all possible classes on the horizontal axis. 4. Draw a rectangle/bar whose height is the **frequency** or **relative frequency** of the corresponding class. ### Examples ![](https://i.imgur.com/h0QGZdf.png) ![](https://i.imgur.com/HKh5Pn0.png) ![](https://i.imgur.com/fyjmEpe.png) ![](https://i.imgur.com/kqdX64z.png) ### Bivariate histograms Histograms that show the distribution of two variables. ![](https://i.imgur.com/r5HPvNz.png) ## Set Theory ### Operations in Set Theory * **Complement** of an event A, A^c^, is the set of all outcomes in Ω (sample space) that are not contained in A. i.e. Ω\A * **Intersection** of two events A and B, is denoted by A ∩ B is the event consisting of all outcomes that are in **both** A and B. * **Union** of two events A and B, A ∪ B, is the event consisting of all outcomes that are **either** in A or in B. ![](https://i.imgur.com/B0ntE8K.png) ### Events **Null event** is an event that consists of no outcomes, ∅. This symbol ∅ is also called the "empty set" or "null set";. Events A and B are said to be **mutually exclusive** or **disjoint** events if A ∩ B = ∅. Events A~1~, A~2~, A~3~,... are mutually exclusive (or pairwise disjoint) if no two events have any outcome in common. ### DeMorgan's Laws $$ (A \cup B)^{c}=A^{c} \cap B^{c} \\ (A \cap B)^{c}=A^{c} \cup B^{c} $$ ## Probability Given an experiment and a sample space Ω, the **probability** of an event A is defined to be a number that represents some measure of the chance that A will occur. This is denoted as Pr(A) (or also P(A)). Let X denote the outcome variable from tossing a coin, and H represents the outcome of tossing heads. We can write Pr({H})=0.5 or Pr(X=H) = 0.5, to mean that event {H} has a probability of 0.5. {H} means a compound event of H. ### Axioms of Probability * Axiom 1: For any event A, $Pr(A) \ge 0$ * Axiom 2: $Pr(\Omega) = 1$ * Axiom 3: Any (countably) infinite sequence of mutually exclusive (disjoint) events A~1~, A~2~, A~3~,... satsifies: $$ \operatorname{Pr}\left(A_{1} \cup A_{2} \cup A_{3} \cup \ldots\right)=\sum_{i=1}^{\infty} \operatorname{Pr}\left(A_{i}\right) $$ #### Example ![](https://i.imgur.com/KUOiOFd.png) ![](https://i.imgur.com/eoRGOLt.png) **Proof that null events have zero probability** ![](https://i.imgur.com/hPeumv2.png) **Proof regarding finite sequence of mutually exclusive events** ![](https://i.imgur.com/HgYN6Dm.png) **Proof regarding complements of events** ![](https://i.imgur.com/WT6E1nM.png) **Proof regarding range of probability** ![](https://i.imgur.com/YCzUyLa.png) ### Properties of Probability * Pr(∅) = 0 * For mutually exclusive events A~1~,...,A~n~, $Pr(A_1\cup...\cup A_n) = Pr(A_1)+...+Pr(A_n)$ * For any event A, $Pr(A^c)=1-Pr(A)$ * For any event A, $0 \le Pr(A) \le 1$. ### ∅ For a null event ∅, we know that Pr(empty;) = 0. However, Pr(A) = 0 does not mean we must have A=∅ e.g. Randomly pick a number n in the range [1,∞). The probability that n=500 is 0, but the event {n=500} is not a null event. ### 1 Probability 1 does not mean "always occurs". Conversely, using the same example, P(n≠500) =1. However, this does not mean that P is always not equals to 500. ### Example ![](https://i.imgur.com/NDhKgst.png) ![](https://i.imgur.com/kfw0987.png) ![](https://i.imgur.com/z7Hx2Sa.png) ![](https://i.imgur.com/Wnxo3n5.png) ![](https://i.imgur.com/ZxfvlIw.png) ![](https://i.imgur.com/hRmkR6W.png) ![](https://i.imgur.com/2g99Fxo.png) ![](https://i.imgur.com/xIruWAx.png)