KERNEL : mean integrated squared error- Bandwidth Selection
Show older comments
Hello all,
I have my set of data and I estimated the function using kernel, however the Bandwidth must be estimated for a correct density from the given data. I just put 0.2 for initial start so I will be able to play around with the bandwidth before looking into proper method but the kernel didn't work for width = 0.2,however for another set of data it did work. there is more proffesional method to pick the best bandwith for the given data and it is using mean integrated squared error, Is there any in-built function in Matlab, I didn't seem to find any, not sure if there is a method in one of the toolboxes not available to me. I would like to know why the width 0.2 is not working to my code??..
Thank you all,
sample1 = [6.52689332414481E7
6.52693837402845E7
6.5270203713004336E7
6.527122138667133E7
6.52717237415096E7
6.527173346449997E7
6.527211590239384E7
6.5272540473269284E7
6.527282568117965E7
6.527314005807114E7
];
x = sample1.';
[xi,f]=ksdensity(x,'width',0.2);
plot(f,xi);
line(repmat(x,2,1),repmat([0;0.1*max(xi)],1,length(x)),'color','g' );
Accepted Answer
More Answers (1)
the cyclist
on 28 Aug 2011
In your case, your data are order-of-magnitude 1e7, but you are choosing a width of 0.2, so it is much, much too tiny. I suspect you do not have a very good understanding of what kernel density estimation is doing, so you might want to read some basic articles to understand the technique better. This is not a bad place to start:
The easiest thing to do is to not include the 'width' parameter at all, and let MATLAB choose it for you:
[xi,f] = ksdensity(x);
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!