Announcement

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

  • Estimate risk ratio after xtlogit

    Dear All,

    I'm hoping someone call tell if there is a way to estimate risk ratios after using xtlogit. The data is below. To give it some context. Pregnant patients are being assessed for the binary outcome PET. Six different biomarkers are being assessed although I only included one here to keep the dataset small std_PAPPA2ngml. Basic baseline variables include age, BMI pre-pregnancy, race, blood pressure (clinicMAP), and a biometric measurement called cfpwv.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int id byte(Trimester PET age) double bmi_pre_preg byte race_bin double(clinicMAP cfpwv) float(std_PAPPA2ngmL std_spRatio)
     1 1 1 29 25.15589569 0                 95         7.2   -.5222185     .3073503
     1 2 1 29 25.15589569 0                 95         7.3  -.25407675    -.3172096
     1 3 1 29 25.15589569 0              98.75           .    3.066324     .3035415
     2 1 0 39 54.55568942 0  96.66666666666667           .   -.6136905    .10374988
     2 2 0 39 54.55568942 0  91.33333333333333       7.442   -.6163323   -.27824256
     2 3 0 39 54.55568942 0                 98 7.814666667   -.3911197    -.2422454
     4 2 0 38 21.06263959 0                  .        6.55   -.3379536    -.3029306
     4 3 0 38 21.06263959 0                  .        7.15   1.1556487    -.2357633
     5 1 0 31           . 0                  .           .  -.50372595            .
     6 1 0 40  17.5432526 0                 71         4.7  -.37295735  .0023030285
     6 2 0 40  17.5432526 0  67.66666666666667        5.95 -.018627167   -.29787156
     6 3 0 40  17.5432526 0  73.66666666666667           .  -.20520365    -.2924929
     7 1 1 41    35.15625 1  89.66666666666667         7.1   -.4858939    .04625331
     7 2 1 41    35.15625 1  86.66666666666667 6.697333333  -.26101145    -.3174112
     7 3 1 41    35.15625 1  95.33333333333333           .   4.1877637   -.08966266
     8 1 0 37 25.23634033 0  87.33333333333333         7.9   -.5304741   -.04076392
     8 2 0 37 25.23634033 0  78.33333333333333         6.1    -.434379     -.309964
     8 3 0 37 25.23634033 0  77.33333333333333        8.05  -.08566263   -.25711867
     9 1 1 39 33.25488986 0  77.33333333333333        7.05   -.3980543   -.00615445
     9 2 1 39 33.25488986 0  73.33333333333333         6.5  -.18737157   -.29306722
     9 3 1 39 33.25488986 0                 97         9.9    6.701427    .54593694
    10 1 0 37  24.6097337 0  80.33333333333333         5.9   -.4000357    .04421359
    10 2 0 37  24.6097337 0  81.33333333333333           6  -.21544057   -.25934732
    10 3 0 37  24.6097337 0  83.66666666666667         6.3 -.008390245     -.305451
    11 1 0 39 24.30461788 0  75.66666666666667         5.3  -.53344613    .07865868
    11 2 0 39 24.30461788 0  70.33333333333333           .  -.53707856    -.3097735
    11 3 0 39 24.30461788 0  75.66666666666667         6.4   -.1682186   -.27875698
    13 1 0 36  22.4996371 0  83.33333333333333         6.8   -.3815431    .00715128
    13 2 0 36  22.4996371 0  73.66666666666667        6.65  -.13816822    -.2855877
    13 3 0 36  22.4996371 0  68.33333333333333        8.85    4.111152     .9033498
    14 1 0 46     26.5625 0  81.66666666666667         6.8   -.4941495   -.13494419
    14 2 0 46     26.5625 0  79.33333333333333         7.7    -.373948            .
    14 3 0 46     26.5625 0                 76         7.1    .7025816    -.1696765
    15 1 0 34 32.10720958 0                 88           .   -.6093976   -.09368258
    15 2 0 34 32.10720958 0  79.33333333333333           .  -.52684164    -.3123173
    15 3 0 34 32.10720958 0                 90           .   .14912653    -.3024947
    17 1 0 40 27.00513097 1  84.33333333333333        6.65   -.4865543     .0984958
    17 2 0 40 27.00513097 1                 82         7.2   -.3815431    -.2449288
    17 3 0 40 27.00513097 1  99.33333333333333         6.1  -.13915884   -.28574044
    18 1 0 35 24.10694088 0  64.66666666666667        6.75   -.4115935   -.16467524
    18 2 0 35 24.10694088 0  70.66666666666667         6.6   -.3775805    -.3052855
    18 3 0 35 24.10694088 0  67.33333333333333        6.75    .1554008   -.22982918
    19 3 0 40 27.88518739 0  92.33333333333333         6.6  -.05924468   -.25337964
    20 1 0 41 20.28240971 0  71.33333333333333         5.2   -.4307465     .8040594
    20 2 0 41 20.28240971 0  65.33333333333333        5.25   -.4267838   -.27968565
    20 3 0 41 20.28240971 0  75.33333333333333         5.5    .4985033   -.19184238
    23 1 0 36  25.0995016 0  84.66666666666667           .   -.5978398    .41634265
    23 2 0 36  25.0995016 0  84.33333333333333         7.5  -.42876515    -.2650159
    24 1 0 37 18.59012493 0                 68         6.2   -.3574368   -.05839132
    24 2 0 37 18.59012493 0                 74           .  -.05197978    -.3012516
    24 3 0 37 18.59012493 0        76.88888888        5.25    2.592122   -.17694044
    27 1 0 39 30.50508507 1  87.66666666666666           .   -.4726849    -.1043352
    27 2 0 39 30.50508507 1  91.66666666666666         6.7   -.4172074    -.3009494
    27 3 0 39 30.50508507 1  88.83333333333333        6.75  -.09986226    -.3029617
    28 1 0 36 18.77834467 0  69.66666666666667         5.4   -.3524835    .06102021
    28 2 0 36 18.77834467 0  85.33333333333333 5.166666667  -.23129132    -.3130392
    28 3 0 36 18.77834467 0  78.16666666666667        6.25   .02661346    -.3232161
    29 1 0 37 23.63281255 1                 78        7.15   -.4419741   -.19482003
    29 2 0 37 23.63281255 1                 85        5.45   -.3779107     -.301454
    29 3 0 37 23.63281255 1  84.66666666666667       6.475    .1950276   -.15213487
    31 1 0 36 21.60410478 0  83.33333333333333       5.962   -.4664107    .05515991
    31 3 0 36 21.60410478 0  82.83333333333333         5.6    1.515923   -.20182908
    32 1 0 38 26.77706407 0  79.66666666666667        6.55  -.54995733   -.13579708
    32 2 0 38 26.77706407 0  82.66666666666667         6.2   -.3353118    -.3085924
    32 3 0 38 26.77706407 0                 78        6.35    .6946563   -.13677949
    33 1 0 38 32.88888889 1                 74        7.85   -.3194611   -.04061984
    33 2 0 38 32.88888889 1                 86         7.8     -.37692   -.30236775
    33 3 0 38 32.88888889 1  76.66666666666667           .   .11049034   -.23288435
    34 1 0 33 25.99591237 0  86.66666666666667         6.3   -.3455488    .19505447
    34 2 0 33 25.99591237 0                 86         7.3  .010762734   -.26586282
    34 3 0 33 25.99591237 0  90.66666666666667        8.25   1.7318892    .19765627
    35 1 0 42 38.32001657 1  87.33333333333333           .   -.6100581     .9908481
    35 3 0 42 38.32001657 1  78.33333334666666           . -.018296935    -.3013093
    36 1 0 36 21.92687484 0  84.33333333333333 5.966666667   -.6117092     .2410784
    36 2 0 36 21.92687484 0  76.33333333333333 5.833333333  -.50603753    -.3125821
    36 3 0 36 21.92687484 0                 75       6.387   -.3280469   -.30805385
    38 1 0 31 30.83653053 0  89.66666666666667         8.4  -.54929686    .06234656
    38 2 0 31 30.83653053 0 101.33333333333333        7.85   -.4944797    -.3068409
    38 3 0 31 30.83653053 0  95.16666666666667           .   1.1536673   -.06227478
    39 1 0 26 20.22790628 0                  .           5  -.50075394    .07180576
    39 2 0 26 20.22790628 0                  .        5.55  -.04240326    -.3112041
    40 2 0 43 20.33672338 0                 89        5.85    .3733485    -.3101761
    40 3 0 43 20.33672338 0  80.16666666666667         5.2   1.2183913   -.28347412
    41 1 0 37        22.9 0                 74           .    -.456504            .
    42 1 0 42 23.80869017 0  80.66666666666667       6.564   -.3438976 -.0020568385
    42 2 0 42 23.80869017 0  83.33333333333333         6.3   -.3613995   -.29500842
    42 3 0 42 23.80869017 0  73.66666666666667         6.8   .20757617    -.2118544
    43 1 0 33       26.75 0  95.66666666666667           .  -.57670546            .
    44 1 0 37 30.87360693 0                 72        6.35    -.484573    .52756953
    44 2 0 37 30.87360693 0               70.5         7.2   -.3138473   -.30360615
    45 1 0 39 24.79963244 0  83.33333333333333       6.504   -.4274443   -.14511436
    45 2 0 39 24.79963244 0                 85         7.8    -.468392   -.28935882
    45 3 0 39 24.79963244 0  93.33333333333333         7.2   .07053323    -.3061145
    46 1 0 40 21.96712018 0  78.66666666666667        5.65   -.2256775  -.020348873
    46 2 0 40 21.96712018 0                 72           .    -.162935    -.3131802
    46 3 0 40 21.96712018 0  72.88888888666666         7.3   1.6589098   -.29485402
    47 1 0 38 23.03004535 0 105.66666666666667       6.309    -.459476    .06723389
    47 2 0 38 23.03004535 0  97.33333333333333         5.3   -.3336607   -.28034976
    48 1 0 40 21.92687484 0                  .           7  -.56316626     .8659224
    48 2 0 40 21.92687484 0                  .         5.8  -.18472977    -.3192273
    end
    label values race_bin race_bin
    label def race_bin 0 "White or other", modify
    label def race_bin 1 "Black", modify

    As an aside, I did use multiple imputation to deal with some missing data although I don't think it's relevant to my specific question. I will however include the code here for the sake of completeness.

    Code:
    mi set wide  
    mi register imputed  clinicMAP cfpwv
    mi register regular age bmi_pre_preg race_bin std_* id Trimester PET
    mi impute mvn   clinicMAP  cfpwv = age  race_bin Trimester PET, add(25) rseed(12345)
    And as such I used xtlogit to estimate the association between my biomarker std_PAPPA2 and the outcome PET. Trimester denotes the trimeter in pregnancy so most patients had three different measurements. So trimester is the panel variable.

    Code:
    mi xtset Trimester
    mi estimate, or post: quietly xtlogit PET std_PAPPA2ngmL age bmi_pre_preg race_bin clinicMAP std_spRatio cfpwv
    Again, you can likely omit the mi estimate to answer the fundamental question I had which is:

    Can you estimate a risk ratio after xtlogit rather than the odds ratio? I'm not certain that is easy to calculate but I thought I would ask if such a thing is possible using a post-estimation command or something else.

    My thanks for any assistance than can be provided and apologies in advance for rather convoluted setup.

    Much obliged,

    Christopher

  • #2
    Can you estimate a risk ratio after xtlogit rather than the odds ratio?
    No.

    Added: To put a more positive spin on things, you can do that after a Poisson regression (which, by the way, will not give you an odds ratio.) In fact, any model that assumes that a constant odds ratio exists is inherently incompatible with the existence of a constant risk ratio, and vice versa (unless the OR = 1 and the RR = 1.)
    Last edited by Clyde Schechter; 27 Sep 2022, 14:00.

    Comment


    • #3
      Fair enough. I assumed not, but thought worthwhile to ask others. I become plagued by self doubt when reading reviewer comments. Many thanks for the answer.

      I am curious about:
      Originally posted by Clyde Schechter View Post
      In fact, any model that assumes that a constant odds ratio exists is inherently incompatible with the existence of a constant risk ratio, and vice versa (unless the OR = 1 and the RR = 1.)
      I'm not sure I completely understand the point here. I know you can estimate the risk ratio after a simple logistic regression but not in more complex models. I would be grateful for an explanation for my own personal edification if nothing else.

      Sincerely,

      Christopher

      Comment


      • #4
        No, you cannot estimate the risk ratio after a simple logistic regression. Let's say that the probability of y = 1 when x = 0 is p. If we have a risk ratio of r associated with an increase of 1 in x, then the subsequent probabilities of y are pr, pr2 pr3, etc. This is a simple geometric series: that is what is implied by a constant risk ratio.Evidently if r > 1, this sequence must eventually stop, unless p = 0, because we cannot have p > 1.

        Now, what happens if instead we let r be an odds ratio instead? Then p(x = 1) is pretty complicated: Odds(x=1) = rp/(1-p). Therefore p(x=1) = Odds(x=1)/(1+Odds(x=1)) = (after some algebra) rp/(1+(r-1)p). So this is clearly not a geometric series. There is no value of r other than 1 that can turn p(x=1) into a simple multiple (risk ratio) of p(x=0) for all possible values of p(x=0). Consequently if there is a constant odds ratio (other than 1), there cannot be a constant risk ratio. The proof of the converse is similar.

        Comment


        • #5
          I think I understand. So you're saying that the usual conversion formula of RR = OR / (1 – p + (p x OR)) is (I'm struggling for the right word here, variable? not-constant?).

          So the conversion from odds ratio to risk ratio will vary at different parts along the curve? So then, (and apologies for the tangent but I find this interesting) what do you make of the various user written commands in stata that convert odds ratio to risk ratios after logistic regression? Invalid? Or are they just estimating the risk ratio from a glm model rather than "converting" the odds ratio. I'm thinking of programs like -oddsrisk-

          Thanks and again sorry for the digression.

          Christopher

          Comment


          • #6
            I think I understand. So you're saying that the usual conversion formula of RR = OR / (1 – p + (p x OR)) is (I'm struggling for the right word here, variable? not-constant?).
            It very explicitly depends on p. So with the same value of OR, you will get different values of RR at different values of p.

            So the conversion from odds ratio to risk ratio will vary at different parts along the curve?
            Exactly so.

            So then, (and apologies for the tangent but I find this interesting) what do you make of the various user written commands in stata that convert odds ratio to risk ratios after logistic regression? Invalid? Or are they just estimating the risk ratio from a glm model rather than "converting" the odds ratio. I'm thinking of programs like -oddsrisk-
            I'm not familiar with any of those commands, so I can't really comment on them. I do think, however, that the very notion of converting between risk ratios and odds ratios is a questionable practice. At best, because the relationship explicitly depends on the baseline probability, any such conversion is only applicable to populations having exactly the prevalence in the specific data set being studied. As research typically hopes to create generalizable knowledge, this falls short. More important, I think that we need to take models seriously. If we believe that a logistic regression model is a decent approximation to the real data generating process, then an inescapable consequence of that is that there is no constant RR that applies. If we have some other model which entails a constant RR, then the non-existence of a constant OR is an inescapable consequence of that. More important still, once one has a handy formula, there is a risk of misapplying it outside its constraints. For example, in a case-control study, the RR is not estimable at all (and the application of a statistical model that attempted to do so would be a serious error). Yet I have seen people attempt to translate the OR from a logistic regression (or other analysis that produces an OR) into an RR.

            And, yes, I, too, have been asked by reviewers to translate ORs into RRs. It's annoying at best. Nowadays, being pretty senior in my career, I either ignore those requests or explicitly reject them and state my reasons in a response to the reviewer. When I was younger, I would do it, but generally only in the reviewer response and not in the manuscript itself, or, if really pressured to included it in the manuscript, put a clear disclaimer about its lack of generalizability with it.

            Comment


            • #7
              Very interesting Clyde. Thanks for the explanation. Indeed the reason I started this thread was because I was specifically asked to translate the odds ratios into risk ratios by a reviewer. I appreciate the time taken to reply. I don't post here often, but when I do, I generally learn something new which is always appreciated.

              Best,

              Christopher

              Comment

              Working...
              X