Description Usage Arguments Details Author(s) References See Also Examples
compute kurtosis of a univariate distribution
1 2 3 4 5 6 |
x |
a numeric vector or object. |
na.rm |
a logical. Should missing values be removed? |
method |
a character string which specifies the method of computation.
These are either |
... |
arguments to be passed. |
This function was ported from the RMetrics package fUtilities to eliminate a
dependency on fUtilties being loaded every time. This function is identical
except for the addition of checkData
and additional labeling.
kurtosis(moment) = sum((x-mean(x))^4/var(x)^2)/length(x)
kurtosis(excess) = sum((x-mean(x))^4/var(x)^2)/length(x) - 3
kurtosis(sample) = sum(((x-mean(x))/var(x))^4)*n*(n+1)/((n-1)*(n-2)*(n-3))
kurtosis (fisher) = ((n+1)*(n-1)*((sum(x^4)/n)/(sum(x^2)/n)^2 - (3*(n-1))/(n+1)))/((n-2)*(n-3))
kurtosis(sample excess) = sum(((x-mean(x))/var(x))^4)*n*(n+1)/((n-1)*(n-2)*(n-3)) - 3*(n-1)^2/((n-2)*(n-3))
where n is the number of return, \overline{r} is the mean of the return distribution, σ_P is its standard deviation and σ_{S_P} is its sample standard deviation
Diethelm Wuertz, Matthieu Lestel
Carl Bacon, Practical portfolio performance measurement and attribution, second edition 2008 p.84-85
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## mean -
## var -
# Mean, Variance:
r = rnorm(100)
mean(r)
var(r)
## kurtosis -
kurtosis(r)
data(managers)
kurtosis(managers[,1:8])
data(portfolio_bacon)
print(kurtosis(portfolio_bacon[,1], method="sample")) #expected 3.03
print(kurtosis(portfolio_bacon[,1], method="sample_excess")) #expected -0.41
print(kurtosis(managers['1996'], method="sample"))
print(kurtosis(managers['1996',1], method="sample"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.