Fix accuracy.R + add postTreatment draft
[morpheus.git] / reports / postTreatment.R
CommitLineData
b4aba3ce
BA
1K <- list("2"=2, "5"=2, "10"=3)
2p <- list("2"=c(.5,.5), "5"=c(.5,.5), "10"=c(.3, .3, .4))
3b <- list("2"=c(-.2, .5), "5"=c(-.2, .5), "10"=c(-.2, 0, .5))
4beta <- list(
5 "2"=matrix( c(1,-2, 3,1), ncol=2 ),
6 "5"=matrix( c(1,2,-1,0,3, 2,-3,0,1,0), ncol=2 ),
7 "10"=matrix( c(1,2,-1,0,3,4,-1,-3,0,2, 2,-3,0,1,0,-1,-4,3,2,0, -1,1,3,-1,0,0,2,0,1,-2), ncol=3 ))
8
9for (n in c("5000", "10000", "100000")) {
10 for (d in c("2", "5", "10")) {
11 load(paste0("res_",n,"_",d,"_logit.RData"))
12
13 # p
14 for (m in 1:2) {
15 err <- c()
16 for (i in 1:K[[d]])
17 err <- c(err, mean(abs(morpheus:::.extractParam(mr, 1, i)[[1]] - p[[d]][i])))
18 print(paste0("p", m, " ", mean(err)))
19 }
20
21 # b
22 for (m in 1:2) {
23 err <- c()
24 for (i in 1:K[[d]])
25 err <- c(err, mean(abs(morpheus:::.extractParam(mr, 2+d, i)[[1]] - b[[d]][i])))
26 print(paste0("b", m, " ", mean(err)))
27 }
28
29 # beta
30 for (m in 1:2) {
31 for (i in 1:K[[d]]) {
32 err <- c()
33 for (j in 1:d)
34 err <- c(err, mean(abs(morpheus:::.extractParam(mr, 1+j, i)[[1]] - beta[[d]][1+j,i])))
35 print(paste0("beta", m, "_", i, " ", mean(err)))
36 }
37 }
38 }
39}