kurtosis {PerformanceAnalytics} | R Documentation |
Kurtosis
Description
compute kurtosis of a univariate distribution
Usage
kurtosis(
x,
na.rm = FALSE,
method = c("excess", "moment", "fisher", "sample", "sample_excess"),
...
)
Arguments
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 "moment" , "fisher" , or "excess" . If
"excess" is selected, then the value of the kurtosis is computed by
the "moment" method and a value of 3 will be subtracted. The
"moment" method is based on the definitions of kurtosis for
distributions; these forms should be used when resampling (bootstrap or
jackknife). The "fisher" method correspond to the usual "unbiased"
definition of sample variance, although in the case of kurtosis exact
unbiasedness is not possible. The "sample" method gives the sample
kurtosis of the distribution.
|
... |
arguments to be passed.
|
Details
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)=n1∗∑i=1n(σPri−r)4
Kurtosis(excess)=n1∗∑i=1n(σPri−r)4−3
Kurtosis(sample)=(n−1)∗(n−2)∗(n−3)n∗(n+1)∗∑i=1n(σSPri−r)4
Kurtosis(fisher)=(n−2)∗(n−3)(n+1)∗(n−1)∗((∑i=1n(n(ri)2)2∑i=1nn(ri)4−n+13∗(n−1))
Kurtosis(sampleexcess)=(n−1)∗(n−2)∗(n−3)n∗(n+1)∗∑i=1n(σSPri−r)4−(n−2)∗(n−3)3∗(n−1)2
where n
is the number of return, r
is the mean of the return
distribution, σP
is its standard deviation and σSP
is its
sample standard deviation
Author(s)
Diethelm Wuertz, Matthieu Lestel
References
Carl Bacon, Practical portfolio performance measurement
and attribution, second edition 2008 p.84-85
See Also
skewness
.
Examples
## 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"))
[Package
PerformanceAnalytics version 2.0.4
Index]