Normal Distribution




Many of you might have known what a normal distribution is. If you do not know, please refer to the blog on a normal distribution. In this article, you will get learn how to use R-Studio to find normal probabilities or critical values.

R-Studio is the statistical tool wherein various advanced statistical calculations are possible. This is free software open to all. In the R-Studio, you can analyze a large amount of data but there are some limitations too. Let us not get into more details and focus on how to calculate normal probabilities or critical values using R-Studio.


Use of R-Studio to find normal probabilities

In hypothesis testing, we use the normal distribution to test the claim about population mean (µ) if we know population standard deviation (σ) in prior. In this situation, we use standard normal distribution or Z distribution hence we call it as Z test. While using the Z test we need to find the p-value for making decisions. Finding a p-value is the same as finding normal probability for the given test statistic. Use the following procedure to find p-values as well. There is an inbuilt function R-Studio called pnorm() to find normal probabilities. Here “p” denotes the distribution function.


How to call the function pnorm()?

To call the function pnorm() you just need to type pnorm() in the R-script of the R-Studio. Unlike the excel function, the inbuilt R-Studio function gives both left-tailed and right-tailed probabilities.

In this command, you need to plug the values of x-value (in R-Studio it is called quantile), mean=µ, and standard deviation=σ. Then press Ctrl and ENTER button together you will get the desired normal probability. There are several other options in the function if you want to use, like lower.tail that takes logical values TRUE/FALSE. The lower.tail=TRUE gives left-tailed probabilities while lower.tail=FALSE gives the right-tailed probabilities.

 

Illustration

Suppose X be a normal random variable with a mean of 10 and a standard deviation of 5. Find P(X < 17.8), P(X > 17.8).

To get P(X < 17.8) we simply use the R-Studio function pnorm() As follows.

This gives, P(X < 17.8) = 0.9406201.

Now to get P(X > 17.8) we simply use the R-Studio function pnorm() with lower.tail=FALSE as follows.

 


This gives, P(X > 17.8) = 0.05937994.


Use of R-Studio to find critical values

While constructing confidence intervals, we need to find critical values. These critical values are Z scores corresponding to the given probability. There is an inbuilt function in R-Studio called qnorm() to find critical values. Here “q” means quantiles and quantiles means the critical values.


How to call the function qnorm()?

To call the function qnorm() you just need to type qnorm() in the R-script of the R-Studio. Unlike the excel function, the inbuilt R-Studio function gives both left-tailed and right-tailed probabilities.

In this command, you need to plug the values of probability p, mean=µ, and standard deviation=σ. Then press Ctrl and ENTER button together you will get the desired critical value whose left-tailed probability is p. There are several other options in the function if you want to use, like lower.tail that takes logical values TRUE/FALSE. The lower.tail=TRUE gives critical values with left-tailed probabilities while lower.tail=FALSE gives the critical values with right-tailed probabilities.

 

Illustration

Suppose you need to construct a 90% confidence interval for the population mean. Assume that you know the value of population standard deviation in prior. What is the critical value Zα/2?

The confidence level for 90% confidence interval is, 0.90. This gives, significance level (α) = 1-C = 1-0.90 = 0.10. The left-tailed probability to the desired critical value Zα/2 is, 1-(α/2) = 1-(0.10/2) = 1-0.05 = 0.95.

If you need to use the R-Studio function qnorm() without lower.tail then the function take left-tailed probability, 0.95.

 


If you need to use the R-Studio function qnorm() with lower.tail then the function take right-tailed probability, α/2 = 0.05.

 


Both the inbuilt functions give the critical value for 90% confidence interval is Zα/2 = 1.644854.