Math - Random Variables and Distributions (Notes)

Random Variable

  • Let the sample space of a random experiment be S, X = X(e) is a real-valued single-valued function defined on sample space S. X = X(e) is called a random variable.
  • Essentially a function about basic events, where the independent variable is the basic event and the dependent variable is the function value.

Random Experiment:

Must satisfy:

  • (1) Repeatability: The experiment can be repeated under the same conditions;

  • (2) Knowability: Each experiment has more than one possible result, and all possible results of the experiment can be clearly identified in advance;

  • (3) Uncertainty: Before conducting an experiment, it’s impossible to determine which result will appear, but one of the results must appear.

Sample Space:

The set of all basic results of a random experiment is called the sample space. Elements of the sample space are called sample points or basic events. That is, the sample space is essentially a set, where each element is a result of a random experiment.

Sample and Random Variable:

Samples in mathematical statistics have duality, meaning samples can be viewed both as a set of observed values and as random variables.

  • First, before sampling. The observed values of the sample cannot be determined, so it can be viewed as a random variable.

  • Second, after the sample is drawn and observed, the sample has specific observed values, so it can be viewed as a set of determined values.

Probability Distribution

Let’s look at the simplest coin toss event. Theoretically, the probability of heads and tails is 50%

Figure 2

Try with Code


function flipCoin(){
    for (let index = 0; index < 10; index++) {
        // Round the random number
        let randomNum = Math.round(Math.random())
        // If random is 1, it's heads
        if(randomNum === 1){
            console.log('Heads')
        }else{
            console.log('Tails')
        }
    }

}

flipCoin()

Results after 10 attempts:

Figure 3

After 1000 attempts:

Figure 4

  • The more sampling times we count, the closer we get to the theoretical situation

  • Probability distribution actually describes the probability pattern of random variables.

Discrete Distribution Models

Bernoulli Distribution

This is the distribution of a single random variable, and this variable can only take two values, 0 or 1.

Figure 5

or

Figure 6

Example:

Suppose you're having a child, probability of boy is p, probability of girl is 1-p

Bernoulli experiment: Have one child

Bernoulli distribution: Have one child, probability of boy is p, probability of girl is 1-p, this is the Bernoulli distribution

Figure 7

Categorical Distribution (also called Multinoulli Distribution)

It describes a single random variable with k different states. Here k is a finite number. When k is 2, the categorical distribution becomes the Bernoulli distribution. I’ve listed the formula and diagram for this distribution.

Figure 8

Normal Distribution

Formula: Figure 9

There are two parameters in this formula, μ represents the mean, σ represents the variance.

Figure 10

Article Link:

https://alili.tech/en/archive/6mchh1x7mrv/

# Latest Articles