为什么Mantel-Haenszel测试返回无穷大的置信区间?

时间:2018-01-17 23:48:09

标签: r statistics desctools

当我设置替代="更大"当使用mantelhaen.test时,返回的置信区间上限为Inf。为什么会发生这种情况,我能解决吗?我不确定这个问题是否源于编程(可能是我的数据格式?),还是更多的统计问题。

这是我的输出:

       Mantel-Haenszel chi-squared test with continuity correction

    Mantel-Haenszel X-squared = 3.7413, df = 1, p-value = 0.02654
    alternative hypothesis: true common odds ratio is greater than 1
    95 percent confidence interval:
     1.192457      Inf
    sample estimates:
    common odds ratio 
      2.59944 

以下是一些示例代码:

    library(vcd)
    library(DescTools)

    example =("
                      Year Treatment Dead      Count
                      2015  Control   no          50
                      2015  Treat     no          60
                      2015  Control   yes          1
                      2015  Treat     yes          4
                      2016  Control   no          40                                  
                      2016  Treat     no         115                
                      2016  Control   yes          2                  
                      2016  Treat     yes          9 
                      2017  Control   no         142                 
                      2017  Treat     no          33      
                      2017  Control   yes          6                 
                      2017  Treat     yes          5                 
                      ")

    example = read.table(textConnection(example),header=TRUE)

    example =
      mutate(example,
             Year = factor(Year, levels=unique(Year)),
             Treatment = factor(Treatment, levels=unique(Treatment)),
             Dead = factor(Dead, levels=unique( Dead))
      )

    example.xtabs = xtabs(Count ~ Dead + Treatment + Year, 
                                  data=example)   


    ftable(example.xtabs)                      


    mantelhaen.test(example.xtabs) 
    mantelhaen.test(example.xtabs, alternative = "greater") #one sided - why 
                                                             #does CI = Inf

0 个答案:

没有答案