Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/statistics.r

View File Source Download File No help file available

Function: skewness

Function Description: skewness

Sample skewness. The biased portion is the population skewness; correction is for finite sample. D. N. Joanes and C. A. Gill. “Comparing Measures of Sample Skewness and Kurtosis”. The Statistician 47(1):183–189

Function Arguments:

ArgumentDefault Value
x
x
x
x

Function Source:

skewness=function(x)
{
x=x[!is.na(x)]
n=length(x)
if(length(x)<=2) return(0)

mn=mean(x)
sumcube=sum((x-mn)^3)
sumsq=sum((x-mn)^2)
biased=sqrt(n)*sumcube/(sumsq^1.5)
correction=sqrt(n)*sqrt((n-1)/(n-2))

return(biased*correction)
}