library(verification)
给定几个实验(AA,BB,...,
),我可以使用以下方法运行我的代码reproducible example
:
##################### EXPERIMENT AA
#my data in reality is continuous but I convert it to binary using a threshold
obs=data.frame(replicate(10,round(runif(100))))
pred=data.frame(replicate(10,round(runif(100))))
#introduce a few NA values to simulate real world data.
obs1=as.data.frame(lapply(obs, function(cc) cc[ sample(c(TRUE, NA), prob = c(0.85, 0.15), size = length(cc), replace = TRUE) ]))
pred1=as.data.frame(lapply(pred, function(cc) cc[ sample(c(TRUE, NA), prob = c(0.85, 0.15), size = length(cc), replace = TRUE) ]))
#A=mapply(verify,obs1,pred1,frcst.type = "binary", obs.type = "binary")
pred1[,1]=NA # some points in pred1 have all NAs in reality
a=mapply(function(x, y) {if(all(is.na(y))) NA else verify(x, y, frcst.type = "binary", obs.type = "binary")
}, obs1,pred1,SIMPLIFY = F,USE.NAMES = TRUE)
aa=do.call('rbind',a)# put all paramters together and keep rownames for easy identification
##################### EXPERIMENT BB
obs=data.frame(replicate(10,round(runif(100))))
pred=data.frame(replicate(10,round(runif(100))))
#introduce a few NA values to simulate real world data.
obs2=as.data.frame(lapply(obs, function(cc) cc[ sample(c(TRUE, NA), prob = c(0.85, 0.15), size = length(cc), replace = TRUE) ]))
pred2=as.data.frame(lapply(pred, function(cc) cc[ sample(c(TRUE, NA), prob = c(0.85, 0.15), size = length(cc), replace = TRUE) ]))
#A=mapply(verify,obs1,pred1,frcst.type = "binary", obs.type = "binary")
pred2[,1]=NA # some points in pred1 have all NAs in reality
b=mapply(function(x, y) {if(all(is.na(y))) NA else verify(x, y, frcst.type = "binary", obs.type = "binary")
}, obs2,pred2,SIMPLIFY = F,USE.NAMES = TRUE)
bb=do.call('rbind',b)# put all paramters together and keep rownames for easy identification
1)我想强制aa
并bb
使用名为 ignoring 的数据Answer
框$tab, $pred,$obs
。请注意,输入数据的rownames
inaa
和bb
是colnames
(所有输入具有相同的列名)
2) 对于实验AA
、BB
、...
in Answer
,我还希望两个实验中的每个参数都有相邻的列,例如TS
inAnswer
将具有TS1
,Ts2
作为分别代表实验 AA 和 BB 的单独列。