#!/usr/bin/env Rscript
acc.test <- function(gold, baseline, sys) {
  corr.baseline <- baseline == gold
  corr.sys <- sys == gold
  trials <-  sum(corr.baseline != corr.sys)
  succ <- sum(corr.sys > corr.baseline)
  return(binom.test(succ, trials, p=0.5, alternative="two.sided"))
}

args <- commandArgs()
dat <- read.table(args[length(args)])
test <- acc.test(dat$V1, dat$V2, dat$V3)
cat("p-value successes trials\n")
cat(test$p.value, test$statistic, test$parameter,"\n")


