Using Base R

Enter your data into R (or import it). We will use Table 4 from Section 7.3.

Table4 <- c(31.35, 32.06, 31.91, 32.52, 31.26, 32.37)

Use the following command to create a normal probability plot in R:

qqnorm(data_table,datax=TRUE)

Note: datax=TRUE is used to “flip” the x-axis and y-axis in the QQ-plot. The qqnorm plot in R normally has the Normal Quantiles on the x-axis, so this command changes the Normal Quantiles to the y-axis. Because we are using datax = TRUE in our command, the y-axis label and x-axis label commands are “flipped”. So, use ylab = for the x-axis title and xlab = for the y-axis title.

qqnorm(Table4, datax = TRUE, ylab = "Time (seconds)", xlab = "Normal Quantiles")

Let’s say you want to calculate the correlation between the observations and expected z-scores, use the following steps:

Step 1 Store the qqnorm command as a variable:

normplot <- qqnorm(data_table, datax = TRUE)

Step 2 Calculate the correlation between the observed values and expected z-scores.

normplot <- qqnorm(Table4, datax = TRUE, ylab = "Time (seconds)", xlab = "Normal Quantiles")

cor(normplot$x, normplot$y)
## [1] 0.9698951

The correlation between the observed values and expected z-scores is 0.970.