2c3dbee45d86fe1ebab38721a8ea09bb6700875f
[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 method =1
17 #for (method in 1:2)
18 #{
19 toprint <- c()
20 for (d in c(2,5,10))
21 {
22 name <- paste0("res_", n, "_", d, "_", link, "_6,3,1.RData")
23 params <- prms(name, method)
24 toprint <- c(toprint, c(
25 sum(abs(params[[1]] - params[[4]]$p)),
26 colSums(abs(params[[2]] - params[[4]]$beta)),
27 sum(abs(params[[3]] - params[[4]]$b))
28 ))
29 }
30 print(toprint, digits=2)
31 #}
32 }
33 }