Unable to fit LogNormal distribution to the given data

Hi everyone,

I just tried to use the statistical inference module in UQLab to fit a lognormal distribution to a set of data but got the this warning:

Warning: cannot fit LogNormal distribution to the given data

The distribution of my data looks like this:
Screenshot 2023-01-20 215912

What would be the potential reason for getting this warning?

Thanks!

Dear @HZhang

Please post the full error stack. Or even better, share your data and code so we can reproduce the error.

Best regards
Styfen

Hi @styfen.schaer,

Thank you very much for the reply!

The code I used is:

iOpts.Inference.Data = X;
iOpts.Marginals.Type = {'LogNormal'};
iOpts.Marginals.Bounds = [min(X) max(X)];
InputHat = uq_createInput(iOpts);

The warning and error I got are:

Warning: cannot fit LogNormal distribution to the given data 
> In uq_infer_marginals (line 611)
In uq_initialize_uq_default_input (line 141)
In uq_core_module/run_initialization_script (line 208)
In uq_core_input/add_module (line 95)
In uq_createInput (line 114) 
Error using uq_initialize_uq_default_input
Index exceeds the number of array elements. Index must not exceed 0.

Error in uq_core_module/run_initialization_script (line 208)
                            initHandle(obj);

Error in uq_core_input/add_module (line 95)
                success = this.run_initialization_script(obj);

Error in uq_createInput (line 114)
eval(str);

And my input data is:
X =
202794.565217391
181967.014492754
193851.086956522
179644.821256039
184515.371980676
192293.816425121
180376.086956522
188410.869565217
184982.173913044
182611.956521739
190732.826086957
176592.966183575
182200.415458937
185961.028985507
183354.777777778
182083.714975845
178752.391304348
187712.608695652
189605.536231884
181385.893719807
179628.241545894
178747.608695652
196323.956521739
179802.101449275
176265.120772947
179323.391304348
184637.391304348
182691.855072464
180493.260869565
196328.478260870
180519.879227053
180840.497584541
182300.444444444
186686.739130435
192257.227053140
188421.265700483
193937.149758454
178413.603864734
203236.956521739
183410.222222222

Dear @HZhang

We investigated your issue and found that the error originates from a numerical issue in Matlab’s optimization algorithm when fitting the distribution parameters, which is caught and raised by UQLab. Scaling your data by multiplying all values by 10^{-5} would be a working workaround. However, be careful because this will shift the mean of the logarithms of your scaled data by ln(10^{-5}), but the standard deviation will stay the same and the confidence bounds should still be valid too.

Best regards
Styfen

Hi @styfen.schaer

It worked after scaling the data as you mentioned. Thank you very much!

Best,

Hongzhou