Standardization in statistics

In statistics, we often encounter data with different means and standard deviations. If we want to compare these data or conduct statistical tests, this can lead to problems. This is where standardization comes in—a technique that enables us to bring different datasets onto a comparable basis.

What is standardization?

Standardization means transforming a variable so that it follows a standard normal distribution. The standard normal distribution has a mean of 0 and a standard deviation of 1. This makes calculating probabilities and comparing different datasets much easier.

The formula for standardization is:

Standardization in statistics

Example: Standardization in R

Suppose we have a normally distributed variable X with a mean of 170 and a standard deviation of 10. We want to standardize these values.

In R, we could calculate this as follows:

# Example: Standardization in R
set.seed(123) # for reproducibility
X <- rnorm(1000, mean = 170, sd = 10) # Original data

# Calculate the standardized values
mu <- mean(X)
sigma <- sd(X)
Z <- (X - mu) / sigma # Standardized values

# Display the first few standardized values
head(Z)

This script generates a normally distributed variable X, standardizes it, and outputs the first few values of the standardized variable Z.

Visualizing standardization

To understand how the original distribution and the standardized distribution differ, we can plot both in a diagram.

# Load packages
library(ggplot2)

# Plot original distribution
ggplot(data.frame(X), aes(x = X)) +
geom_histogram(aes(y = ..density..), bins = 30, color = "black", fill = "lightblue") +
geom_density(color = "blue") +
ggtitle("Original normal distribution (mean = 170, SD = 10)") +
theme_minimal()

# Plot standardized distribution
ggplot(data.frame(Z), aes(x = Z)) +
geom_histogram(aes(y = ..density..), bins = 30, color = "black", fill = "lightgreen") +
geom_density(color = "green") +
ggtitle("Standardized normal distribution (mean = 0, SD = 1)") +
theme_minimal()

This R script creates two plots: one for the original distribution and one for the standardized distribution. This makes it easy to see the difference—in the standardized distribution, the values are closer to 0, and the shape of the distribution remains the same, but it has been placed on a common scale.

Calculating probabilities using the standard normal distribution

A major advantage of standardization is that we can now easily calculate probabilities. For example: What is the probability that a value is less than 1.96? This corresponds approximately to the 95% threshold of a normal distribution.

In R, you calculate this as follows:

# Probability for Z < 1.96
pnorm(1.96)

The result shows the probability that a random value in the standard normal distribution is less than $1.96$, which is approximately 0.975.

This is highly relevant, for example, in psychological assessment.

Example with a normal distribution

In addition to the standard normal distribution, we can also calculate probabilities for any normal distribution. Suppose we have a distribution with a mean of 170 and a standard deviation of 10, and we want to know how likely it is that a value is less than 180.

# Calculate probability
pnorm(180, mean = 170, sd = 10)

This example shows that approximately 84% of the values are less than 180 when the mean is 170 and the standard deviation is 10.

Conclusion

Standardization is a valuable tool in statistics for bringing data onto a comparable basis and simplifying calculations. With R, you can perform the calculations as well as create visualizations to better understand the process.