2026-10-17

Introduction: What is Nonparametric Statistics?

Nonparametric statistics is statistics that’s… not parametric! Simple, but what does that mean exactly? Let’s first identify what it means to be parametric.

We will be using the following packages to graph as we go along:

library(ggplot2)
library(plotly)
library(htmlwidgets)

Parametric Statistics

Parametric statistics are based on the assumptions made about the distributions of the populations from which a sample was taken from. Parametric statistical methods often:

  • assume the data follows a prescribed distribution (most often the normal distribution)

  • rely on parameters (ex. mean and variance)

Examples of Parametric Statistics

These are examples of Parametric distributions:

  • Normal distribution
  • Binomial distribution
  • Student t-distribution

Examples of Parametric Models:

  • Linear model: \[y_i = \beta_0 + \beta_1 x_i + \epsilon_i\]

  • Logistic Model: \[ \text{logit}(P(y = 1|x)) = x\beta \]

Visual Parametric Example

For this example, I will generate a random normal distribution

set.seed(123)
df <- data.frame(n = rnorm(1000, mean = 50, sd= 10))
ggplot(df, aes(x=n)) +
  geom_histogram(
    aes(
      y= after_stat(density)
    ),
    color = "black",
    fill = "lightblue",
    bins = 30,
    position = "dodge"
  ) +
  labs(
    title = "Histogram with Normal Distribution Curve",
    x = "Value"
  ) + 
  theme_minimal()

Notice how this data has this beautiful bell curve shape? We can definitely use parametric methods on this!

Complications

As we have seen, when the data follows the typical normality assumption and the data does not deviate in drastic ways, we can often rely on parametric methods. However, what happens when we can’t follow these assumptions? What happens when we have something that looks like this:

set.seed(42)
peak1 <- rnorm(n = 500, mean = 10, sd = 2)
peak2 <- rnorm(n = 500, mean = 20, sd = 2)

bimodal_dist <- data.frame(peaks = c(peak1, peak2))

ggplot(bimodal_dist, aes(x=peaks)) +
  geom_histogram(
    color = "black",
    fill = "lightblue",
    bins = 30,
    position = "dodge"
  ) +
  labs(
    title = "Histogram with Bimodal Distribution Curve",
    x = "Value"
  ) + 
  theme_minimal()

What if we have a sample that’s too small to use the Central Limit Theorem? Or, even one that has too many outliers to the point that it affects the distribution/parameters (and can not be removed so easily)?

Nonparametric Statistics

Nonparametric statistics are essentially methods in which we do not assume that the data follows a specific probability distribution, and that the models can not be determined by some parameters. Nonparametric statistics methods often work around the complications in the previous slide by using ranks, medians, or frequencies. In other words, if the data:

  • is heavily skewed or bimodal
  • has a very small sample size (n < 30)
  • can not be determined by usual parameters (ex. mean)

Then, we would use nonparametric statistics.

Examples of Nonparametric Statistics

  • Wilcoxon signed-rank test
  • Nonparametric Regression
  • Kernel Density Estimation: \[f_h(x) = \frac{1}{nh} \sum_{i=1}^{n} K\left(\frac{x - x_i}{h}\right)\]
p <- ggplot(iris, aes(x = Sepal.Length, fill = Species)) +
  geom_density(alpha = 0.5) + 
  labs(
    title = "KDE Visual Example via ggplotly using iris dataset", 
       x = "Sepal Length",
       y = "Density") +
  theme_minimal()

ggplotly(p)

Why use Nonparametric Statistics?

So, if there is anything to take away from this. The advantages of using nonparametric statistics would be:

  • Flexibility: requires fewer assumptions on the data
  • Robustness: not as impacted by outliers
  • Power: requires a smaller sample size
  • Useful: if typical distributions fail, we can fall back on nonparametreic methods instead