public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Sample skew and kurtosis
@ 2007-03-15 23:40 Ben Klemens
  2007-03-20 12:00 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Klemens @ 2007-03-15 23:40 UTC (permalink / raw)
  To: gsl-discuss

And while I'm writing in, I thought I'd mention a little anomaly in the
skew and kurtosis calculations. The documentation defines the kurtosis as 
kurtosis = ((1/N) \sum ((x_i - \Hat\mu)/\Hat\sigma)^4)  - 3,
and similarly for the skew.

This is inconsistent. \Hat\sigma and \Hat\mu are based on a sample,
meaning that the unbiased estimate involves \sum(...)/(n-1), as opposed
to the population variance, which involves \sum(...)/n.

The same holds for the kurtosis and skew: if you have a sample and not a
population, then the unbiased estimate is of the form \sum(...)/(n-1). But
the above starts with 1/n, meaning we have population kurtosis normalized
by sample variance squared.

If we have to choose only one kurtosis and skew function, it should
probably be the sample and not the population version. The fix is trivial:
just return kurtosis * n/(n+1.0) at the end of kurtosis_m_sd, and
similarly for skew.

Regards,

BK

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Sample skew and kurtosis
  2007-03-15 23:40 Sample skew and kurtosis Ben Klemens
@ 2007-03-20 12:00 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2007-03-20 12:00 UTC (permalink / raw)
  To: Ben Klemens; +Cc: gsl-discuss

At Thu, 15 Mar 2007 15:39:56 -0800,
Ben Klemens wrote:
> The same holds for the kurtosis and skew: if you have a sample and not a
> population, then the unbiased estimate is of the form \sum(...)/(n-1). But
> the above starts with 1/n, meaning we have population kurtosis normalized
> by sample variance squared.
> 
> If we have to choose only one kurtosis and skew function, it should
> probably be the sample and not the population version. The fix is trivial:
> just return kurtosis * n/(n+1.0) at the end of kurtosis_m_sd, and
> similarly for skew.

Hello,

I originally looked at the formulas for unbiased estimators of
skewness and kurtosis and they were pretty complicated, so I went with
the simple definition used by Octave & Matlab.

-- 
Brian Gough

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-20 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-15 23:40 Sample skew and kurtosis Ben Klemens
2007-03-20 12:00 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).