Usage Arguments Value Author(s) Examples
1 |
DList |
Input data set matrix (a list of multiple datasets; row=features, column=samples). |
method |
"SSC" = Sum of Squared Cosine, "SV" = Sum of variance |
Meta.Dim |
Dimension size of meta-eigenvector matrix |
is.auto.Dim |
Logical value whether dimension size of each study's eigenvector matrix (SSC) is determined by an arbitrary variance quantile |
is.equal.Dim |
Logical value whether dimension size of each study's eigenvector matrix (SSC) is equal across studies |
e.Dim |
Dimension size of each study's eigenvector matrix (SSC) when is.equal.Dim = TRUE |
is.weight |
Logical value whether the reciprocal of the largest eigenvalue is mutiplied to covariance matrix |
.var.quantile |
A threshold indicating the minimum variance of individual study, when is.auto.Dim = TRUE |
.scaleAdjust |
Logical value whether the PC projection is scaled to mean of zero and SD of 1 |
is.sparse |
Logical value whether meta-eigenvector matrix is penalized to encourage sparseness |
Lambda |
Tuning parameter for penalty constant |
res = a list of meta analytic PCA
res$v = Meta eigenvector matrix
res$coord = Meta PC projection from input data
SungHwan Kim swiss747@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | library(yeastCC)
data(yeastCC)
data<-Biobase::exprs(yeastCC)
library(impute)
data.na<-is.na(data)
data.na.length<-apply(data.na, 1, sum)
data.sd<-apply(as.matrix(data), 1, sd, na.rm=TRUE)
new.data<-data[data.na.length<77*0.1 & data.sd>0.45,]
Spellman <- list(alpha=impute.knn(new.data[,5:22])$data,
cdc15=impute.knn(new.data[,23:46])$data,
cdc28=impute.knn(new.data[,47:63])$data,
elu=impute.knn(new.data[,64:77])$data)
## Standard Principal Component Analysis ##
Spellman.prcomp <- list(alpha=svd(t(Spellman$alpha))$v,
cdc15=svd(t(Spellman$cdc15))$v,
cdc28=svd(t(Spellman$cdc28))$v,
elu=svd(t(Spellman$elu))$v)
# res1 <- meta.pca(DList=Spellman, method="SV", Meta.Dim=2, is.auto.Dim = TRUE)
res2 <- meta.pca(DList=Spellman, method="SSC", Meta.Dim=2, is.auto.Dim = TRUE)
par(mfrow=c(6,4), cex=1 ,oma=c(0,6,2,0), mar=c(0.2,0.2,0.2,0.2))
for(i in 1:4) {
for(j in 1:4) {
.coord <- scale(t(Spellman[[j]]), scale=FALSE)
#.coord <- t(Spellman[[j]]-pcaPP::l1median(t(Spellman[[j]]),trace=-1)) %*% Spellman.prcomp[[i]]$loadings[,1:2]
plot(.coord[,1], .coord[,2], type="n", xlab="", ylab="", xaxt="n", yaxt="n"
,ylim=c(min(.coord[,2])-1.5, max(.coord[,2])+1.5)
,xlim=c(min(.coord[,1])-1, max(.coord[,1])+1))
text(.coord[,1], .coord[,2], 1:nrow(.coord), cex=1)
lines(.coord[,1], .coord[,2], col='grey55')
}
}
## SV
#for(j in 1:4) {
# .coord <- res1$coord[[j]]
# plot(.coord[,1], .coord[,2], type="n", xlab="", ylab="", xaxt="n", yaxt="n")
# text(.coord[,1], .coord[,2], 1:nrow(.coord), cex=1)
# lines(.coord[,1], .coord[,2])
# }
## SSC
for(j in 1:4) {
.coord <- res2$coord[[j]]
plot(.coord[,1], .coord[,2], type="n", xlab="", ylab="", xaxt="n", yaxt="n"
,ylim=c(min(.coord[,2])-1.5, max(.coord[,2])+1.5)
,xlim=c(min(.coord[,1])-1, max(.coord[,1])+1))
text(.coord[,1], .coord[,2], 1:nrow(.coord), cex=1)
lines(.coord[,1], .coord[,2], col='grey55')
}
## Sparse MetaPCA (SSC)
library(PMA)
library(doMC)
res4 <- meta.pca(DList=Spellman, method="SSC", Meta.Dim=2, is.auto.Dim = TRUE, is.sparse=TRUE, Lambda=6)
res4 <- res4$v
coord <- list()
for(i in 1:4) {
coord[[i]] <- t(Spellman[[i]])
}
for(j in 1:4) {
.coord <- coord[[j]]
plot(.coord[,1], .coord[,2], type="n", xlab="", ylab="", xaxt="n", yaxt="n"
,ylim=c(min(.coord[,2])-1.5, max(.coord[,2])+1.5)
,xlim=c(min(.coord[,1])-1, max(.coord[,1])+1))
text(.coord[,1], .coord[,2], 1:nrow(.coord), cex=1)
lines(.coord[,1], .coord[,2], col='grey55')
}
####################################################################################################
## Searching the optimal tuning parameter based on the proportion of increased explained variance
####################################################################################################
optimal.lambda <- meta.pca.cv(DList=Spellman, method="SSC", Meta.Dim=2, CV_lambda = seq(1,10,1), is.plot=TRUE)
## optimal.lambda = 8
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.