Code covered by the BSD License  

Highlights from
Lognormal Helpers

5.0

5.0 | 2 ratings Rate this file 9 Downloads (last 30 days) File Size: 4.43 KB File ID: #43624

Lognormal Helpers

by

 

Fitting for lognormal distributions

| Watch this File

File Information
Description

Contains fitting for histogram data on normal and lognormal distributions. Though still requiring the fitting toolbox, the parameters are adapted in such a way that Matlab can actually fit the values (e.g. very small x values)!

Functions return mu and sigma parameter, scaling factor (for non-unit distributions) and goodness of fit.
Additionally included are logn2mean and mean2logn to convert between logn parameters mu/sigma and mean/std value (in contrast to lognstat which returns mean and variance)

Required Products Curve Fitting Toolbox
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
02 Sep 2014 John Adcox

Nevermind....sorry :-(. I was thinking variance, you are outputting standard deviation. My mistake

02 Sep 2014 John Adcox

I think there might be some math errors in your logn2mean and mean2logn scripts. They do not match up with Matlab's lognstat functions.

I think you need to change line 15 in logn2mean to:
s = exp(2*mu + sigma.^2) .* (exp(sigma.^2) - 1);

And line 14 in mean2logn to:
sigma = sqrt(log(s./m.^2 + 1));

This would then follow the equations laid out my the Mathworks website located at:
http://www.mathworks.com/help/stats/lognstat.html

Contact us