I uncovered 4 different definitions of kurtosis when I researched it a
couple
of years ago. They give similar but slightly different results. The
version from
the Excel documentation centers around zero. It looks like I based my
comments and code on the Mathworld entry
http://mathworld.wolfram.com/Kurtosis.html
I'm unsure of the justification for the other two methods not mentioned on
Mathworld. I probably needed the Excel version to be able to match results
people would get from their spreadsheets.
Except for any random line-wrapping, here they are (with the
necessary sub-functions following):
beta2=: 3 : '(4 mstat y.)%*:2 mstat y.' NB.* beta2: kurtosis (A&S)
gamma2=: _3&+@:beta2 NB.* gamma2: kurtosis excess
NB.* kurtQuantile: kurtosis by quantiles, Chou, p.73.
kurtQuantile=: 3 : '(-:-/2 0 quartile y.)%-/8 0{10 ntile y.'
NB.* kurt: kurtosis according to Excel documentation.
kurt=: 3 : 0
(((*/0 1+#y.)%*/1 2 3-~#y.)*+/((y.-mean y.)%stddev
y.)^4)-(3**:_1+#y.)%*/_2 _3+#y.
NB.EG _0.15179963720842=kurt 3 4 5 2 3 4 5 6 4 7
)
NB. +.-------- sub-functions ------------+.
mstat=: 4 : '(#y.)%~+/(y.-mean y.)^x.' NB.* mstat: x.th moment of y.
ntile=: 4 : 0
NB.* ntile: return values of x.-tiles of y.; e.g. 4 ntile y. -> quartiles;
NB. 0-based so "1st" quartile is 0{4 ntile y..
quant=. x.
y.=. /:~y.
wh=. 0 1#:(i.quant)*quant%~#y. NB. Where partition points are exactly
'n f'=. |:wh NB. whole and fractional part of
partitions
1|.+/"1 ((1-f),.f)*(n+/_1 0){y. NB. "1|." moves top quantile to end.
)
quartile=: 4 : 'x.{4 ntile y.' NB.* quartile: x.th quartile
lim
bibliography=: 0 : 0
A&S: Abramowitz and Stegun, 1972.
Chou, Ya-lun; Statistical Analysis, 2nd Edition; Holt, Rhinehart, Winston;
1984.
K&K: Kenney and Keeping, 1951.
)
On 3/19/06, Tarmo Veskioja <[EMAIL PROTECTED]> wrote:
>
>
> John Randall wrote:
>
> >Kurtosis is normally defined as beta_2 as given in
> >
> >http://mathworld.wolfram.com/Kurtosis.html
> >
> >This appears to be the definition in statfns.ijs.
> >
> >
> Yes, I think I understand now. The definition in J is for kurtosis
> "proper", while kurtosis "excess" is also often used (in SPSS for
> example).
> Wolfram MathWorld also gives the estimator for the kurtosis excess. I
> should have checked Wolfram before posting here :-)
>
> >The variant definition may be an unbiased estimator from a sample.
> >
> I had the same suspicion (I couldn't think of any other possible reasons).
>
> Thanks,
> Tarmo
>
> >The
> >funny denominator is probably there for an analagous reason to estimating
> >the population variance from a sample:
> >
> >S^2=(1/(n-1)) sum (x_i- xbar)^2
> >
> >is an unbiased estimator of the population variance, but with denominator
> >n it is not.
> >
> >Best wishes,
> >
> >John
> >
> >Tarmo Veskioja wrote:
> >
> >
> >>A definition of kurtosis is given in statfns.ijs :
> >>
> >>NB. kurtosis = 4th moment coefficient
> >>kurtosis=: # * +/@(^&4)@dev % *:@ssdev
> >>
> >>There seems to be a different definition of kurtosis given in the
> >>Electronic Textbook from Statsoft:
> >>http://www.statsoft.com/textbook/stathome.html
> >>or more precisely at the bottom of page:
> >>http://www.statsoft.com/textbook/glosi.html
> >>
> >>Can anyone confirm and explain the difference?
> >>
> >>Thanks,
> >>Tarmo
> >>
> >>----------------------------------------------------------------------
> >>For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >>
> >>
> >
> >
> >----------------------------------------------------------------------
> >For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> >
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm