[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #36718] moment, skewness and kurtosis
From: |
Alexander Barth |
Subject: |
[Octave-bug-tracker] [bug #36718] moment, skewness and kurtosis |
Date: |
Sun, 24 Jun 2012 20:46:07 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0 |
URL:
<http://savannah.gnu.org/bugs/?36718>
Summary: moment, skewness and kurtosis
Project: GNU Octave
Submitted by: abarth
Submitted on: Sun 24 Jun 2012 08:46:06 PM GMT
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: Alexander Barth
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.6.0
Operating System: GNU/Linux
_______________________________________________________
Details:
In matlab (R2010a), I get:
>> x = [1:5].^2;
>> moment(x,3)
ans =
303.6000
>> skewness(x)
ans =
0.4693
% this is (std(x,1)^(-3)) * mean ((x - mean(x)).^3)
>> kurtosis(x)
ans =
1.8394
while in octave 3.6.0:
moment(x,3)
ans = 4103
In matlab, moments are central while octave uses raw moment per default
(central moments can be activated with moment(x,3,'c'))
skewness(x)
ans = 0.33580
This is (std(x,0)^(-3)) * mean ((x - mean(x)).^3). The normalization of std is
thus different.
kurtosis(x)
ans = -1.8228
Again a different normalization of std, and a minus 3 in octave (excess
kurtosis).
Concerning the normalization of std (1/n versus 1/(n-1)), I have seen at least
a third definition on the web.
(http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm). What a
mess!
I would propose that we follow the matlab convention here.
Attached are some patches, with the necessary changes in the calculations to
the functions (but help text and test are not updated yet, ... bed time now).
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 24 Jun 2012 08:46:06 PM GMT Name: kurtosis.m.patch Size: 708B
By: abarth
<http://savannah.gnu.org/bugs/download.php?file_id=26100>
-------------------------------------------------------
Date: Sun 24 Jun 2012 08:46:06 PM GMT Name: skewness.m.patch Size: 668B
By: abarth
<http://savannah.gnu.org/bugs/download.php?file_id=26101>
-------------------------------------------------------
Date: Sun 24 Jun 2012 08:46:06 PM GMT Name: moment.m.patch Size: 751B By:
abarth
<http://savannah.gnu.org/bugs/download.php?file_id=26102>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36718>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #36718] moment, skewness and kurtosis,
Alexander Barth <=