How can I convert between Z-scores and percentiles in R?

How can I convert between Z-scores and percentiles in R?

Z-scores and percentiles are statistical measurements used to analyze and compare data in a standardized way. Z-scores are a measure of how many standard deviations a data point is above or below the mean, while percentiles represent the percentage of data points that fall below a certain value.

In R, there are various functions and packages available to convert between Z-scores and percentiles. One approach is to use the “qnorm” function, which calculates the quantile (percentile) of a given Z-score in a standard normal distribution. This function can be used to convert Z-scores to percentiles by providing the desired Z-score and specifying the mean and standard deviation of the data set.

Alternatively, the “pnorm” function can be used to convert percentiles to Z-scores by specifying the desired percentile and providing the mean and standard deviation of the data set. Additionally, the “scale” function can be used to standardize a data set by converting it to Z-scores.

In conclusion, R offers multiple options for converting between Z-scores and percentiles, providing a versatile and efficient tool for statistical analysis.

Convert Between Z-Scores and Percentiles in R


z-score tells us how many standard deviations away a certain value is from the mean of a dataset.

percentile tells us what percentage of fall below a certain value in a dataset.

Often you may want to convert between z-scores and percentiles.

You can use the following methods to do so in R:

Method 1: Convert Z-Scores to Percentiles

percentile <- pnorm(z)

Method 2: Convert Percentiles to Z-Scores

z <- qnorm(percentile)

The following examples show how to use each method in practice.

Example 1: Convert Z-Scores to Percentiles in R

We can use the built-in pnorm function in R to convert a z-score to a percentile.

For example, here is how to convert a z-score of 1.78 to a percentile:

#convert z-score of 1.78 to percentile
percentile <- pnorm(1.78)

#display percentile
percentile

[1] 0.962462

It turns out that a z-score of 1.78 corresponds to a percentile of 96.2.

We interpret this to mean that a z-score of 1.78 is larger than about 96.2% of all other values in the dataset.

Example 2: Convert Percentiles to Z-Scores in R

We can use the built-in qnorm function in R to convert a percentile to a z-score.

#convert percentile of 0.85 to z-score
z <- qnorm(0.85)

#display z-score
z

[1] 1.036433

It turns out that a percentile of 0.85 corresponds to a z-score of 1.036.

We interpret this to mean that a data value located at the 85th percentile in a dataset has a z-score of 1.036.

Also note that we can use the qnorm function to convert an entire vector of percentiles to z-scores:

#define vector of percentiles
p_vector <- c(0.1, 0.35, 0.5, 0.55, 0.7, 0.9, 0.92)

#convert all percentiles in vector to z-scores
qnorm(p_vector)

[1] -1.2815516 -0.3853205  0.0000000  0.1256613  0.5244005  1.2815516  1.4050716

Here’s how to interpret the output:

  • A percentile of 0.1 corresponds to a z-score of -1.28.
  • A percentile of 0.35 correspond to a z-score of -0.38.
  • A percentile of 0.5 corresponds to a z-score of 0.

And so on.

Additional Resources

The following tutorials explain how to perform other common tasks:

Cite this article

stats writer (2024). How can I convert between Z-scores and percentiles in R?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-convert-between-z-scores-and-percentiles-in-r/

stats writer. "How can I convert between Z-scores and percentiles in R?." PSYCHOLOGICAL SCALES, 29 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-convert-between-z-scores-and-percentiles-in-r/.

stats writer. "How can I convert between Z-scores and percentiles in R?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-convert-between-z-scores-and-percentiles-in-r/.

stats writer (2024) 'How can I convert between Z-scores and percentiles in R?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-convert-between-z-scores-and-percentiles-in-r/.

[1] stats writer, "How can I convert between Z-scores and percentiles in R?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I convert between Z-scores and percentiles in R?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top