Stata中的综合判别指数(IDI)

时间:2013-08-08 17:26:41

标签: stata

我得到了两个截然不同的综合症识改善结果(IDI)。

如果我使用nriidi.pkg包并运行idi我得到此输出

    . idi totaloutcome grace_prob, prvars(allelecount)

----------------------------------------------------
      IDI |     Estimate     Std. Err.       P-value
 ----------+-----------------------------------------
           |     -0.01116       0.00430       0.00946
 ----------------------------------------------------

但是当我使用Mark Lunt的程序中的idi

 . net from http://personalpages.manchester.ac.uk/staff/mark.lunt

 . idi totaloutcome allelecount grace_prob

 Integrated Discrimination Improvement for allelecount = 0.0017
 Standard Error                                        = 0.0022
 z                                                     = 0.7615
 P-value (one-sided)                                   = 0.2232
 P-value (two-sided)                                   = 0.4464

任何人都可以解释为什么会出现这种情况或说明为什么一个包可能比其他包更好?

2 个答案:

答案 0 :(得分:4)

这里将各种问题捆绑在一起。

  1. 为什么有两个idi程序?简单:两位独立工作的作者写了两个同名的程序,然后在他们自己的网站上发布他们的程序。没有机制可以阻止这种情况发生。怎么会有?如果作者都试图通过 Stata Journal 或SSC网站(help ssc获取信息)进行发布,那么第二位作者将被要求更改任何程序的名称与同一网站上已有的程序发生冲突。但没有人有义务以这两种方式发表文章。 (另外,使用searchfindit作者可以在互联网上查找具有给定名称的已发布程序,以避免冲突。)

  2. 您如何一起使用这两个程序?您可以将这两个程序复制到单独的目录或文件夹中,并在它们之间移动。更好的方法是更改​​两个程序中至少一个的名称。

    • 例如,我可以通过进入Stata来安装Mark Lunt的idi程序

      . copy http://personalpages.manchester.ac.uk/staff/mark.lunt/idi.ado idi_l.ado
      
    • 然后,我需要编辑程序文件idi_l.ado,以便标题行显示program idi_l

    • 您也需要编辑相应的帮助文件,尽管您可以使用上面type命令样式的copy远程访问它。

    • 如果这对您来说是新的,请允许我强调这些是Stata命令;不需要浏览器,但是如果他们在防火墙后面,某些地方的人将无法做到这一点。

  3. 为什么这些节目产生不同的答案?答案很简单,你必须查看代码。就比较两个ado文件而言,Stata在这里是开源的,因此在这方面与R完全相同。程序之间的主要区别在于,在运行两个logistic命令后,Byberg程序从两个调用ci获得标准错误,而Lunt程序从调用ttest获得标准错误unequal选项。这两个结果往往很接近,但它们可能会有所不同。正如@Metrics指出的那样,您应该使用viewsource或喜欢的文本编辑器来查看代码。

  4. 一个程序更好吗?这很难判断,但我个人的观点是,与Stata标准相比,Lunt程序编写得更好,质量更高。 Byberg程序执行一些不必要的操作,最重要的是不处理ifin限定符。

  5. OP的结果怎么样?我们无法看到OP的数据,因此无法发表评论。

  6. 为了使比较更容易,我之前重写了Byberg程序,但不保证回答更多问题!

     *! 1.0.0 NJC 9 Aug 2013 
     * modifying idi (Liisa Byberg) from http://www.ucr.uu.se/sv/images/stories/downloads
     program idi_b, rclass  
     version 10.1
     syntax varlist(numeric min=2) [if] [in] , PRvars(varlist numeric min=1)
    
     quietly {
         marksample touse
         tokenize "`varlist'" 
         args out
         tempvar pred1 pred2 diffpred 
         tempname mdiffprednonevents sediffprednonevents mdiffpredevents sediffpredevents
         tempname idi seidi zidi pidi
    
         logistic `varlist' if `touse'
         predict `pred1' if `touse' 
         logistic `varlist' `prvars'  if `touse'
         predict `pred2' if `touse' 
         gen `diffpred' = `pred2' - `pred1'
    
         ci `diffpred' if `out' == 0 
         scalar `mdiffprednonevents' = r(mean)
         scalar `sediffprednonevents' = r(se)
         ci `diffpred' if `out' == 1
         scalar `mdiffpredevents' = r(mean)
         scalar `sediffpredevents' = r(se)
    
         scalar `idi' =  `mdiffpredevents' - `mdiffprednonevents'
         scalar `seidi' =  sqrt(`sediffprednonevents'^2 + `sediffpredevents'^2)
         scalar `zidi' = `idi'/`seidi'
         scalar `pidi' = 2*(1-normal(abs(`zidi')))
       }
    
       di _n "IDI" 
       di "  Estimate  "   %9.5f `idi'
       di "  Std. Err. "   %9.5f `seidi' 
       di "  z         "   %9.5f `zidi' 
       di "  P-value   "   %9.5f `pidi' 
    
       return scalar idi_b_p = `pidi' 
       return scalar idi_b_z = `zidi' 
       return scalar idi_b_se = `seidi' 
       return scalar idi_b = `idi' 
    
       end
    

答案 1 :(得分:1)

两者都给出了相同的答案。例如,请参阅下面使用Stata的cancer数据。

sysuse cancer

对于Pent idi命令:

Syntax

        idi outcomevar new_marker varlist [if] [in]


The command idi calculates the Integrated Discrimination Improvement (IDI) due to
    a new marker new_marker, where the old model predicted outcomevar from varlist.
    The definition of the IDI is given by Pencina et al (2008). It can be thought of
    as the average improvement in sensitivity across all possible cutoffs.

idi died drug age

Integrated Discrimination Improvement for drug = 0.2044
Standard Error                                 = 0.0575
z                                              = 3.5554
P-value (one-sided)                            = 0.0002
P-value (two-sided)                            = 0.0004

在上面的示例中,新标记是药物,因此您可能正在测试改进,因为:

来自Byberg的idi

Syntax

    idi depvar varlist1 [, options]


    options                  description
    ----------------------------------------------------------------------------------
    Main

      prvars(varlist2)        variable list of new predictor variables

 prvars() is not optional; see below.


Description

    idi calculates the integrated discrimination improvement, which is, as is nri, a
    measure that compares the discrimination ability between two logistic regression
    prediction models. The command assumes a binary numerical depvar and two sets of
    numerical and/or categorical covariates for the two models. The xi function is not
    yet available and dummy variables for categorical covariates with more than two
    categories need to be specified by the user.
    Output are estimated IDI with standard error and p value for test of the null
    hypothesis that IDI in the population is zero.
    Also see: nri

idi died age, prvars(drug)

----------------------------------------------------
      IDI |     Estimate     Std. Err.       P-value
----------+-----------------------------------------
          |      0.20436       0.05748       0.00038
----------------------------------------------------

此处,新标记为prvars