5-3. Probability Computations for General Normal Random Variables

概率计算

1. Standard Normal Random Variable

If XX is a normally distributed random variable with mean μμ and standard deviation σσ , then

P(a<X<b)=P(aμσ<Z<bμσ)P(a<X<b)=P(\frac{a−μ}{σ}<Z<\frac{b−μ}{σ})

where ZZ denotes a standard normal random variable. aa can be any decimal number or −∞ ; bb can be any decimal number or .

EXAMPLE 9. Let XX be a normal random variable with mean μ=10μ = 10 and standard deviation σ=2.5σ = 2.5 . Compute the following probabilities.

  1. P(X<14).P(X < 14).

  2. P(8<X<14).P(8<X<14).

[ Solution ]

1.P(X<14)=P(Z<14μσ)=P(Z<14102.5)=P(Z<1.60)=0.94521. P(X<14)=P(Z<\frac{14−μ}{σ})=P(Z<\frac{14−10}{2.5})=P(Z<1.60)=0.9452

2.P(8<X<14)=P(8102.5<Z<14102.5)=P(0.80<Z<1.60)=0.94520.2119=0.73332. P(8<X<14)=P(\frac{8−10}{2.5}<Z<\frac{14−10}{2.5})=P(−0.80<Z<1.60)=0.9452−0.2119=0.7333

library(Rstat)

# 1-1. Compute P(X<14)
mu <- 10; sd <- 2.5
a <- 0; b <- 14
pnorm(b, mean=mu, sd=sd) - pnorm(a, mean=mu, sd=sd)

# 1-2. Plot
norm.trans(mu, sd, a=a, b=b)

# 2-1. Compute P(8<X<14)
a <- 8; b <- 14
pnorm(b, mean=mu, sd=sd) - pnorm(a, mean=mu, sd=sd)

# 2-2. Plot
norm.trans(mu, sd, a=a, b=b)

EXAMPLE 10. The lifetimes of the tread of a certain automobile tire are normally distributed with mean 37,500 miles and standard deviation 4,500 miles. Find the probability that the tread life of a randomly selected tire will be between 30,000 and 40,000 miles.

[ Solution ]

P(30<X<40)=P(30μσ<Z<40μσ)P(30<X<40)=P(\frac{30−μ}{σ}<Z<\frac{40−μ}{σ}) =P(3037.54.5<Z<4037.54.5)=P(\frac{30−37.5}{4.5}<Z<\frac{40−37.5}{4.5}) =P(1.67<Z<0.56)=0.71230.0475=0.6648=P(−1.67<Z<0.56)=0.7123−0.0475=0.6648

library(Rstat)

# 1-1. Compute P(30<X<40)
mu <- 37.5; sd <- 4.5
a <- 30; b <- 40
pnorm(b, mean=mu, sd=sd) - pnorm(a, mean=mu, sd=sd)

# 1-2. Plot
norm.trans(mu, sd, a=a, b=b)

EXAMPLE 11. Scores on a standardized college entrance examination (CEE) are normally distributed with mean 510 and standard deviation 60. A selective university considers for admission only applicants with CEE scores over 650. Find percentage of all individuals who took the CEE who meet the university's CEE requirement for consideration for admission.

[ Solution ]

P(X>650)=P(Z>650μσ)=P(Z>65051060)=P(Z>2.33)=10.9901=0.0099P(X>650)=P(Z>\frac{650−μ}{σ})=P(Z>\frac{650−510}{60})=P(Z>2.33)=1−0.9901=0.0099

library(Rstat)

# 1-1. Compute P(X>650)
mu <- 510; sd <- 60
a <- 650; b <- 900
1- pnorm(a, mean=mu, sd=sd)

# 1-2. Plot
norm.trans(mu, sd, a=a, b=b)

EXAMPLE 12. 표준정규분포의 누적확률 표와 그래프를 작성하시오.

[ Solution ]

library(Rstat)

# 1. Table
# 표준정규 누적확률 ( 0 ~ 2.49 ), 0.01 단위, 10개 열
pv <- matrix(pnorm(0:299/100), ncol=10, byrow=TRUE)
colnames(pv) <- 0:9/100; rownames(pv) <- 0:29/10
(round(pv, 4))

# 2. Plot cdf
# 누적확률 그래프에 표시할 점 지정
zp <- seq(-2, 2, by=0.5)

# 누적확률 그래프 작성 : snorm.cdf()
snorm.cdf(zp)

EXAMPLE 13. 표준정규분포에서 0 을 중심으로 ±k\pm k 사이에 들어갈 확률을 나타내는 그래프를 작성하시오.

[ Solution ]

library(Rstat)

# 1. Plot cdf
# 누적확률 그래프에 표시할 점 지정
zp <- 1:4
snorm.cdf(zp)

EXAMPLE 14. 누적확률 0.5%, 1.0%, 2.5%, 5.0%, 10% ~ 90%, 95%, 97.5%, 99%, 99.5%에 대한 표준정규분포의 분위수 표를 작성하시오.

[ Solution ]

library(Rstat)

# 분위수 계산/표시 누적확률
pv <- c(0.005, 0.01, 0.025, 0.05, 1:9/10, 0.95, 0.975, 0.99, 0.995)

