Created:April 11, 2025
This calculator helps you compute the probabilities of a logistic distribution given the location and scale parameters. You can find the probability of a value being less than, greater than, or between certain values. The distribution chart shows the probability density function (PDF) and cumulative density function (CDF) of the logistic distribution.
Calculator
Parameters
Important:The scale parameter must be positive.
Interactive Distribution Chart
Click Calculate to view the distribution chart
Learn More
Logistic Distribution
Definition: The logistic distribution is a continuous probability distribution that resembles the normal distribution but has heavier tails. It is symmetric around its location parameter and often used to model growth and decay processes.
Formula:The probability density function (PDF) and cumulative density function (CDF) are given by:
Where:
- is the location parameter
- is the scale parameter
Example: Let , find .
Properties
- Symmetric about the location parameter μ
- Bell-shaped curve but with heavier tails than the normal distribution
- Mean, median, and mode are all equal to μ
- Variance = s²π²/3, where s is the scale parameter
- Resembles the normal distribution but has slightly heavier tails
- Often used in logistic regression and growth models
How to Calculate Logistic Distribution in R
R
library(tidyverse)
mu <- 2 # location
s <- 0.5 # scale
# p(X < 1)
p_less_than <- plogis(1, location = mu, scale = s)
print(p_less_than) # 0.1192029
# p(X > 2.5)
p_greater_than <- 1 - plogis(2.5, location = mu, scale = s)
print(p_greater_than) # 0.2689414
# P(1 < X < 3)
p_between <- plogis(3, location = mu, scale = s) - plogis(1, location = mu, scale = s)
print(p_between) # 0.7615942
# plot the logistic distribution
x <- seq(mu - 4*s, mu + 4*s, length.out = 1000)
pdf <- dlogis(x, location = mu, scale = s)
df <- tibble(x = x, pdf = pdf)
# Plot PDF
ggplot(df, aes(x = x, y = pdf)) +
geom_line(color = "blue") +
geom_area(data = subset(df, x >= 1 & x <= 3), aes(x = x, y = pdf), fill = "blue", alpha = 0.2) +
labs(title = "Logistic Distribution - PDF",
subtitle = paste0("μ = ", mu, ", s = ", s),
x = "x",
y = "Probability Density") +
annotate("text", x = 3.5, y = 0.3, label = paste0("P(1 < X < 3) = ", round(p_between, 4)), hjust = 0) +
theme_minimal()
How to Calculate Logistic Distribution in Python
Python
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
mu = 2 # location
s = 0.5 # scale
# P(X < 1)
p_less_than = stats.logistic.cdf(1, loc=mu, scale=s)
print(f"P(X < 1) = {p_less_than:.7f}") # 0.1192029
# P(X > 2.5)
p_greater_than = 1 - stats.logistic.cdf(2.5, loc=mu, scale=s)
print(f"P(X > 2.5) = {p_greater_than:.7f}") # 0.2689414
# P(1 < X < 3)
p_between = stats.logistic.cdf(3, loc=mu, scale=s) - stats.logistic.cdf(1, loc=mu, scale=s)
print(f"P(1 < X < 3) = {p_between:.7f}") # 0.7615942
# Plot the logistic distribution
x = np.linspace(mu - 4*s, mu + 4*s, 1000)
pdf = stats.logistic.pdf(x, loc=mu, scale=s)
plt.figure(figsize=(10, 6))
plt.plot(x, pdf, color='blue')
# Shade the area between 1 and 3
mask = (x >= 1) & (x <= 3)
plt.fill_between(x[mask], pdf[mask], alpha=0.2, color='blue')
# Add annotations
plt.annotate(f"P(1 < X < 3) = {p_between:.4f}",
xy=(3.5, 0.3),
xytext=(3.5, 0.3),
ha='left')
plt.title("Logistic Distribution - PDF")
plt.suptitle(f"μ = {mu}, s = {s}")
plt.xlabel("x")
plt.ylabel("Probability Density")
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()