Home > Mobile >  How to use normal distribution to calculate probability that one player will score more points than
How to use normal distribution to calculate probability that one player will score more points than

Time:10-21

Please help me set this problem up in R:

Alex is expected to score a mean of 2 points, normally distributed with a SD of 2 points. Bob is expected to score a mean of 1 point, normally distributed with a SD of 3 points.

What is the probability that Alex scores more points than Bob?

CodePudding user response:

If you want simulation, using rnorm function that generates normal distribtion.

n <- 1000000
Alex <- rnorm(n, 2, 2)
Bob <- rnorm(n, 1, 3)
sum(Alex>Bob)/n

[1] 0.610427

CodePudding user response:

Written in R code, the text book solution is

mu_Alex <- 2
sd_Alex <- 2
mu_Bob <- 1
sd_Bob <- 3

The question asks for P(A > B) = P(A - B > 0).
Let D = A - B and compute the mean and variance of the difference. Don't forget that the variance is a quadratic operator, so the variances add up. Then take the square root.

mu_Diff <- mu_Alex - mu_Bob
var_Diff <- sd_Alex^2   sd_Bob^2
sd_Diff <- sqrt(var_Diff)

Transform to standard gaussian. (This is not quite right, what I'm transforming to standard gaussian is the zero in A - B > 0)

z_Diff <- (0 - mu_Diff)/sd_Diff

And get the upper tail, since we want P(D > 0).

pnorm(z_Diff, mean = mu_Diff, sd = sd_Diff, lower.tail = FALSE)
#[1] 0.6384329

Park's simulation is not very far from the exact value.

  • Related