On Fri, Dec 18, 2009 at 1:38 PM, Ben Abbott <[email protected]> wrote:
>
> On Dec 18, 2009, at 1:40 AM, Bruce Axtens wrote:
>
>> I'm getting a weird answer from meandev as compared to Excel, Wolfram Alpha 
>> and Protium.
>>
>> GNU Octave, version 3.2.3
>> Octave was configured for "i686-pc-mingw32"
>>
>> meandev([8, 8,  9, 11, 11, 15, 16, 19, 19, 20, 20, 21, 21, 25, 32]) --> ans 
>> =  5.8571
>>
>> All the others give 5.46667
>> e.g. WolframAlpha
>> http://www.wolframalpha.com/input/?i=mean+deviation%288%2C+8%2C++9%2C+11%2C+11%2C+15%2C+16%2C+19%2C+19%2C+20%2C+20%2C+21%2C+21%2C+25%2C+32%29
>>
>> What am I doing wrong?
>>
>> Kind regards,
>> Bruce.
>
> Looking at the link below ...
>
>        http://mathworld.wolfram.com/MeanDeviation.html
>
> ... the mean deviation may be calculated as ...
>
>        meandev = @(x) mean (abs(x-mean(x)));
>        meandev([8, 8,  9, 11, 11, 15, 16, 19, 19, 20, 20, 21, 21, 25, 32])
>        ans =  5.4667
>
> So it does appear that you have found a bug.
>
> Unfortunately, you've reported this to the wrong mail list. 
> [email protected] is for Octave and its core functions. The function, 
> meandev, is part of the statistics package at Octave-Forge. The correct mail 
> list for that is [email protected].
>
> I've removed [email protected] and added [email protected] to 
> the recipients.
>
> Ben
>
>
>

It's not a bug, it's that meandev divides by n-1 rather than n.
Maximum likelihood estimation calls for dividing by n. There is an
option for unbiased estimation, too, which calls for dividing by n-1.


octave:1> 5.46667*15/14
ans =  5.8571
octave:2>


Cheers, Michael

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to