Created
January 4, 2017 23:29
-
-
Save joethorley/9adddc7ad2e0aa1a38cefe5b726dc1fe to your computer and use it in GitHub Desktop.
normalize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
normalize <- function(x) { | |
if (min(x) > 0) { | |
if (max(x) < 1) { | |
x <- logit(x) | |
} else | |
x <- log(x) | |
} | |
x | |
} | |
logit <- function(x) { | |
log(x / (1 - x)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment