Processing math: 100%

Random Variables

Matthew J. Crossley

2025

Core Concepts

  • Random Variable: Process generating random outcomes.

  • Sample: Outcomes from a random variable.

  • Descriptive Statistics: Summary of a sample.

  • Inferential Statistics: Educated guess about the random variable that generated a sample.

Random Variable

  • Process that generates random outcomes.

  • Tied to a population.

  • Has possible outcomes defined by a sample space.

  • Is fundamentally defined by a probability distribution.

Population

  • A population is the entire set of things under study.

  • E.g., all people in the world, all possible people in the world, all the neurons in the universe, the set of all possible action potential times relative to stimulus onset etc.

Sample Space

  • The set of all possible outcomes of a random variable.

  • E.g., the set of all possible rolls of a die is {1,2,3,4,5,6}. It is discrete and finite.

  • E.g., the set of all possible action potential times relative to stimulus onset spans the interval (0,). It is continuous and infinite.

Probability Distribution

  • Describes the likelihood of each outcome in the sample space.

  • Discrete: A function that gives the probability of each outcome.

  • Continuous: A function that gives the probability density for each outcome.

Probability Distribution Recipe

  • The sample space goes on the x-axis.

  • The probability of each outcome goes on the y-axis.

Probability Mass Function

  • For a discrete random variable, the probability mass function (PMF) gives the probability of each outcome.

  • Example: For a biased coin, the PMF is

    P(X=x)={0.3if x=heads0.7if x=tails

  • Example: For a fair six-sided die, the PMF is P(X=x)=16 for x{1,2,3,4,5,6}.

  • Example: flipping a coin three times
Toss 1 Toss 2 Toss 3
H H H
H H T
H T H
H T T
T H H
T H T
T T H
T T T

Probability Density Function

  • For a continuous random variable, the probability density function (PDF) gives the probability density for each outcome.

  • Example: Distribution of heights in Australia

  • Sample space: (0,)

  • Example: For a normal distribution with mean μ=0 and standard deviation σ=1, the PDF is

    f(x)=12πex22

Computing Probabilities from Distributions

  • Discrete case: The probability of a particular outcome x is P(X=x).

  • Read this from a probability table or plot.

  • Example: Probability of 7 Heads in 10 Flips

Computing Probabilities from Distributions

  • Continuous case: The probability of a range of values is the area under the curve.

  • Example: The probability of reaction time between 400-600 ms.

  • Example: Probability of Reaction Time between 400-600 ms

Sampling from a Random Variable: Discrete

  • Consider a biased coin with PMF P(X=x)=0.3 for heads and P(X=x)=0.7 for tails.

  • Samples obtained from this distrubtion are random sequences of heads and tails.

  • Because the coin is biased, we expect to see more tails than heads.

Sample from a Random Variable: Continuous

Quiz Question 1

A six-sided die is rolled, and the outcome is recorded. Which of the followin best describes the probability distribution of this random variable?

A. A probability density function (PDF) because the outcome is continuous.

B. A probability mass function (PMF) because the outcome is discrete.

C. A cumulative distribution function (CDF) because the outcome is deterministic.

D. A uniform density function because the outcome is continuous.

Click to see the solution

Correct Answer: B. A probability mass function (PMF) because the outcome is discrete.

Quiz Question 2

A researcher is studying the distribution of human reaction times in milliseconds (ms) to a visual stimulus. The reaction time is measured as a continuous variable. Which of the following best describes the probability distribution used to model this data?

A. A probability mass function (PMF) because reaction time is discrete.

B. A probability density function (PDF) because reaction time is continuous.

C. A cumulative distribution function (CDF) because reaction time is always increasing.

D. A binomial distribution because reaction time is categorical.

Click to see the solution

Correct Answer: B. A probability density function (PDF) because reaction time is continuous.

Quiz Question 3

You are rolling a fair six-sided die and want to compute the probability of rolling a number greater than 4.

Which of the following correctly calculates this probability?

A. P(X>4)=16+16=26=13

B. P(X>4)=1P(X4)=146=13

C. P(X>4)=P(X=5)×P(X=6)=16×16=136

D. P(X>4)=P(X=4)+P(X=5)+P(X=6)=36=12

Click to see the solution

Correct Answer: A and B

  • The valid outcomes for X>4 are rolling a 5 or a 6.

  • Since the die is fair, P(X=5)=16 and P(X=6)=16.

  • Therefore,

    P(X>4)=P(X=5)+P(X=6)=16+16=26=13

  • Alternatively, using the complement rule:

    P(X>4)=1P(X4)=146=13

Quiz question 4

A probability density function (PDF) is defined as follows:

  • f(x)=0.1 for 0x3

  • f(x)=0.2 for 3<x5

  • f(x)=0 otherwise

  • See next slide for the PDF plot.

  • See next slide for quiz question.

What is the probability that a randomly drawn value from this distribution falls between x=2 and x=5?

A. 0.1×(32)+0.2×(53)=0.1+0.4=0.5

B. 0.1×(52)=0.3

C. 0.2×(52)=0.6

D. 0.1×(32)+0.2×(53)+0.1×(54)=0.1+0.4+0.1=0.6

  • See next slide for solution.

Click to see the solution

Correct Answer: A

The probability is the area under the PDF curve from x=2 to x=5. Since the PDF consists of two rectangular sections, we compute the total area using basic geometry:

  1. From x=2 to x=3, the height is 0.1, and the width is (32)=1:
    Area=0.1×1=0.1

  2. From x=3 to x=5, the height is 0.2, and the width is (53)=2:
    Area=0.2×2=0.4

  3. Total probability:
    P(2X5)=0.1+0.4=0.5