[R] about comparison of KURTOSIS in package: moments and fBasics

Spencer Graves spencer.graves at pdf.com
Sat Dec 3 17:06:49 CET 2005


	  Just a further point of clarification:  W. E. Deming said there is no 
true value to any number obtained as a result of a measurement.  If you 
change the method of measurement, you will tend to get different 
numbers.  This introduces the theory of "operational definitions".

	  The "correct" number for kurtosis depends on your purpose.  The 
number for "kurtosis" that subtracts 3 estimates a "cumulant", which is 
the standard fourth moment correction weight in an Edgeworth expansion 
approximation to a distribution.  Neither of the numbers described below 
compute the "4th sample k-statistic", which is "the unique unbiased 
estimator" for that number 
(http://mathworld.wolfram.com/k-Statistic.html).

	  However, these are little used, as the estimates are known to be so 
highly variable.  It is generally preferred to transform to normality or 
to use some other distribution and then use maximum likelihood.

	  hope this helps.
	  spencer graves

P Ehlers wrote:

> (Haven't seen an anwer to this yet; maybe I missed it.)
> 
> klebyn wrote:
> 
> 
>>
>>Hello
>>
>>
>>
>>I do not know very much about statistics (and English language too :-( ),
>>then I come in search of a clarification (explanation):
>>
>>I found two distinct results on KURTOSIS and
>>I do not know which of them is the correct one.
>>Any aid will be welcome!
>>
>>
>>klebyn
> 
> 
> The code will show you why you get different results.
> 
> fBasics:
>   kurtosis = sum((x - mean(x))^4/var(x)^2)/length(x) - 3
> 
> moments:
>   n <- length(x)
>   n * sum((x - mean(x))^4)/(sum((x - mean(x))^2)^2)
> 
> So pkg:moments uses the ratio of 4th sample moment to
> square of second sample moment, while pkg:fBasics uses the
> variance instead of the second moment and subtracts 3
> (for reasons to do with the Normal distribution).
> 
> 
> Peter Ehlers
> 
> 
>>
>>
>>################  CODE
>>
>>rnorm(1000) -> x
>>
>>library(moments)
>>
>>kurtosis(x)
>>skewness(x)
>>
>>detach("package:moments")
>>library(fBasics)
>>
>>kurtosis(x)
>>skewness(x)
>>
>>detach("package:fBasics")
>>
>>R.version
>>
>>################  OUTPUT
>>
>> >
>> > rnorm(1000) -> x
>> >
>> >
>> > library(moments)
>> >
>> >
>> > kurtosis(x)
>>[1] 3.145274
>> > skewness(x)
>>[1] 0.04898635
>> >
>> >
>> > detach("package:moments")
>> > library(fBasics)
>>
>>Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL
>>fBasics: Markets, Basic Statistics, Hypothesis Testing
>> >
>> >
>> > kurtosis(x)
>>[1] 0.1389865
>> > skewness(x)
>>[1] 0.04891289
>> >
>> >
>> > detach("package:fBasics")
>> >
>> > R.version
>>         _              
>>platform i386-pc-mingw32
>>arch     i386           
>>os       mingw32        
>>system   i386, mingw32  
>>status                  
>>major    2              
>>minor    2.0            
>>year     2005           
>>month    10             
>>day      06             
>>svn rev  35749          
>>language R              
>> >
>> >
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915




More information about the R-help mailing list