为什么MATLAB中的内核平滑函数ksdensity会导致值大于1?(Why Kernel smoothing function, ksdensity, in MATLAB, results in values greater than one?)
我有一组样本,S,我想找到它的PDF。 问题是当我使用ksdensity时,我得到的值大于1!
[f,xi] = ksdensity(S)
在数组f中,大多数值都大于1! 你能告诉我问题是什么吗? 谢谢你的帮助。
例如:
S=normrnd(0.3035, 0.0314,1,1000);
ksdensity(S)
I have a set of samples, S, and I want to find its PDF. The problem is when I use ksdensity I get values greater than one!
[f,xi] = ksdensity(S)
In array f, most of the values are greater than one! Would you please tell me what the problem can be? Thanks for your help.
For example:
S=normrnd(0.3035, 0.0314,1,1000);
ksdensity(S)
原文:https://stackoverflow.com/questions/19086124
2019-11-30 09:11
满意答案
ksdensity , ksdensity估计连续变量的概率密度函数。 概率密度可以大于1,它们实际上可以从零开始具有任意值。 对概率的约束是它们在可能的穷举范围内的总和必须是1.对于概率密度,约束是整个值范围内的积分是1。
可以在Matlab中获得由ksdensity估计的pdf的积分的粗略近似,如下所示:
sum(f) * min(diff(xi))
假设xi中的值是等间隔的。 该表达式的值应约为1。
如果在您的应用程序中您认为此近似值不足以接近1,则可能需要指定估计点网格(第二个参数pts ),使得间距更精细或范围比ksdensity自动生成的范围更宽。
ksdensity, as the name says, estimates a probability density function over a continuous variable. Probability densities can be larger than 1, they can actually have arbitrary values from zero upwards. The constraint on probabilities is that their sum over an exhaustive range of possibilities has to be 1. For probability densities, the constraint is that the integral over the whole range of values is 1.