#train classifier with 10 genes on Alon's Colon Cancer Data set.
ldarule1 <- RFlda(AlonDS[,-1],AlonDS[,1],Selmethod="fixedp",maxp=10)
# get in-sample classification results
predict(ldarule1,AlonDS[,-1],grpcodes=levels(AlonDS[,1]))$class
# compare classifications with true assignments
cat("Original classes:
")
print(AlonDS[,1])
# Estimate error rates by five-fold cross-validation replicated twice.
CrosValRes1 <- DACrossVal(AlonDS[,-1],AlonDS[,1],TrainAlg=RFlda,
Selmethod="fixedp",maxp=10,kfold=5,CVrep=2)
summary(CrosValRes1[,,"Clerr"])
#Find the best factor model amongst the choices q=1 or 2
ldarule2 <- RFlda(AlonDS[,-1],AlonDS[,1],q="CVq",CVqtrials=1:2,
Selmethod="fixedp",maxp=10)
cat("Best error rate estimate found with q =",ldarule2$q,"")
# Find the number of selected genes by the Extended HC scheme
ldarule3 <- RFlda(AlonDS[,-1],AlonDS[,1],q=ldarule2$q)
cat("Number of selected genes =",ldarule3$nvkpt,"")
# get classification results
predict(ldarule3,AlonDS[,-1],grpcodes=levels(AlonDS[,1]))$classRun the code above in your browser using DataLab