Show Power Log-Normal Distribution in Statistics using Python

In this article we will learn about Power Log-Normal Distribution, its applications and uses. We will analyze the distribution using different methods including PDF, CDF, and visualization techniques.

Power Log-Normal Distribution

Power Log-Normal Distribution is a variation of the log-normal distribution obtained by applying a power transformation. While power normal distribution modifies the normal distribution, power log-normal distribution modifies the log-normal distribution. Both distributions have power parameters that define their shape characteristics.

Random Number Generation

We can generate random numbers from the power log-normal distribution using the scipy.stats module ?

from scipy.stats import powerlognorm
import numpy as np
import matplotlib.pyplot as plt

# Parameters: c (power parameter), s (shape parameter)
c, s = 2.14, 0.446

# Generate 1000 random values
random_numbers = powerlognorm.rvs(c, s, size=1000)

# Plot histogram
plt.figure(figsize=(8, 6))
plt.hist(random_numbers, bins=30, density=True, alpha=0.7, color='skyblue', edgecolor='black')
plt.xlabel('Values')
plt.ylabel('Density')
plt.title('Power Log-Normal Distribution - Random Samples')
plt.grid(True, alpha=0.3)
plt.show()

In this example, c=2.14 is the power parameter and s=0.446 is the shape parameter. The rvs() method generates random variates from the distribution.

Probability Density Function (PDF)

The PDF calculates the probability density at a specific point. This helps understand the likelihood of observing particular values ?

from scipy.stats import powerlognorm

c, s = 2.14, 0.446
x = 1.5

# Calculate PDF at x = 1.5
pdf_value = powerlognorm.pdf(x, c, s)
print(f"PDF at x={x}: {pdf_value}")

# Calculate PDF for multiple points
x_values = np.linspace(0.1, 5, 100)
pdf_values = powerlognorm.pdf(x_values, c, s)

# Plot PDF curve
plt.figure(figsize=(8, 6))
plt.plot(x_values, pdf_values, 'b-', linewidth=2, label='PDF')
plt.axvline(x=1.5, color='red', linestyle='--', label=f'x={x}')
plt.xlabel('x')
plt.ylabel('Probability Density')
plt.title('Power Log-Normal Distribution - PDF')
plt.legend()
plt.grid(True, alpha=0.3)
plt.show()
PDF at x=1.5: 0.12076527710927452

Cumulative Distribution Function (CDF)

The CDF gives the probability that a random variable is less than or equal to a specific value ?

from scipy.stats import powerlognorm
import numpy as np
import matplotlib.pyplot as plt

c, s = 2.14, 0.446
x = 1.5

# Calculate CDF at x = 1.5
cdf_value = powerlognorm.cdf(x, c, s)
print(f"CDF at x={x}: {cdf_value}")
print(f"This means {cdf_value:.2%} of values are ? {x}")

# Plot CDF curve
x_values = np.linspace(0.1, 5, 100)
cdf_values = powerlognorm.cdf(x_values, c, s)

plt.figure(figsize=(8, 6))
plt.plot(x_values, cdf_values, 'g-', linewidth=2, label='CDF')
plt.axvline(x=1.5, color='red', linestyle='--', label=f'x={x}')
plt.axhline(y=cdf_value, color='red', linestyle='--', alpha=0.7)
plt.xlabel('x')
plt.ylabel('Cumulative Probability')
plt.title('Power Log-Normal Distribution - CDF')
plt.legend()
plt.grid(True, alpha=0.3)
plt.show()
CDF at x=1.5: 0.9740141301157031
This means 97.40% of values are ? 1.5

Complete Distribution Analysis

Let's combine PDF and CDF visualization with sample data ?

from scipy.stats import powerlognorm
import numpy as np
import matplotlib.pyplot as plt

c, s = 2.14, 0.446

# Generate sample data
sample_data = powerlognorm.rvs(c, s, size=1000)
x_values = np.linspace(0.1, 5, 100)

# Create subplots
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(12, 10))

# Histogram with PDF overlay
ax1.hist(sample_data, bins=30, density=True, alpha=0.7, color='lightblue', edgecolor='black')
ax1.plot(x_values, powerlognorm.pdf(x_values, c, s), 'r-', linewidth=2, label='Theoretical PDF')
ax1.set_title('Histogram with PDF Overlay')
ax1.set_xlabel('Values')
ax1.set_ylabel('Density')
ax1.legend()
ax1.grid(True, alpha=0.3)

# PDF
ax2.plot(x_values, powerlognorm.pdf(x_values, c, s), 'b-', linewidth=2)
ax2.set_title('Probability Density Function')
ax2.set_xlabel('x')
ax2.set_ylabel('PDF')
ax2.grid(True, alpha=0.3)

# CDF
ax3.plot(x_values, powerlognorm.cdf(x_values, c, s), 'g-', linewidth=2)
ax3.set_title('Cumulative Distribution Function')
ax3.set_xlabel('x')
ax3.set_ylabel('CDF')
ax3.grid(True, alpha=0.3)

# Statistics
stats_text = f'''Distribution Parameters:
Power parameter (c): {c}
Shape parameter (s): {s}

Sample Statistics:
Mean: {np.mean(sample_data):.3f}
Median: {np.median(sample_data):.3f}
Std Dev: {np.std(sample_data):.3f}'''

ax4.text(0.1, 0.5, stats_text, transform=ax4.transAxes, fontsize=12, 
         verticalalignment='center', bbox=dict(boxstyle='round', facecolor='lightgray'))
ax4.set_title('Distribution Statistics')
ax4.axis('off')

plt.tight_layout()
plt.show()

Key Properties

Property Description SciPy Method
Random Sampling Generate random values rvs(c, s, size)
PDF Probability density at point x pdf(x, c, s)
CDF Cumulative probability up to x cdf(x, c, s)
Mean Expected value mean(c, s)

Conclusion

Power Log-Normal Distribution extends the log-normal distribution with an additional power parameter for greater flexibility. Use scipy.stats.powerlognorm to generate samples, calculate probabilities, and analyze this distribution in your statistical applications.

Updated on: 2026-03-27T15:10:50+05:30

345 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements