skewness {PerformanceAnalytics} | R Documentation |
Skewness
Description
compute skewness of a univariate distribution.
Usage
skewness(x, na.rm = FALSE, method = c("moment", "fisher", "sample"), ...)
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 |
... |
arguments to be passed. |
Details
This function was ported from the RMetrics package fUtilities to eliminate a
dependency on fUtiltiies being loaded every time. The function is identical
except for the addition of checkData and column support.
Skewness(moment) = \frac{1}{n}*\sum^{n}_{i=1}(\frac{r_i - \overline{r}}{\sigma_P})^3
Skewness(sample) = \frac{n}{(n-1)*(n-2)}*\sum^{n}_{i=1}(\frac{r_i - \overline{r}}{\sigma_{S_P}})^3
Skewness(fisher) = \frac{\frac{\sqrt{n*(n-1)}}{n-2}*\sum^{n}_{i=1}\frac{x^3}{n}}{\sum^{n}_{i=1}(\frac{x^2}{n})^{3/2}}
where n
is the number of return, \overline{r}
is the mean of the return
distribution, \sigma_P
is its standard deviation and \sigma_{S_P}
is its
sample standard deviation
Author(s)
Diethelm Wuertz, Matthieu Lestel
References
Carl Bacon, Practical portfolio performance measurement and attribution, second edition 2008 p.83-84
See Also
Examples
## mean -
## var -
# Mean, Variance:
r = rnorm(100)
mean(r)
var(r)
## skewness -
skewness(r)
data(managers)
skewness(managers)