R中的绝对偏差计算 [英] Median Absolute Deviation Computation in R
问题描述
我得到的是一个非常令人困惑的东西:
A quite confusing thing is what I got:
以下向量的绝对绝对中位数输出是
vec = c( -5.665488 ,3.963051, 14.14956, 0, -5.665488)
> mad(vec)
[1] 8.399653
但是,如果我计算得出以下值:
However, if I compute that I got the following value:
中位数绝对偏差= 5.665488
Median absolute deviation = 5.665488
,它也等于我在线上找到的计算值: http ://www.miniwebtool.com/median-absolute-deviation-calculator/
which is equal to the value of the computation I have found online as well: http://www.miniwebtool.com/median-absolute-deviation-calculator/
如何解释我和网站的计算值与R值之间的差异?
How can the difference between the calculated value of mine and the website and the value of R be explained?
推荐答案
与mad函数有关,该函数会自动将缩放常数设置为1.482.如果你这样做
It has to do with the mad function automatically setting the scaling constant as 1.482. If you do
mad(vec, constant=1)
您将获得与其他方法相同的输出
You get the same output as your other methods
这篇关于R中的绝对偏差计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!