Median Absolute Deviation Computation in R

China☆狼群 提交于 2019-12-22 10:57:07

问题


A quite confusing thing is what I got:

The Median Absolute Deviation output of the following vector is

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:

Median absolute deviation = 5.665488

which is equal to the value of the computation I have found online as well: http://www.miniwebtool.com/median-absolute-deviation-calculator/

How can the difference between the calculated value of mine and the website and the value of R be explained?


回答1:


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



来源:https://stackoverflow.com/questions/28506285/median-absolute-deviation-computation-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!