编写一个函数来引导CI

时间:2017-11-07 01:44:46

标签: r

我试图计算一个名为CoRR的统计度量的自举CI,但该函数运行最多200次迭代,如果我给它超过200次则停止。

textView.text = textView.text.toString().toInt().plus(1).toString()

这就是我编码变量的方式:

library(boot)

corr<-function(x,i){

  x2<-x[i,]

rr_c<-epi.2by2((xtabs(~PRSH + depr, data=x2)[c(2,1), c(2,1)]))$res$RR.crude.wald[[1]]

rr_a<- epi.2by2((xtabs(~PRSH + depr + DHHGAGE, data=x2)[c(2,1), c(2,1),]))$res$RR.mh.wald[[1]]

return(abs(log(rr_c/rr_a)))
}

boot.corr<- boot(data=data, statistic=corr,R=1000)

boot.ci(boot.corr, type="perc")

这是它产生的错误:if(得分&gt; z){:缺少值需要TRUE / FALSE

0 个答案:

没有答案
相关问题