R/sampleMoments.R

### Functions to calculate the sample skewness and kurtosis
### Taken from the package e1071
skewness <- function (x, na.rm = FALSE){
  if (na.rm) {
    x <- x[!is.na(x)]
  }
  sum((x - mean(x))^3)/(length(x)*sd(x)^3)
}

kurtosis <- function (x, na.rm = FALSE){
  if (na.rm) {
    x <- x[!is.na(x)]
  }
  sum((x - mean(x))^4)/(length(x)*var(x)^2) - 3
}

Try the HyperbolicDist package in your browser

Any scripts or data that you put into this service are public.

HyperbolicDist documentation built on Nov. 26, 2023, 9:07 a.m.