a6cac0549b7c9208d1a99d1d75f50a6e67641cfa
[morpheus.git] / reports / printResults.R
1 prms <- function(name, idx)
2 {
3 load(name)
4 d <- nrow(mr[[1]][[1]])-2
5 p <- colMeans(do.call(rbind, lapply(mr[[idx]], function(m) m[1,])))
6 b <- colMeans(do.call(rbind, lapply(mr[[idx]], function(m) m[2+d,])))
7 L <- length(mr[[1]])
8 beta <- (1/L) * Reduce("+", lapply(mr[[idx]], function(m) m[2:(d+1),]))
9 list(p, beta, b, mr_params)
10 }
11
12 pprms <- function(link)
13 {
14 for (n in c("5000", "10000", "100000", "500000", "1000000"))
15 {
16 for (method in 1:2)
17 {
18 toprint <- c()
19 for (d in c(2,5,10))
20 {
21 name <- paste0("res_", n, "_", d, "_", link, ".RData")
22 params <- prms(name, method)
23 toprint <- c(toprint, c(
24 sum(abs(params[[1]] - params[[4]]$p)),
25 colSums(abs(params[[2]] - params[[4]]$beta)),
26 sum(abs(params[[3]] - params[[4]]$b))
27 ))
28 }
29 print(toprint, digits=2)
30 }
31 }
32 }