goodness of fit ksdensity
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
is there a way for testing the goodness of fit for ksdensity?
Thanks!
0 Commenti
Risposte (1)
Pratyush Roy
il 29 Ott 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.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!