# Random Variables

**Discrete and Continuous Random Variables**

**Discrete and Continuous Random Variables**

A **variable** is a quantity whose value changes. If the value is a numerical outcome of a random phenomenon, the variable is called** random variable **denoted by a** capital letter.**

**Discrete variable**

**Discrete variable**

Variable whose value is obtained by counting

Has a countable number of possible values

Representation:

**Histogram**Example: number of students present, number of heads when flipping three coins

**Continuous variable **

**Continuous variable**

Variable whose value is obtained by measuring

Takes all values in a given interval of numbers

Representation:

**Density Curve**The probability that X is between an interval of numbers is the area under the density curve between the interval endpoints

Examples: height of students in class, time it takes to get to school

## Expectation and Variance

**Expectation**

**Expectation**

Describes the

**average value(mean)**of X, written as**E(X) or**$\mu$$E(X) = \Sigma xP(x)$ for discrete random variables

**What is the expected value when we roll a fair die?**

There are six possible outcomes: 1, 2, 3, 4, 5, 6.

Each of these has a probability of 1/6 of occurring. Let X represent the outcome of the experiment.

Therefore P(1) = 1/6 (the probability that you throw a 1 is 1/6) P(2) = 1/6 P(3) = 1/6 P(4) = 1/6 P(5) = 1/6 P(6) = 1/6

E(X) = 1×P(1) + 2×P(2) + 3×P(3) + 4×P(4) + 5×P(5) + 6×P(6) => 1/6 + 2/6 + 3/6 + 4/6 + 5/6 + 6/6 => 7/2 => 3.5

Expectation is 3.5

### Variance

Describes the

**spread**(amount of variability) around the expectation, written as Var(X)$Var(X) = E[ (X – \mu )^2 ] = E(X^2) -\mu ^2$

$\mu : Expectation/mean$

$E(X^2): \Sigma x^2P(x)$

**Note: Standard deviation**$\sigma$ is the square root of**variance**

## Joint, Marginal, and Conditional Probabilities

### Marginal probability

The probability of an event occurring

**Formula**: $P(A)$Example: the probability that a card drawn is red (p(red) = 0.5)

### Condititional probability

The probability of event A occurring, given that event B occurs or is true

**Formula**: $P(A|B)=\frac{P(A\cap B)}{P(B)}$Note: $P(A\cap B)$ can be written as $P(AB)$

Example: Given that you drew a red card (26 cards), what’s the probability that it’s a four (2 cards). (P(four|red))=2/26=1/13

### Joint probability

The probability of event A

**and**event B occurring**Formula**:$P(A\cap B) = P(A|B) P(B)$

$P(A\cap B) = P(B|A) P(A)$

Example: the probability that a card is a four and red =p(four and red) = 2/52=1/26

**Links:
**- http://www.henry.k12.ga.us/ugh/apstat/chapternotes/7supplement.html
- https://revisionmaths.com/advanced-level-maths-revision/statistics/expectation-and-variance
- http://www.statisticalengineering.com/joint_marginal_conditional.htm
- https://sites.nicholas.duke.edu/statsreview/jmc/**
**

Last updated