Using PLS-DA for PCA-unclassified data

1. Load package

Using micOmics package for analysis. Data used for this tuitional were fetched from mixOmics package.

# import libraries

#install.packages("mixOmics")
library("mixOmics")
library(ggplot2)
library(grid)
library(gridExtra)

# featch data
data(breast.tumors)
X <- breast.tumors$gene.exp
Y <- breast.tumors$sample$treatment

2. PCA analysis using prcomp

X_pca <- X
X_pca[is.na(X)] <- 0
df_pca <- prcomp(X_pca)

df_out <- as.data.frame(df_pca$x)
df_out$group <- as.character(Y)

theme<-theme(panel.background = element_blank(),panel.border=element_rect(fill=NA),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),strip.background=element_blank(),axis.text.x=element_text(colour="black"),axis.text.y=element_text(colour="black"),axis.ticks=element_line(colour="black"),plot.margin=unit(c(1,1,1,1),"line"))
p<-ggplot(df_out,aes(x=PC1,y=PC2,color=group, label=row.names(df_out) ))
p<-p+geom_point()+geom_text(size=10)+theme
p

png

From this picture, it is hard to divide AF from BE groups. Maybe a new method could provide an improvement.

3. Partial Least Squares Discriminant Analysis (PLS-DA) analysis using mixOmics.

plsda.breast <- plsda(X, Y, ncomp = 2)

df_out <- as.data.frame(plsda.breast$variates$X)
df_out$group <- as.character(Y)
colnames(df_out) <- c("PC1", "PC2", "group")
p<-ggplot(df_out,aes(x=PC1,y=PC2,color=group, label=row.names(df_out) ))
p<-p+geom_point()+geom_text(size=10)+theme
p

png


本文作者Boqiang Hu, 欢迎评论、交流。
转载请务必标注出处: Using PLS-DA for PCA-unclassified data