From: Benjamin Auder Date: Mon, 16 Dec 2019 17:42:46 +0000 (+0100) Subject: Add print results script for article X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/assets/current/doc/%7B%7B%20targetUrl%20%7D%7D?a=commitdiff_plain;h=c181c2c3e6aedac53204f088a7f0702d03d4e513;p=morpheus.git Add print results script for article --- diff --git a/reports/printResults.R b/reports/printResults.R new file mode 100644 index 0000000..2c3dbee --- /dev/null +++ b/reports/printResults.R @@ -0,0 +1,33 @@ +prms <- function(name, idx) +{ + load(name) + d <- nrow(mr[[1]][[1]])-2 + p <- colMeans(do.call(rbind, lapply(mr[[idx]], function(m) m[1,]))) + b <- colMeans(do.call(rbind, lapply(mr[[idx]], function(m) m[2+d,]))) + L <- length(mr[[1]]) + beta <- (1/L) * Reduce("+", lapply(mr[[idx]], function(m) m[2:(d+1),])) + list(p, beta, b, mr_params) +} + +pprms <- function(link) +{ + for (n in c("5000", "10000", "100000", "500000", "1000000")) + { + method =1 + #for (method in 1:2) + #{ + toprint <- c() + for (d in c(2,5,10)) + { + name <- paste0("res_", n, "_", d, "_", link, "_6,3,1.RData") + params <- prms(name, method) + toprint <- c(toprint, c( + sum(abs(params[[1]] - params[[4]]$p)), + colSums(abs(params[[2]] - params[[4]]$beta)), + sum(abs(params[[3]] - params[[4]]$b)) + )) + } + print(toprint, digits=2) + #} + } +}