This calculator helps you compute the probabilities of an F distribution given the degrees of freedom parameters for the numerator and denominator. You can find the probability of values being less than, greater than, or between specific values. The distribution chart shows the probability density function (PDF) of the F distribution, which is widely used for hypothesis testing in analysis of variance (ANOVA), comparing variances, and testing the significance of regression models.
Calculator
Parameters
Interactive Distribution Chart
Related Calculators
Learn More
F Distribution: Definition, Formula, and Applications
F Distribution
Definition: The F distribution (also known as Fisher-Snedecor distribution) is a continuous probability distribution used to compare variances and test hypotheses in analysis of variance (ANOVA). It is the ratio of two chi-square distributions divided by their respective degrees of freedom.
- is the degrees of freedom for numerator
- is the degrees of freedom for denominator
- is the gamma function
Properties
Key Statistics:
- Mean: for
- Variance: for
- Mode: for
Key Properties:
- Always non-negative (defined for x ≥ 0)
- Right-skewed distribution
- Approaches normal distribution for large degrees of freedom
- Related to ratio of chi-square distributions
How to Calculate F Distribution in R
library(tidyverse)
# Parameters
df1 <- 4 # numerator degrees of freedom
df2 <- 10 # denominator degrees of freedom
# Calculate probability between two values
x1 <- 0.5
x2 <- 2.5
prob <- pf(x2, df1 = df1, df2 = df2) - pf(x1, df1 = df1, df2 = df2)
print(str_glue("P({x1} < X < {x2}) = {round(prob, 4)}")) # P(0.5 < X < 2.5) = 0.6274
# Calculate probability density at x1
density_at_x1 <- df(x1, df1 = df1, df2 = df2)
print(str_glue("f({x1}) = {round(density_at_x1, 4)}")) # f(0.5) = 0.6698
# Calculate cumulative probability at x1
cdf_at_x1 <- pf(x1, df1 = df1, df2 = df2)
print(str_glue("P(X ≤ {x1}) = {round(cdf_at_x1, 4)}")) # P(X ≤ 0.5) = 0.2632
# mean and variance
if(df2 > 2) {
mean_f <- df2 / (df2 - 2)
print(str_glue("Mean: {round(mean_f, 4)}")) # Mean: 1.25
} else {
print(str_glue("Mean is undefined (df2 must be > 2)"))
}
if(df2 > 4) {
var_f <- (2 * df2^2 * (df1 + df2 - 2)) / (df1 * (df2 - 2)^2 * (df2 - 4))
print(str_glue("Variance: {round(var_f, 4)}")) # Variance: 1.5625
} else {
print(str_glue("Variance is undefined (df2 must be > 4)"))
}
# Create plot
x <- seq(0, 5, length.out = 1000)
y <- df(x, df1 = df1, df2 = df2)
df <- tibble(x = x, y = y)
ggplot(df, aes(x = x, y = y)) +
geom_line(color = "blue") +
geom_area(data = subset(df, x >= x1 & x <= x2),
aes(x = x, y = y),
fill = "blue",
alpha = 0.2) +
labs(title = str_glue("F Distribution (df1 = {df1}, df2 = {df2})"),
x = "x",
y = "Probability Density",
caption = str_glue("P({x1} < X < {x2}) = {round(prob, 4)}")) +
theme_minimal()
How to Calculate F Distribution in Python
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns
# Set parameters
df1 = 4 # numerator degrees of freedom
df2 = 10 # denominator degrees of freedom
# Calculate probability between two values
x1, x2 = 0.5, 2.5
prob = stats.f.cdf(x2, df1, df2) - stats.f.cdf(x1, df1, df2)
print(f"P({x1} < X < {x2}) = {prob:.4f}") # P(0.5 < X < 2.5) = 0.6274
# Calculate probability density at x1
pdf_at_x1 = stats.f.pdf(x1, df1, df2)
print(f"f({x1}) = {pdf_at_x1:.4f}") # f(0.5) = 0.6698
# Calculate cumulative probability at x1
cdf_at_x1 = stats.f.cdf(x1, df1, df2)
print(f"P(X ≤ {x1}) = {cdf_at_x1:.4f}") # P(X ≤ 0.5) = 0.2632
# Create plot
x = np.linspace(0, 5, 1000)
pdf = stats.f.pdf(x, df1, df2)
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.f.pdf(x_shade, df1, df2)
plt.fill_between(x_shade, pdf_shade, alpha=0.2, color='blue')
# Customize plot
plt.title(f'F Distribution (df1 = {df1}, df2 = {df2})')
plt.xlabel('x')
plt.ylabel('Probability Density')
plt.grid(True, alpha=0.3)
plt.show()