goodness of fit ksdensity
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
is there a way for testing the goodness of fit for ksdensity?
Thanks!
댓글 수: 0
답변 (1개)
Pratyush Roy
2020년 10월 29일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!