Commit 319b2cbf authored by Jason Rhinelander's avatar Jason Rhinelander

Summary stats

parent e198c41e
......@@ -4,17 +4,43 @@ for (p in 2:4) {
larg <- ifelse(constr == "none" || constr == "all", "!L", paste(sep="", "L=", constr));
for (dist in c("beta55", "even")) {
for (v in c(999)) for (i in c(1000)) for (f in c(0.01)) for (I in c(0.1)) for (D in 0.05) for (A in c(F)) for (e in c("periodic")) for (E in c(10)) {
pat <- paste(sep="",
"^elections:p",p,",",
carg, ",", larg, ",",
"v",v,",d",dist,",i",i,",F",f,",I",I,",D",D,",",ifelse(A,"A","!A"),
",e",e,",E",E,",",
"seed=[0-9]+\\.data$");
opts <- paste(sep="",
"p",p,",",
carg, ",", larg, ",",
"v",v,",d",dist,",i",i,",F",f,",I",I,",D",D,",",
ifelse(A,"A","!A"), ",e",e,",E",E,",");
pat <- paste(sep="", "^elections:", opts, "seed=[0-9]+\\.data$");
rfs <- list.files("results/",
pattern=pat);
for (file in rfs) {
d <- read.
if (length(rfs) > 0) {
cat(opts, "\n");
means <- c();
meansmL <- c();
freqmL <- c();
for (file in rfs) {
data <- read.csv(paste(sep="/", "results", file));
means[length(means)+1] <- mean(data$position);
nonleft <- data[data$winner != 1,]$position;
meansmL[length(meansmL)+1] <- mean(nonleft);
freqmL[length(freqmL)+1] <- length(nonleft) / nrow(data);
#print(nrow(data));
#print(names(data));
}
cat("mean:", mean(means), "\n");
cat("sd:", sd(means), "\n");
cat("5-num summ.:", fivenum(means), "\n");
cat("\nWithout left-most party:\n");
cat("win frequency:", mean(freqmL), "\n");
cat("mean:", mean(meansmL), "\n");
cat("sd:", sd(meansmL), "\n");
cat("5-num summ.:", fivenum(meansmL), "\n\n\n");
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment