# NOT RUN {
# load sda library
library("sda")
#################
# training data #
#################
# prostate cancer set
data(singh2002)
# training data
Xtrain = singh2002$x
Ytrain = singh2002$y
#########################################
# feature ranking (diagonal covariance) #
#########################################
# ranking using t-scores (DDA)
ranking.DDA = sda.ranking(Xtrain, Ytrain, diagonal=TRUE)
ranking.DDA[1:10,]
# plot t-scores for the top 40 genes
plot(ranking.DDA, top=40)
# number of features with local FDR < 0.8
# (i.e. features useful for prediction)
sum(ranking.DDA[,"lfdr"] < 0.8)
# number of features with local FDR < 0.2
# (i.e. significant non-null features)
sum(ranking.DDA[,"lfdr"] < 0.2)
# optimal feature set according to HC score
plot(ranking.DDA[,"HC"], type="l")
which.max( ranking.DDA[1:1000,"HC"] )
#####################################
# feature ranking (full covariance) #
#####################################
# ranking using CAT-scores (LDA)
ranking.LDA = sda.ranking(Xtrain, Ytrain, diagonal=FALSE)
ranking.LDA[1:10,]
# plot t-scores for the top 40 genes
plot(ranking.LDA, top=40)
# number of features with local FDR < 0.8
# (i.e. features useful for prediction)
sum(ranking.LDA[,"lfdr"] < 0.8)
# number of features with local FDR < 0.2
# (i.e. significant non-null features)
sum(ranking.LDA[,"lfdr"] < 0.2)
# optimal feature set according to HC score
plot(ranking.LDA[,"HC"], type="l")
which.max( ranking.LDA[1:1000,"HC"] )
# }
Run the code above in your browser using DataLab