## Given that we have a normal distribution X ~ N (2, 4)

show that P (X < 4) = 0.8413447

pnorm (4, mean= 2, sd = sqrt(4))
## [1] 0.8413447

What are qX1 such that P(X < qX1) = 0.95 and qX2 such that P(X < qX2) = 0.975?

qx1 <- qnorm (0.95, mean = 2, sd = sqrt(4))
qx1
## [1] 5.289707
qx2 <- qnorm (0.975, mean = 2, sd = sqrt (4))
qx2
## [1] 5.919928

Draw a manual plot of this normal distribution and mark roughly the two points that you have just calculated.

x_values <- seq (-5, 9, length.out = 1000)
plot (x_values, dnorm (x_values, mean = 2, sd = 2),
      type = "l", col = "blue", lwd = 2,
      ylab = "Density", xlab = "X")
abline (v = c (qx1, qx2), col = "red", lty = 2)

## Now consider Y โˆผ N(0, 1). 

Calculate qY 1 and qY 2 at the same percentage points as for X.

qy1 <- qnorm (0.95, mean = 0, sd = 1)
qy1
## [1] 1.644854
qy2 <- qnorm (0.975, mean = 0, sd = 1)
qy2
## [1] 1.959964

Add the plot for Y and the two points to your original drawing.

y_values <- seq (-4, 4, length.out = 1000)
plot (y_values, dnorm (y_values, mean = 0, sd = 1),
      type = "l", col = "orchid", lwd = 2,
      ylab = "Density", xlab = "Y")
abline (v = c (qy1, qy2), col = "red", lty = 2)

(X - ยต) / sigma = Y