Find the goodness fitting and find the best fit
Afficher commentaires plus anciens
The code of the histogram is the following:
vals=discardval(:,2); % vals is my data
numbins = 40;
hist(vals,numbins)
set(get(gca,'Children'),'FaceColor',[.8 .8 1])
Although, I am not familiar with the statistical methods that are used for fitting a distribution, I have used fitdist function to fit the histogram. Below is the code for the fitting.
hold on
[bincounts,binpositions]=hist(vals,numbins);
binwidth = binpositions(2) - binpositions(1);
histarea = binwidth*sum(bincounts);
x = binpositions(1):binwidth/10:binpositions(end);
pd = fitdist(discardval(:,2),'tLocationScale');
y = pdf('tLocationScale',x,pd.Params(1),pd.Params(2),pd.Params(3));
plot(x,histarea*y,'r','LineWidth',2)
I have a couple of questions regarding the fitting:
- How can assess the fitting? I would like a measure of how good is the fitting.
- How can I make an iterative method that finds the best fit
- Transform this histogram in showing the probability. This is seems is easy to do if I divide the the bincounts with the population of the sample. But how can I visualize it?
- And last, how can find the range in which 95% of the population lies. i.e 95% of the population lies in the interval [-0.005 0.005]
Réponses (1)
Shashank Prasanna
le 4 Août 2013
1) The parameter estimates are Maximum Likelihood estimates. All properties of the fit are available in the distribution object, for example:
>> pd.ParamCov
for the covariance matrix of parameter estimates.
2) Use you control some parameters of the optimization using statset and pass it as an 'Options' to fitdist:
3) use cdf :
4) Percentiles:
1 commentaire
Carter Hoffman
le 14 Mar 2023
@Shashank Prasanna Can you provide some context on how to use the covariance parameters (pd.ParamCov) to assess goodness of fit ?
Catégories
En savoir plus sur Exploration and Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!