Random Variables

STAT 240 - Fall 2025

Robert Sholl

Definitions

Random Variable

A rule for assigning a numeric value to each outcome of a random experiment.

\[ X = \{\text{The number of heads in three coin flips}\} \]

\[ Y = \{\text{The sum of two dice rolls}\} \]

Support

The set of possible values a random variable can be.

\[ S_X = \{0,1,2,3\} \]

\[ S_Y = \{2,3,...,11,12\} \]

Notation

  • \(X\) represents the proposed random variables

    • It has possible values, but no actual value
  • \(x\) represents a realization of the random variable \(X\)

\[ P(X = x) \Rightarrow \text{The probability that r.v. X realizes to x} \]

\[ P(X > x) \Rightarrow \text{The probability that r.v. X realizes greater than x} \]

Discrete Random Variables

Distribution

Formally: The function that dictates the generation and moments of a random element.

  • Think of all of our measures of center, spread, and position

  • Those uniquely identify a grouping of data

  • Something fundamentally controls what those measures should be

Discrete Distributions

  • Discrete random variables have mass to their probability

  • Probability mass functions satisfy the following

\[ 0 \le P(X=x) \le 1 \]

\[ \sum_x P(X=x) = 1 \]

Moments

Measures related to the shape of a function’s graph

We care about two moments right now

\[ \mathbb{E}X \Rightarrow \text{Expectation} \]

\[ \mathbb{V}X \Rightarrow \text{Variance} \]

Discrete Expectation

For discrete random variables:

\[ \mathbb{E}X = \sum_xxP(X=x) \]

  • The sum of all values of the r.v.

    • Weighted by their probabilities

Discrete Variance

For discrete random variables:

\[ \mathbb{V}X = \sum_x (x-\mathbb{E}X)^2P(X=x) \]

  • The sum of the squared differences between all values and the expectation

    • Weighted by their probabilities

Inference

  • Expectation: long-run average, as \(n \rightarrow \infty\) the expectation is the center of the r.v.

  • Variance: long-run spread, as \(n \rightarrow \infty\) the variance is the squared spread of the r.v.

    • We can make variance more interpretable (and useful overall)

\[ \sqrt{\mathbb{V}X} = \sigma_X \]

  • Standard deviation functions the same as before

In Practice

Let \(X\) represent the number of caffeinated beverages anyone in the class consumes daily

  • Determine the distribution of \(X\)

  • Find the expected value of \(X\)

  • Find the variance and standard deviation of \(X\)

Your Turn

  • Determine the distribution of \(Y\)

  • Find the expected value of \(Y\)

  • Find the variance and standard deviation of \(Y\)

Continuous Random Variables

Definition

Continuous random variable: The support consists of all numbers in an interval of the real number line and are uncountable infinite.

\[ \begin{aligned} \text{Let } \ X & = \{\text{the body mass of a dairy cow}\} \\ \\ S_X & = (0,\infty) \end{aligned} \]

Theory

Theory

Theory

Theory

Continuous Distributions

  • Continuous random variable probabilities are discussed as densities

  • Probability density functions must satisfy similar rules to PMFs

    • There’s an issue though

\[ \int_{-\infty}^{\infty} f(x) dx = 1 \]

\[ 0 \le \int_a^bf(x)dx \le 1 \]

Probability Density

By definition continuous probabilities are the area under the curve between two values within the distribution.


I have two rules for my class:

  1. I won’t invite the formal practice of calculus into my classroom

  2. I’ll burn at the stake before I use trigonometry

Probability Density

Probability Density

Continuous Probabilities

Equality

Uniform Distributions

Moments

\[\mathbb{E}X=\int_{-\infty}^\infty x \ f(x)dx\]

\[\mathbb{E}X^2=\int_{-\infty}^\infty x^2 \ f(x)dx\]

\[\mathbb{V}X=\mathbb{E}X^2-(\mathbb{E}X)^2\]

Alternate Methods

If you take STAT 341 (Biometrics II) you’ll have to be able to calculate these things. But that class doesn’t require advanced calculus.

  • Sample interpolation

    • Guess exclusively from samples
  • Numerical Quadrature

    • Draw boxes underneath the curve and calculate their areas
  • Monte Carlo Simulation

Distribution Theory

Another alternate option would be to calculate everything once and then force the data to look like our calculations

  • This is the motivation behind the field of Distribution Theory

  • There’s three important distributions we’ll talk about:

    • Symmetric curves

    • Coin flips

    • Uniform bars

Go Away