How can I obtain a truncated log-Normal distribution object?

11 visualizaciones (últimos 30 días)
George Trip
George Trip el 11 de Jul. de 2018
Editada: dpb el 12 de Jul. de 2018
Hi,
I am trying to build a left-truncated log-Normal distribution object. For this purpose, I follow the instructions from here (for truncated Normal): https://uk.mathworks.com/help/stats/examples/fitting-custom-univariate-distributions.html#d119e590
but instead of normpdf I use the lognpdf. Overall, the process looks like this:
params = lognfit(sampleData); % fit lognormal distribution to get a starting point for the MLE which follows later
mu = params(1); % get parameters of the fit
sigma = params(2);
start = [mu, sigma]; % starting values for the MLE estimator
% Compute truncated distribution's PDF
threshold = 1000;
trunc = @(x, mu, sigma) lognpdf(x, mu, sigma) ./ (1 - logncdf(threshold, mu, sigma));
% Estimate params
[paramEsts, ~] = mle(sampleData, 'pdf', trunc, 'start', start, 'lower', [-Inf, 0]) ;
So, my question now is how to obtain the new distribution object from the truncated parameters. For example, is it correct (?) to say:
pd_new = makedist('Lognormal','mu', paramEsts(1), 'sigma', paramEsts(2));
and then truncate the estimated distribution (?)
pd_new_truncated = truncate(pd_new, threshold, Inf); % Truncate estimated distribution

Respuestas (2)

Jeff Miller
Jeff Miller el 11 de Jul. de 2018
I think you can do it with Cupid. It would look something like this:
myDist = TruncatedXlow(threshold,LogNormal(mu,sigma));
myDist.EstML(x);
You basically create myDist as a truncated lognormal distribution object, and then estimate its parameters by maximum likelihood.

dpb
dpb el 11 de Jul. de 2018
You can't use the builtin distribution objects, no; they don't have the flexibility to be truncated distribution desired; what you'll get is a lognormal with the parameters computed from the truncated version.
You'll have to use your trunc function with the new parameters or write new cdf pdf functions that properly account for the distribution being truncated.
  2 comentarios
George Trip
George Trip el 12 de Jul. de 2018
Thank you DB. Do you mean calculating the integral for the trunk function? That would look like this:
Integ = integral(@(x)trunc(x,paramEsts(1),pparamEsts(2)),threshold,t) % where t > threshold
Comparing the result from the above integral (for various t > threshold), I get the same output as when calculating the
cdf(pd_new_truncated,t)
which seems to suggest that pd_new_truncated works fine, am I missing anything here?
dpb
dpb el 12 de Jul. de 2018
Editada: dpb el 12 de Jul. de 2018
Hmmm....is it actually truncated? I based answer on reading the doc; not trial. Will have to do some double-checking but seemed to me it would end up with just a revised normal pdf/cdf just with different parameters based on the description.
ADDENDUM
I've not had time to delve into this in depth but I guess depends on what the definition of "truncated" is...if it's to ensure virtually no possibility of the prnv being >threshold by adjusting parameters that's not exactly the same thing as truncating tail values keeping same shape.
I believe it's the former that the above solution does...

Iniciar sesión para comentar.

Productos


Versión

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by