# 표준정규 분위수 작성 : snorm.quant()
snorm.quant(pv, pv)

EXAMPLE 15. 20대 남성의 신장이 평균 175, 분산 64인 정규분포를 따른다고 할 때, 20대 남성 중 180과 185 사이의 신장을 갖는 비율을 구하시오.

[ Solution ]

XN(175,82)X \sim N(175, 8^2 ),

P(180<X<185)=p(1801758<X1758<1851758)P(180<X<185) = p( \frac{180-175}{8} < \frac{X-175}{8} < \frac{185-175}{8} ) =P(0.625<Z<1.25)=P(Z<1.25)P(Z<0.625)=0.89440.7340=0.1604= P(0.625 < Z < 1.25) = P(Z<1.25) - P(Z<0.625) = 0.8944-0.7340 = 0.1604

library(Rstat)

# 1-1. Compute P(180<X<185)
mu <- 175; sd <- 8
a <- 180; b <- 185
pnorm(b, mean=mu, sd=sd) - pnorm(a, mean=mu, sd=sd)

# 1-2. Plot
norm.trans(mu, sd, a=a, b=b)

EXAMPLE 16. A사 Q모델의 엔진 수명은 평균 10년, 표준편차가 1.5년인 정규분포를 따른다고 알려져 있다. Q 모델 엔진의 무상보증비율을 5% 이내로 유지해야 한다면, 무상보증기간은 최대 몇 년까지 가능하겠는가?

[ Solution ]

XN(10,1.52)X \sim N(10, 1.5^2 ), 무상보증기간을 mm이라 하면, P(X<m)0.05)P(X<m) \le 0.05) 를 만족해야 하므로,

P(X<m)=P(Z<m101.5)=0.05P(X<m) = P( Z < \frac{m-10}{1.5}) =0.05 ==> m101.51.645,m7.5325\frac{m-10}{1.5} \le -1.645, \therefore m \le 7.5325

따라서 무상보증기간은 최대 약 7.53년이 된다.

qnorm(0.05, mean=10, sd=1.5)

2. Probability Computation using R

  1. P(X<1)P(X<1)

  2. P(1<X<1)P(-1 < X <1)

  3. P(X>2)P(X > 2)

# 1. P(X<1)
pnorm(q=c(1), mean=0, sd=1)   # p(x<1)

# 2.   P(x<1) - p(x<-1)
b <- pnorm(q=c(1), mean=0, sd=1)   # p(x<1)
a <- pnorm(q=c(-1), mean=0, sd=1)   # p(x<-1)
(b-a)

# 3. (1 - p(X<2))
1 - pnorm(q=c(2), mean=0, sd=1)   # 1- p(x<2)
# OR
pnorm(q=c(2), mean=0, sd=1, lower.tail=FALSE)   # p(x>2)

3. Using pnormGC()

3-1. Install packages

install.packages("tigerstats")
library(tigerstats)

3-2. Finding P(X<x)P(X<x) & Plotting

  • pnormGC(bound= , region="below", mean= , sd= , graph=TRUE)

  • mean μ=70μ=70 and standard deviation σ=3σ=3 : X norm(70,3)X ~ norm(70, 3) , P(X<66)P(X<66) ?.

# P(X < 66)
pnormGC(bound=66, region="below", mean=70, sd=3)  # without graph
pnormGC(bound=66, region="below", mean=70, sd=3, graph=TRUE)  # with graph

3-3. Finding P(X>x)P(X>x) & Plotting

  • pnormGC(bound= , region="above", mean= , sd= , graph=TRUE)

  • mean μ=70μ=70 and standard deviation σ=3σ=3 : X norm(70,3)X ~ norm(70, 3) , P(X>69)P(X > 69) ?.

# P(X > 69)
pnormGC(bound=66, region="above", mean=70, sd=3)  # without graph
pnormGC(bound=66, region="above", mean=70, sd=3, graph=TRUE)  # with graph

3-4. Finding P(a<X<b)P(a<X<b) & Plotting

  • pnormGC(bound=c(a,b), region="between", mean= , sd= , graph=TRUE)

  • mean μ=70μ=70 and standard deviation σ=3σ=3 : X norm(70,3)X ~ norm(70, 3) , P(68<X<72)P(68<X < 72) ?.

# P(68 < X < 72)
pnormGC(bound=c(68,72), region="between", mean=70, sd=3)  # without graph
pnormGC(bound=c(68,72), region="between", mean=70, sd=3, graph=TRUE)  # with graph

3-5. Finding "Outside" ProbabilitiesP(a<XorX>b)P(a<X or X>b) & Plotting

  • pnormGC(bound=c(a,b), region="outside", mean= , sd= , graph=TRUE)

  • mean μ=70μ=70 and standard deviation σ=3σ=3 : X norm(70,3)X ~ norm(70, 3) , P(66<XorX>73)P(66<X or X>73) ?.

# P(66<X or X>73)
pnormGC(bound=c(66,73), region="outside", mean=70, sd=3)  # without graph
pnormGC(bound=c(66,73), region="outside", mean=70, sd=3, graph=TRUE)  # with graph

Last updated