MLE of combined analytically and empirically defined distributions

1 回表示 (過去 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