ds.kurtosis {dsBaseClient} | R Documentation |
This function calculates the kurtosis of a numeric variable.
ds.kurtosis(x = NULL, method = 1, type = "both", datasources = NULL)
x |
a string character, the name of a numeric variable. |
method |
an integer between 1 and 3 selecting one of the algorithms for computing kurtosis detailed below. The default value is set to 1. |
type |
a character which represents the type of analysis to carry out.
If |
datasources |
a list of |
The function calculates the kurtosis of an input variable x with three different methods.
The method is specified by the argument method
. If x contains any missings, the function removes those before
the calculation of the kurtosis. If method
is set to 1 the following formula is used
kurtosis= \frac{\sum_{i=1}^{N} (x_i - \bar(x))^4 /N}{(\sum_{i=1}^{N} ((x_i - \bar(x))^2) /N)^(2) } - 3
,
where \bar{x}
is the mean of x and N
is the number of observations. If method
is set to 2
the following formula is used kurtosis= ((N+1)*(\frac{\sum_{i=1}^{N} (x_i - \bar(x))^4 /N}{(\sum_{i=1}^{N} ((x_i - \bar(x))^2) /N)^(2) } - 3) + 6)*((N-1)/((N-2)*(N-3)))
.
If method
is set to 3 the following formula is used kurtosis= (\frac{\sum_{i=1}^{N} (x_i - \bar(x))^4 /N}{(\sum_{i=1}^{N} ((x_i - \bar(x))^2) /N)^(2) })*(1-1/N)^2 - 3
.
This function is similar to the function kurtosis
in R package e1071
.
a matrix showing the kurtosis of the input numeric variable, the number of valid observations and the validity message.
Demetris Avraam, for DataSHIELD Development Team