[Swift-commit] r3080 - in SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations: . scripts
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Sat Aug 8 10:35:20 CDT 2009
Author: andric
Date: 2009-08-08 10:35:20 -0500 (Sat, 08 Aug 2009)
New Revision: 3080
Added:
SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/
SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R
SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R
SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R
Log:
scripts dir for NewPermutations
Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R
===================================================================
--- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R (rev 0)
+++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R 2009-08-08 15:35:20 UTC (rev 3080)
@@ -0,0 +1,5 @@
+config <- array(0,c(4000,3,24))
+for (i in 1:ncol(config[1,,])){
+ config[,,i] <- sample(1:3)
+}
+save(config,file="config_file.Rdata")
Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R
===================================================================
--- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R (rev 0)
+++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R 2009-08-08 15:35:20 UTC (rev 3080)
@@ -0,0 +1,9 @@
+cc <- as.vector(c(rep(0,12),rep(1,12)))
+con <- matrix(nrow=4000,ncol=24)
+mat_row <- 0;
+
+for (i in 1:nrow(con)){
+ mat_row <- mat_row + 1
+ con[mat_row,] <- c(sample(cc))
+}
+write.table(con,file="subjs_config_file.txt",row.names=FALSE,col.names=FALSE,quote=FALSE)
Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R
===================================================================
--- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R (rev 0)
+++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R 2009-08-08 15:35:20 UTC (rev 3080)
@@ -0,0 +1,38 @@
+#---- doing friedman permutations
+#---- coded Tuesday; July 22, 2008
+
+#---- this is the function used in the aggregate:
+FriedmanPerm <- function(x){
+ mb <- matrix(nrow=24,ncol=3)
+ mb[,1] = x[1:24]
+ mb[,2] = x[25:48]
+ mb[,3] = x[49:72]
+ for (t in subj_resamp){
+ mb[t,] <- mb[t,(config[configLine,,t])]
+ }
+ return(friedman.test(mb)[[1]][[1]])
+}
+
+#---- Swift housekeeping:
+allinputs <- Sys.getenv("R_SWIFT_ARGS")
+print(Sys.getenv("R_SWIFT_ARGS"));
+outname <- noquote(strsplit(allinputs," ")[[1]][1])
+configLine <- as.integer(noquote(strsplit(allinputs," ")[[1]][2]))
+print(configLine)
+
+inputfile <- Sys.getenv("R_INPUT")
+print(inputfile)
+Query_out <- as.matrix(read.table(inputfile))
+load("config_file.Rdata")
+config_subjs <- as.matrix(read.table("subjs_config_file.txt"))
+subj_resamp <- which(as.vector(config_subjs[configLine,])==1)
+
+
+#---- this is where the fun begins:
+data_stack <- stack(data.frame(Query_out[,3:5]))[1]
+vertices <- Query_out[,2]
+nn <- data.frame(cbind(vertices,data_stack))
+m <- matrix(nrow=length(as.integer(levels(as.factor(vertices)))),ncol=2)
+m[,1] <- as.integer(levels(as.factor(vertices)))
+m[,2] <- aggregate(nn$values, list(nn$vertices),FriedmanPerm)[,2]
+write.table(round(m,5), file=paste(configLine,"PermFriedman",outname,".txt",sep=""), row.names=FALSE, col.names=FALSE, quote=F)
More information about the Swift-commit
mailing list