Effacer les filtres
Effacer les filtres

goodness of fit ksdensity

2 vues (au cours des 30 derniers jours)
jstar
jstar le 20 Oct 2020
Commenté : jstar le 5 Nov 2020
Hi,
is there a way for testing the goodness of fit for ksdensity?
Thanks!

Réponses (1)

Pratyush Roy
Pratyush Roy le 29 Oct 2020
Hi jstar,
The goodnessOfFit function available in the System Identification Toolbox can be used to find goodness of fit.
Let us consider a set of random values on which we want to fit the kernel distribution. Here we are estimating our probability values on the same set of points which are being used to fit the distribution. For this we sort our x values in ascending order since their values are otherwise arbitrary.
rng('default') % For reproducibility
x = [randn(30,1); 5+randn(30,1)];
x_sort = sort(x);
[f,~] = ksdensity(x,x_sort);
Now the set of values in f can be compared against a set of reference values f_ref, using different cost functions like Mean Squared Error(MSE),Normalised Root Mean Squared Error(NRMSE) and Normalised Mean Squared Error(NMSE).
gof = goodnessOfFit(f,f_ref,'MSE') %3rd argument can be 'NRMSE' or 'NMSE',depends on the user.
Hope this helps!
Regards,
Pratyush.
  1 commentaire
jstar
jstar le 5 Nov 2020
Thanks!

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by