MLE of combined analytically and empirically defined distributions

조회 수: 2 (최근 30일)
Megan
Megan 2025년 3월 5일
편집: Torsten 2025년 3월 6일
Hi, I have some data that I would like to fit which has two components to it's pdf: a normal distribution and an added arbitrary distribution that cannot be described analytically but can be measured/interpolated from other data. The final distribution would look something like
@(x, mu, sigma, b) (1-b)*normpdf(x, mu, sigma)+ b*EmpiricalPDF(x)
I'm unsure of how to define the empirical distribution so it can be combined with the normal pdf and used for MLE.
Thanks!

답변 (1개)

Torsten
Torsten 2025년 3월 5일
편집: Torsten 2025년 3월 5일
MATLAB's "mle" accepts custom pdf's.
If you write b as sin^2(p) and (1-b) as cos^2(p), it should work to estimate mu, sigma and p (and thus b).
You will have to fit a function to your EmpiricalPDF first before starting with "mle".
  댓글 수: 2
Megan
Megan 2025년 3월 6일
Thanks, my main question is on defining the EmpiricalPDF. Is there a way to avoid fitting a function to create the pdf, and just use an interpolation instead? I have to generate many of these programatically, and won't be able to inspect all the empirical distributions to determine the best function to approximate each one.
Torsten
Torsten 2025년 3월 6일
편집: Torsten 2025년 3월 6일
The below code generates a function "EmpiricalCDF" as an approximation of the cdf to your data.
Thus supply the cdf instead of the pdf when you call "mle".
You might get problems if "mle" calls "EmpiricalCDF" outside the range of your data. If this is the case, you will have to program the interpolation with extrapolation on your own. But this is very easy.
% Generate 1000 normal random numbers
mu = 0; sigma = 1; nr = 1000;
givenDist = mu + sigma * randn(nr,1);
% Generate empirical cdf from random numbers
x = sort(givenDist(:));
p = 1:length(x);
p = p./length(x);
plot(x,p,'color','r');
EmpiricalCDF = @(y)interp1(x,p,y)
EmpiricalCDF = function_handle with value:
@(y)interp1(x,p,y)

댓글을 달려면 로그인하십시오.

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by