Created
June 5, 2015 17:05
-
-
Save johnschrom/3f61097e78cedc7d5229 to your computer and use it in GitHub Desktop.
Quintile normalization
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
# Create a refernce distribution using the median of all samples | |
ref <- apply(apply(data.normalized[,3:ncol(data.normalized)], | |
2, | |
FUN=sort), | |
1, | |
FUN=median) | |
# Create a emperical cdf function for the reference distribution | |
ref.cdf <- ecdf(ref) | |
# Quintile normalize! | |
data.qn <- apply(data.normalized[,3:ncol(data.normalized)], 2, function(d) { | |
sample.cdf <- ecdf(d) | |
return(quantile(ref.cdf, sample.cdf(d))) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment