Chi-Squared Distribution Fitting

23 ビュー (過去 30 日間)
Pedro Oliveira
Pedro Oliveira 2017 年 12 月 28 日
コメント済み: Magdy Ismail 2021 年 1 月 19 日
Hi,
I'd like to do a histogram fitting of a chi-squared distribution.
What is the best to do it in Matlab? As Matlab doesn't support Chi-squared distribution in the histfit function.
Thank you in advance for the help.

回答 (1 件)

Star Strider
Star Strider 2017 年 12 月 28 日
It doesn’t because fitting the chi-square distribution is generally not recommended. The chi-square distribution is used to describe the distribution of parameters, not data. At least that’s how I understand it.
However if you must, this comes close:
V = 10; % Create Data
R = chi2rnd(V, 1, 100); % Create Data
X = histcounts(R,20); % Create Data
RNCF = @(v) norm(X - chi2pdf((1:length(X)),v)); % Residual Norm Cost Function
Ve = fminsearch(RNCF, rand); % Extimate Parameter
figure(1)
bar((1:length(X)), X/sum(X))
hold on
plot((1:length(X)), chi2pdf((1:length(X)),Ve), '-r')
hold off
Experiment to get the result you want.
  1 件のコメント
Magdy Ismail
Magdy Ismail 2021 年 1 月 19 日
Are you sure we can't use fitting on Chi chart on a 1000 random numbers for example??

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by