setwd("C:/sepp/work/fabia/experiments") library(fabia) m <- 10 n=1000 l=100 for (i in 1:m) { load(file=paste("exp_",as.character(i),".RData",sep = "")) X <- dat[[1]] X <- X- rowMeans(X) XX <- (1/ncol(X))*tcrossprod(X) dXX <- 1/sqrt(diag(XX)+0.001*as.vector(rep(1,nrow(X)))) X <- dXX*X mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(X)^j) } meth="X: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) Y <- dat[[2]] Y <- Y- rowMeans(Y) YY <- (1/ncol(Y))*tcrossprod(Y) dYY <- 1/sqrt(diag(YY)+0.001*as.vector(rep(1,nrow(Y)))) Y <- dYY*Y mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(Y)^j) } meth="Y: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFab <- fabia(X,200,0.4,1.0,1.0,13) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFab$L%*%resFab$Z)^j) } meth="fabia: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFab$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFab$L[,q],resFab$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabia-p: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFabs <- fabias(X,200,0.4,1.0,13) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFabs$L%*%resFabs$Z)^j) } meth="fabias: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFabs$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFabs$L[,q],resFabs$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabias-p: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) } data(Breast_A) X <- as.matrix(XBreast) X <- X- rowMeans(X) XX <- (1/ncol(X))*tcrossprod(X) dXX <- 1/sqrt(diag(XX)+0.001*as.vector(rep(1,nrow(X)))) X <- dXX*X mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(X)^j) } meth="X Breast: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFab <- fabia(X,200,0.1,1.0,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFab$L%*%resFab$Z)^j) } meth="fabia Breast: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFab$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFab$L[,q],resFab$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabia-p Breast: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFabs <- fabias(X,200,0.4,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFabs$L%*%resFabs$Z)^j) } meth="fabias Breast: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFabs$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFabs$L[,q],resFabs$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabias-p Breast: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) data(Multi_A) X <- as.matrix(XMulti) X <- X- rowMeans(X) XX <- (1/ncol(X))*tcrossprod(X) dXX <- 1/sqrt(diag(XX)+0.001*as.vector(rep(1,nrow(X)))) X <- dXX*X mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(X)^j) } meth="X Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFab <- fabia(X,200,0.1,1.0,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFab$L%*%resFab$Z)^j) } meth="fabia Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFab$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFab$L[,q],resFab$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabia-p Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFabs <- fabias(X,200,0.4,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFabs$L%*%resFabs$Z)^j) } meth="fabias Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFabs$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFabs$L[,q],resFabs$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabias-p Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) data(DLBCL_B) X <- as.matrix(XDLBCL) X <- X- rowMeans(X) XX <- (1/ncol(X))*tcrossprod(X) dXX <- 1/sqrt(diag(XX)+0.001*as.vector(rep(1,nrow(X)))) X <- dXX*X mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(X)^j) } meth="X DLBCL: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFab <- fabia(X,200,0.1,1.0,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFab$L%*%resFab$Z)^j) } meth="fabia DLBCL: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFab$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFab$L[,q],resFab$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabia-p DLBCL: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) resFabs <- fabias(X,200,0.4,1.0,5) mo <- list() for (j in 1:8) { mo[[j]] <- sum(as.numeric(resFabs$L%*%resFabs$Z)^j) } meth="fabias DLBCL: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) p=ncol(resFabs$L) for (j in 1:8) { mo[[j]] <- 0 for (q in 1:p) { mom <- as.numeric(tcrossprod(resFabs$L[,q],resFabs$Z[q,])) mo[[j]] <- mo[[j]] + sum(mom^j) } mo[[j]] <- mo[[j]]/(length(mom)*p) } meth="fabias-p Multi: " write.table(t(as.vector(c(meth,unlist(mo)))), file = "moments.txt", quote = FALSE, sep = "\t",row.names = FALSE,col.names = FALSE,append =TRUE) #======================================================================== mo<-read.table("moments.txt",sep="\t")