某一元素的标准差
当我尝试执行时
StandardDeviation[{1}]
出现错误,
StandardDeviation::shlen: "The argument {1} should have at least two elements"
但一个元素的 std 为 0,不是吗?
When I try to execute
StandardDeviation[{1}]
I get an error
StandardDeviation::shlen: "The argument {1} should have at least two elements"
But std of one element is 0, isn't it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
标准差通常定义为方差的无偏估计量的平方根:
您可以轻松地看到,对于单个示例,
N=1
,您会得到0/0
,这是未定义的。因此,Mathematica 中单个样本的标准差是未定义的。现在,根据您的约定,您可能需要为单个样本定义标准差(返回 Null 或某个值或 0)。下面的示例向您展示了如何为单个示例定义它。
The standard deviation is commonly defined as the square-root of the unbiased estimator of the variance:
You can easily see that for a single sample,
N=1
and you get0/0
, which is undefined. Hence your standard deviation is undefined for a single sample in Mathematica.Now depending on your conventions, you might want to define a standard deviation for a single sample (either return
Null
or some value or0
). Here's an example that shows you how to define it for a single sample.常数的标准差为零。
一个样本的估计标准差是未定义的。
The standard deviation of a constant is zero.
The estimated standard deviation of one sample is undefined.
如果您想要一些形式:
编辑
或者更好,使用 Mathematica
ProbabilityDistribution[]
:If you want some formality:
Edit
Or better, using Mathematica
ProbabilityDistribution[]
:如果您的总体规模是一个元素,那么总体的标准差将为 0。但是,标准差通常用于样本,而不是整个总体,因此您不必除以样本中的元素数量,而是使用除以元素数量减一。这是由于对样本而不是总体执行计算时固有的误差造成的。
对规模为 1 的总体执行标准差计算绝对没有意义,我认为这就是混乱的根源。如果您知道您的总体仅包含一个元素,那么找出该元素的标准差是毫无意义的,因此通常您会看到单个元素的标准差写为未定义。
If your population size is one element, then yes the standard deviation of your population will be 0. However typically standard deviations are used on samples, and not on the entire population, so instead of dividing by the number of elements in the sample, you divide by the number of elements minus one. This is due to the error inherent in performing calculations on a sample, rather than a population.
Performing a calculation of the standard deviation over a population of size 1 makes absolutely no sense, which I think is where the confusion is coming from. If you know that your population contains only one element then finding out the standard deviation of that element is pointless, so generally you will see the standard deviation of a single element written as undefined.
标准差——衡量实际值与给定集合平均值的偏差的标准——对于一个元素的列表没有任何意义(如果需要,可以将其设置为 0)。
Standard deviation - which is a measure for the deviation of the actual value from the average of a given set - for a list of one element doesn't make any sense (you can set it to 0 if you want).