In: Statistics and Probability
Suppose the heights of students are normally distributed with mean 172 and variance 9.
a) Randomly pick two students. What's the probability that the first student is taller than the second student?
b) Randomly pick two students. What's the probability their average height is larger than 175?
Heights of students are normally distributed with mean 172 and variance 9
Thus X~ N(172 , 9 )
a) Randomly pick two students, to find probability that the first student is taller than the second student.
Now we don't have size neither have any idea about Randomly picked two students .
So we can do following things
Let us define two variables x and y correspond to two students .
Generate sample of size n = 100,500,1000 form X ~ N( 172 , 9 )
Choose random samples from generated sample of normal distribution of size n/2 for both variables
Now compare now variables.
We will use R Software
Command-
{
n=100
# sample size
r=rnorm(n,172,3)
# genrate samples from N(
= 172,
= 3)
for (i in
1:50)
# we will take 50 repitaions
{
x=sample(r,n/2)
# first student randomly selected from normal distribution
y=sample(r,n/2)
# second
student randomly selected from normal distribution
# probability that the first student is taller than the second student
# P(x>y)
prob[i]=length(which(x>y))/length(x)
# probability of first student taller than the second
student
}
OUTPUT -
> prob
[1] 0.44 0.36 0.54 0.44 0.56 0.44 0.44 0.40 0.50 0.44 0.60 0.54
0.54 0.60 0.52
[16] 0.56 0.46 0.52 0.50 0.50 0.52 0.54 0.46 0.46 0.48 0.56 0.58
0.46 0.46 0.50
[31] 0.46 0.50 0.46 0.46 0.48 0.50 0.46 0.52 0.54 0.54 0.44 0.42
0.52 0.48 0.52
[46] 0.40 0.50 0.60 0.52 0.50
> mean(prob)
[1] 0.4948
Now we will repeat same program for n= 1000
n=1000
r=rnorm(n,172,3)
for (i in 1:50)
{
x=sample(r,n/2)
y=sample(r,n/2)
prob[i]=length(which(x>y))/length(x)
}
OUTPUT -
> prob
[1] 0.502 0.480 0.476 0.504 0.472 0.492 0.514 0.476 0.518 0.488
0.504 0.500
[13] 0.524 0.520 0.502 0.538 0.504 0.506 0.484 0.478 0.486 0.512
0.488 0.490
[25] 0.508 0.482 0.504 0.502 0.522 0.526 0.516 0.502 0.520 0.508
0.514 0.486
[37] 0.538 0.538 0.538 0.512 0.504 0.482 0.522 0.494 0.482 0.472
0.504 0.478
[49] 0.522 0.496
> mean(prob)
[1] 0.5026
Conclusion
Form both output we can conclude that probability that the first student is taller than the second student
is approximately equal to 0.50
b)
Randomly pick two students. To find probability that their average height is larger than 175
i.e ( x + y )/2 > 175
Now Let T = ( x + y )/2
Given
= 172, = 3
To find P( T>175)
Now from CLT
Z = ( T - 172 ) / n1/2
But we don't have n
So we can use similar process used in part (a) now to find T > 175
Command
{
n
=1000
# sample size
r=rnorm(n,172,3)
for (i in
1:500)
# 500 iterations
{
x=sample(r,n/2)
y=sample(r,n/2)
avg=(x+y)/2
# avg = T =
( x + y ) / 2
prob[i]=length( which( avg>175
))/length(x)
# P( T>175)
}
mean(prob)
}
Output -
mean(prob)
# for n = 1000
[1] 0.079768
mean(prob) # for n = 1500
[1] 0.083408
mean(prob)
# for n = 1750
[1] 0.08051429
mean(prob)
# for n = 2000
[1] 0.082236
Conclusion probability their average height is larger than 175 is approximately = 0.08