Suppose I have the following sample of 100,000 points drawn from the chi-square distribution.
x=np.random.chisquare(10,100000)
We plot the histogram which is asymmetric. Let us say the histogram represents the probability.
I want to get 68% of the sample having the highest probability. Or, in general how to get the N% of the samples with maximum probability? Note that when N tends to zero we would get the mode/maxima/maximum likelihood point. Please help. P.S. I am not looking for quantile/percentile which would not give the part of the sample with highest probability if the distribution/histogram is asymmetric.
The most naive solution, I can think of, to your problem is to fit the chi-square distribution, evaluate the density over each sample, and take the top
k
samples wherek
is theN'th
fraction of your dataset.