Friday, July 5, 2019

The 1000th Post: HP Prime and TI-84 Plus: Log-Normal Distribution

The 1000th Post:  HP Prime and TI-84 Plus: Log-Normal Distribution



This is a landmark for this blog, this is post 1,000.  One Thousand.   And it is still fun.  I thank you all for your support - very grateful.

On to the next 1,000!

Introduction - Log-Normal Distribution

The programs presented in this blog will calculate the PDF (probability density function) and the CDF (cumulative density function).  The CDF calculates the lower tail probability.   The formulas are:

PDF:   e^(-(ln x - μ)^2 / (2 * σ^2) )

CDF:  1/2 + 1/2 * erf( (ln x - μ) / (σ * √2) )

where:  x = point on the distribution, μ = mean (default 0), σ = deviation (default 1)

Log-Normal Distribution

HP Prime Program LOGNORM_PDF

EXPORT LOGNORM_PDF(μ,s,x)
BEGIN
// log normal pdf
// μ, σ, x 
RETURN (x*s*√(2*π))^(-1)*
e^(−(LN(x)-μ)^2/(2*s^2));
END;

TI-84 Plus Program LOGNRMPD

Input "MEAN: ",M
Input "STDDEV: ",S
Input "X: ",X
(X*S*√(2*π))^-1*e^(­(ln(X)-M)²/(2*S^2))→P
Disp "PDF=",P

Example 1:
Mean = 0, Standard Deviation = 1, X = 2.5
PDF = 0.1048710669

HP Prime Program LOGNORM_CDF

EXPORT LOGNORM_CDF(μ,s,x)
BEGIN
// log normal cdf - lower tail
// μ, σ, x
RETURN .5+
.5*CAS.erf((LN(x)-μ)/(s*√2));
END;

TI-84 Plus Program LOGNRMCD

Input "MEAN: ",M
Input "STDDEV: ",S
Input "X: ",X
"ERF"
(ln(X)-M)/(S*√(2))→Z
2/√(π)*fnInt(e^(­T^2),T,0,Z)→E
"CDF"
.5+.5*E→C
Disp "CDF: ",C

Example 2:
Mean = 0, Standard Deviation = 1, X = 2.5
PDF = 0.8202427861

Thank you, here's to the next 1,000 posts....

Source:

"Log-normal distribution" Wikipedia Last edited May 15, 2019.  https://en.wikipedia.org/wiki/Log-normal_distribution  Retrieved May 25, 2019


Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.