Skip to content

Instantly share code, notes, and snippets.

@christophergandrud
Last active July 12, 2017 11:03
Show Gist options
  • Save christophergandrud/fc5215fa730263e3a1ee to your computer and use it in GitHub Desktop.
Save christophergandrud/fc5215fa730263e3a1ee to your computer and use it in GitHub Desktop.
Inverse hyperbolic sine transformation
#' Inverse hyperbolic sine transformation
#'
#' @param x a numeric vector
#'
#' @details A useful transformation for skewed data that includes 0's and
#' negative values
ihs <- function(x) {
transformed <- log(x + sqrt(x ^ x + 1))
return(transformed)
}
@moritzpschwarz
Copy link

Correct me if I am wrong but the inverse hyperbolic sine function is x^2 not x^x
Therefore in my mind the code should be like this:

ihs <- function(x) { transformed <- log(x + sqrt(x^2+1)); return(transformed) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment