 # The Normal Probability Plot In R: How To Plot? This tutorial will help you learn about the normal probability plot in the R programming language. As you know, it is used a lot in statistics. So, if you are interested in this topic, please read it below.

## What is the normal probability plot in R?

First, we will find out the normal probability in R.
Here, you can understand that the normal probability plot is a graph that depicts the data and is used to determine whether or not a particular data set is normally distributed. It compares data collection to the normal distribution. If data collection is regularly distributed, it will have a straight-line shape.

## How to create the normal probability plot in R?

If you want to create a normal probability plot in R, we will use ggplot2 and qqplotr packages. So, if you don’t know to install these packages, you can run the code below:

# Install packages
install("ggplot2")
install("qqplotr")

Or you can install this packages quickly as follows:

# Install packages
install.packages("ggplot2", "qqplotr")

Then, we will load these packages:

# Load packages
library(ggplot2)
library(qqplotr)

When successfully installed, you will create a dataset for normal distribution. Then, you can plot the normal probability graph. We will use the stat_qq_point(), and stat_qq_line() functions to plot the normal probability. Check out the code example below:

# Load packages
library(ggplot2)
library(qqplotr)

# Random data
randomValues <- rnorm(200, mean = 50, sd = 30)

# Plot
gp <- ggplot(mapping = aes(sample = randomValues)) + stat_qq_point(size = 2)
gp

Output

Another example, if you want to plot a red line for further comparison, you can use stat_qq_line() functions as the following:

# Load packages
library(ggplot2)
library(qqplotr)

# Random data
randomValues <- rnorm(200, mean = 50, sd = 30)

# Plot
gp <- ggplot(mapping = aes(sample = randomValues)) +
stat_qq_point(size = 2) +
stat_qq_line(color = "red")
gp

Output