# NOT RUN {
# Toy Example
scores <- c(.6, .2, .9)
graph <- cbind(c(1,1), c(2,3), c(.4, .8))
familyRank(scores = scores, graph = graph, d = .5)
# }
# NOT RUN {
# Simulate data set
# 100 samples
# 1000 features
# Features 1 through 15 perfectly define response
# All other features are random noise
simulatedData <- createData(n.case = 50, n.control = 50, mean.upper=13, mean.lower=5,
sd.upper=1, sd.lower=1, n.features = 10000,
subtype1.feats = 1:5, subtype2.feats = 6:10,
subtype3.feats = 11:15)
x <- simulatedData$x
y <- simulatedData$y
graph <- simulatedData$graph
# Score simulated features using absolute difference in group means
scores <- apply(x, 2, function(col){
splt <- split(col, y)
group.means <- unlist(lapply(splt, mean))
score <- abs(diff(group.means))
names(score) <- NULL
return(score)
})
# Display top 15 features using emprical score
order(scores, decreasing = TRUE)[1:15]
# Rank scores using familyRank
scores.fr <- familyRank(scores = scores, graph = graph, d = .5)
# Display top 15 features using emprical scores with Family Rank
order(scores.fr, decreasing = TRUE)[1:15]
# }
Run the code above in your browser using DataLab