Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating confidence interavals for likelihood ratio from 2x2 table

    Hello all,

    I am using Stata 16.0.

    I am working on a systematic review in which I have many predictors (ex. coma, lethargic, pallor) from different studies to predict severe outcome (ex. death). We extracted the 2x2 table data (variables A B C D) and calculated the likelihood ratios (variables: PLR NLR) for each predictor (variables: predictor).

    So the data looks like this
    Study Predictor A B C D PLR NLR
    xxx Coma 5 8 6 8 xx xx
    xxx Pallor 3 6 35 44 xx xx
    xxx Convulsions 55 66 77 88 xx xx
    A= true positive, B = false positive, C= False negative, D= True negative, PLR: Positive likelihood ratio, NLR: Negative likelihood ratio

    How can I generate the confidence intervals for each predictor (generate a new collumn with the upper and lower 95%CI for both the PLR and NLR?

    I have tried to play around with commands such as diagt and metandi but I am unable to figure out how to generate the confidence intervals.

    Any help would be very appreciated.

    Thanks,

    Rainer


  • #2
    Rainer:
    welcome to this forum.
    A similar thread was posted and replied just yesterday: https://www.statalist.org/forums/for...hi-square-test.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      While Carlo's link (#2) refer you to methods for individual/subject level data, your problem domain may be different as you are doing meta-analysis with study-level data. See Stata's 'meta' command suits for this (-help meta-). You did not mention how you calculated PLR and NLR. Usually you calculate the 95% CI using inverse-variance method where the inverse-variance is 1/A+1/B+1/C+1/D and A~D are the total number of subject/patient in group. Taking the square root of the variance gives you the standard error (s.e) of log variance and then you apply the log(Odds ratio) ± 1.96*(s.e) to get the 95% CIs. However, you will be more benefited if you read the meta help file as you may not need to calculate them. Identifying the cells will let the command auto calculate the variance, standard error, effect sizes and CIs.
      Roman

      Comment


      • #4
        Here is a workable example to leverage either Poisson regression or Stata's epidemiologic table commands to derive the likelihood ratios and their confidence intervals.

        Code:
        clear *
        cls
        
        input byte(truth test) int(n1 n2 n3)
        1 1 5 3 55
        0 1 8 6 66
        1 0 6 35 77
        0 0 8 44 88
        end
        gen byte revtest = 1 - test
        
        list
        And for the analysis of the 2nd outcome wiht selected output:

        Code:
        . di "TPR/Sens = " 3/(3+35)
        TPR/Sens = .07894737
        
        .
        . di "TNR/Spec = " 44/(44+6)
        TNR/Spec = .88
        
        .
        . di "FNR = " 35/(3+35)
        FNR = .92105263
        
        .
        . di "FPR = " 6/(44+6)
        FPR = .12
        
        .
        . di "LR+ = TPR/FPR = " (3/(3+35)) / (6/(44+6))
        LR+ = TPR/FPR = .65789474
        
        .
        . di "LR- = FNR/TNR = " (35/(3+35)) / (44/(44+6))
        LR- = FNR/TNR = 1.0466507
        
        . cs test truth [fw=n2]
        
                         | truth                  |
                         |   Exposed   Unexposed  |      Total
        -----------------+------------------------+------------
                   Cases |         3           6  |          9
                Noncases |        35          44  |         79
        -----------------+------------------------+------------
                   Total |        38          50  |         88
                         |                        |
                    Risk |  .0789474         .12  |   .1022727
                         |                        |
                         |      Point estimate    |    [95% Conf. Interval]
                         |------------------------+------------------------
         Risk difference |        -.0410526       |   -.1654068    .0833015
              Risk ratio |         .6578947       |    .1757197    2.463159
         Prev. frac. ex. |         .3421053       |   -1.463159    .8242803
         Prev. frac. pop |         .1477273       |
                         +-------------------------------------------------
                                       chi2(1) =     0.40  Pr>chi2 = 0.5290
        
        . di "LR+ [95% CI] = " %5.2f r(rr) " [" %5.2f r(lb_rr) ", " %5.2f r(ub_rr) "]"
        LR+ [95% CI] =  0.66 [ 0.18,  2.46]
        
        . glm test i.truth [fw=n2], fam(poisson) link(log) vce(robust) eform nolog
        
        ------------------------------------------------------------------------------
                     |               Robust
                test |        IRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
             1.truth |   .6578948   .4456716    -0.62   0.537     .1743953    2.481864
               _cons |        .12   .0462199    -5.50   0.000     .0564063    .2552906
        ------------------------------------------------------------------------------
        Note: _cons estimates baseline incidence rate.
        .
        . cs revtest truth [fw=n2]
        
                         | truth                  |
                         |   Exposed   Unexposed  |      Total
        -----------------+------------------------+------------
                   Cases |        35          44  |         79
                Noncases |         3           6  |          9
        -----------------+------------------------+------------
                   Total |        38          50  |         88
                         |                        |
                    Risk |  .9210526         .88  |   .8977273
                         |                        |
                         |      Point estimate    |    [95% Conf. Interval]
                         |------------------------+------------------------
         Risk difference |         .0410526       |   -.0833015    .1654068
              Risk ratio |         1.046651       |     .911414    1.201954
         Attr. frac. ex. |         .0445714       |   -.0971963    .1680215
         Attr. frac. pop |         .0197468       |
                         +-------------------------------------------------
                                       chi2(1) =     0.40  Pr>chi2 = 0.5290
        
        . di "LR- [95% CI] = " %5.2f r(rr) " [" %5.2f r(lb_rr) ", " %5.2f r(ub_rr) "]"
        LR- [95% CI] =  1.05 [ 0.91,  1.20]
        
        . glm revtest i.truth [fw=n2], fam(poisson) link(log) vce(robust) eform nolog
        
        ------------------------------------------------------------------------------
                     |               Robust
             revtest |        IRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
             1.truth |   1.046651   .0743062     0.64   0.521     .9106916    1.202907
               _cons |        .88   .0462199    -2.43   0.015     .7939175    .9754162
        ------------------------------------------------------------------------------
        Note: _cons estimates baseline incidence rate.
        The difference in standard errors (and hence CI widths) vary slightly by the method of how each is calculated, but will be in close agreement with each other generally.

        Comment


        • #5
          I just had another thought about what you may be doing. It's not common to summarize likelihood ratios in meta-analysis, though I have seen sensitivity and specificity more commonly and appropriately summarized. If it is your aim to meta-analyze LR+ and LR-, it is most appropriate to comebine them in a bivariate or mixed model to account for the fact that these two quantities are correlated (also true of sensitivity and specificity). It does appear that this is what -metandi- will do, though I have no experience with that user-contributed command.

          Comment


          • #6
            Hey,

            Thanks for all the responses. I will try to respond to all points:

            Roman:

            a) Calculation of LR

            I calculated the PLR and NLR like this:

            ** Create sensitivity and specificity**
            generate sens = A/(A+C)
            generate spec = D/(D+B)
            label variable sens "Sensitivity"
            label variable spec "Specificity"

            ** Generate likelihood ratio **
            generate PLR = sens/(1-spec)
            generate NLR = spec/(1-sens)

            b) meta command:

            The meta command only allows for calculation of:

            1) Log odds ratio for binary outcomes w SE and 95%CI using random-effects model (Method: REML):
            meta esize A B C D, esize(lnoratio)

            2) Risk ratio
            meta esize A B C D, esize(lnrratio)

            3) Risk difference
            meta esize A B C D, esize (rdiff)

            No commands for likelihood ratios + CIs unfortunately. So i think you may be right that I have to generate the CI using the specific calculations. Not exactly sure how I will be able to do this, but will keep you updated if I figure it out.

            Comment


            • #7
              In response to Leonardo:

              Thanks for the breakdown, but this provides the risk ratio and not the Likelihood ratio.

              In response to your second point: Good point, sen/spe are often used to describe diagnostic tests, but we felt that LR are more intuitive for clinical predictors. Also to be clear, we will not perform a meta-analysis with pooled values (due to high heterogeneity in studies) but rather qualitatively describe the different values.

              Comment


              • #8
                Rainer Tan go back and scrutinize my post in #4. I have said you will use machinery intended for risk ratios (in the traditional sense) to calculate other ratios (likelihood ratios in this case). I have also shown hand calculation to show that they are the same.

                Comment

                Working...
                X