EZ Statistics

Student's t-Distribution Calculator

Calculator

Parameters

Distribution Chart

Click Calculate to view the distribution chart

Learn More

Student's t-Distribution: Definition, Properties, and Applications

Student's t-Distribution

Definition: The Student's t-distribution is a continuous probability distribution that arises when estimating the mean of a normally distributed population in situations where the sample size is small and the population standard deviation is unknown.

Formula:The probability density function (PDF) is given by:f(t)=Γ((ν+1)/2)νπΓ(ν/2)(1+t2ν)(ν+1)/2f(t) = \frac{\Gamma((\nu+1)/2)}{\sqrt{\nu\pi}\Gamma(\nu/2)}\left(1+\frac{t^2}{\nu}\right)^{-(\nu+1)/2}Where:ν=degrees of freedom\nu = \text{degrees of freedom}Γ=gamma function\Gamma = \text{gamma function}

Properties

  • Mean: E(X)=0E(X) = 0 for ν>1\nu > 1
  • Variance: Var(X)=νν2\text{Var}(X) = \frac{\nu}{\nu-2} for ν>2\nu > 2
  • Key Characteristics:
    • Bell-shaped and symmetric about 0
    • More peaked and heavier tails than normal distribution
    • Approaches normal distribution as ν increases
    • Support is all real numbers

Applications

1. Hypothesis Testing

The t-distribution is fundamental in hypothesis testing when working with small sample sizes or when the population standard deviation is unknown. It's commonly used in:

2. Confidence Intervals

Used to construct confidence intervals for population means when:
  • Sample size is small (n < 30)
  • Population standard deviation is unknown
  • Population is approximately normally distributed

3. Quality Control

In industrial quality control, t-distribution is used to:
  • Monitor process means
  • Establish control limits
  • Analyze measurement system capability

R Code Example

library(tidyverse)

# Parameters
df <- 10  # degrees of freedom
x1 <- -2  # lower bound
x2 <- 2   # upper bound

# Calculate probability between x1 and x2
prob <- pt(x2, df = df) - pt(x1, df = df)
print(str_glue("P({x1} < X < {x2}) = {round(prob, 4)}"))

# Create plot
x <- seq(-4, 4, length.out = 1000)
density <- dt(x, df = df)
df_plot <- tibble(x = x, density = density)

ggplot(df_plot, aes(x = x, y = density)) +
  geom_line(color = "blue") +
  geom_area(data = subset(df_plot, x >= x1 & x <= x2),
            aes(x = x, y = density),
            fill = "blue",
            alpha = 0.2) +
  labs(title = str_glue("Student's t-Distribution (df = {df})"),
       x = "t",
       y = "Probability Density") +
  geom_vline(xintercept = 0, 
             linetype = "dashed", 
             color = "gray50") +
  theme_minimal()

Python Code Example

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns

# Set parameters
df = 10  # degrees of freedom
x1 = -2  # lower bound
x2 = 2   # upper bound

# Calculate probability between x1 and x2
prob = stats.t.cdf(x2, df) - stats.t.cdf(x1, df)
print(f"P({x1} < X < {x2}) = {prob:.4f}")

# Create plot
x = np.linspace(-4, 4, 1000)
pdf = stats.t.pdf(x, df)

plt.figure(figsize=(10, 6))
plt.plot(x, pdf, 'blue', label='PDF')

# Add shaded area
x_shade = x[(x >= x1) & (x <= x2)]
pdf_shade = stats.t.pdf(x_shade, df)
plt.fill_between(x_shade, pdf_shade, alpha=0.2, color='blue')

# Add vertical line at x = 0
plt.axvline(x=0, color='gray', linestyle='--', alpha=0.5)

# Customize plot
plt.title(f"Student's t-Distribution (df = {df})")
plt.xlabel('t')
plt.ylabel('Probability Density')
plt.grid(True, alpha=0.3)
plt.show()

Related Calculators

Normal Distribution Calculator

Chi-Square Distribution Calculator

F Distribution Calculator

Z-Score Calculator