Fit chi distribution to measurement data
15 次查看(过去 30 天)
显示 更早的评论
dj1du
2022-8-16
Good Morning,
I would like to fit a chi distribution (not chi-squared!) with 6 degrees of freedom to my measurement data. Unfortunately, the chi distribution does not seem to be implemented in the Matlab function fitdist, and the only possibility I found was described in:
Although there is an example for a Laplace distribution on how to define a custom distribution, I'm not sure which lines of code to change, in order to define my chi distribution properly. Could someone perhaps help me out here?
Thank you very much!
BTW: I found out, that the Nakagami distribution supported by fitdist is similar to a chi distribution, but I really need to use a chi distribution and not a Nakagami one!
采纳的回答
Torsten
2022-8-16
Square your measurement data, and you can fit them against a chi-squared distribution.
21 个评论
Torsten
2022-8-16
编辑:Torsten
2022-8-16
Then use the parameters obtained from the chi-squares fit in the chi-distribution and compare to your unsquared data.
Do you have a curve you want to fit the chi distribution to or only a one-dimensional data vector ?
See under
whether curve fitting or distribution fitting applies in your case.
dj1du
2022-8-16
Ok good suggestion, but nevertheless I need a plot of a chi distribution, under any circumstances.
Torsten
2022-8-16
But I gave you the way how to get a plot of the fit of your data with a chi-distribution. Don't you understand what I meant ?
dj1du
2022-8-16
编辑:dj1du
2022-8-16
I'm sorry, I didn't see the last sentence of your response. I have a 1D data vector to which the chi distribution should be fitted. Perhaps you can explain it once again in a step by step manner, as I am not really sure about the procedure you mentioned, to be honest.
Torsten
2022-8-16
No, I meant the first sentence:
Fit your data squared to a chi-squared distribution, insert the parameters thus obtained in the chi distribution and plot the chi distribution together with a histogram of your data unsquared.
dj1du
2022-8-16
Ok, the chi- and chi-squared distribution have both just one same distribution parameter, so when I have determined this parameter by fitting the squared data, what's the Matlab command for plotting the chi distribution eventually? Or do I have to program the chi distribution's pdf manually with the known distribution parameter? Sorry for asking...
dj1du
2022-8-16
Ok, the use of mle looks more straight-forward, I will try this solution, I guess. Thank you again for your help!
Torsten
2022-8-16
Maybe there is a statistician in the forum who can tell whether it's legitimate to fit a chi squared distribution to measurement data squared if one knows that the data unsquared follow a chi distribution. I'm not quite sure if this introduces a bias in the parameter estimation.
dj1du
2022-8-17
By the way: How can I fit a chi-squared distribution to my squared data? I just found out that chi-squared distributions are not supported by MATLAB functions like fitdist!
dj1du
2022-8-17
编辑:dj1du
2022-8-17
I tried mle based on the following code
chipdf = @(data,k) ...
(data.^(k-1).*exp(-(data.^2)/2))/((2^(k/2-1))*gamma(k/2));
phat_hirf = mle(measurement_data,'pdf',chipdf,'Start',1)
and it gives me the desired distribution parameter k, but to be sure this method really provides correct results, I was hoping for implementing your alternative chi-squared approach, too, and compare the result from both different methods. But chi-square is not implemented in Matlab for fitting, unfortunately, so I don't know how to implement your chi-squared approach...
dj1du
2022-8-17
Yes, but as I need all this stuff for a publication I want to be absolutely sure and try a second method for comparison. Any ideas left?
Torsten
2022-8-17
Distribution Fitter. As you write, an example for a Laplace Distribution is given. Doesn't sound too difficult to imitate it for your case.
Torsten
2022-8-17
And you write in your first question that you want to fit a chi distribution with 6 degrees of freedom to your measurement data. Why do you need to fit it if you already know the parameter k ? To check whether it turns out to be 6 ?
更多回答(0 个)
另请参阅
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)