I am using this form of the ksdensity function in MATLAB.
[f,xi] = ksdensity(x)
The documentation says that "f is the vector of density values evaluated at the points in xi ... The density is evaluated at 100 equally spaced points that cover the range of the data in x. "
Now, my xi values cover a much larger range than the data in x. Why is this?
For my data,
>> min(x)
ans =
-2.2588
>> min(xi)
ans =
-6.8010
>> max(x)
ans =
6.5326
>> max(xi)
ans =
11.0748
I know I can specify an xi range myself, but why is it not equally spaced between min and max of x by default?
It makes it hard to compare histogram estimators and kernel estimators when the bins in the histogram only cover the range of x, whereas the test points given from ksdensity exceed this range.