How to cite this work?

Orsini, N. Weighted mixed-effects dose-response models for tables of correlated contrasts. Stata Journal. 2021. Forthcoming.

The preprint pdf is available here

Orsini, N., and Spiegelman D. Meta-Analysis of Dose-Response Relationships. Chapter 18. Handbook of Meta-Analysis. Chapman and Hall/CRC, 2020. 395-428.

Crippa, A., Discacciati, A., Bottai, M., Spiegelman, D., Orsini, N (2019). One-stage dose–response meta-analysis for aggregated data. Statistical methods in medical research, 28(5), 1579-1596.

dosresmeta R package

How to download and install it?

Just type (once) at Stata command line ssc install drmeta

Data generating mechanism

Tables of correlated empirical contrasts arising from heterogenous and possibly non-linear relationships investigated in experimental and observational studies

  1. Mean Differences
  2. Odds Ratios
  3. Hazard Ratios

1. Mean Differences

In [1]:
use http://www.stats4life.se/data/md_drm, clear
In [2]:
list id md dose semd n sd, sepby(id)

     +--------------------------------------------------------+
     | id          md       dose       semd      n         sd |
     |--------------------------------------------------------|
  1. |  1           0   2.086257          0    667   10.20166 |
  2. |  1   -1.833671   4.419908   .5432243    667   9.630822 |
  3. |  1   -.7127696    8.50176    .570577    666   10.62563 |
     |--------------------------------------------------------|
  4. |  2           0   2.089625          0    334   10.02433 |
  5. |  2    -2.24363   4.350319   .7904232    333   10.38564 |
  6. |  2    4.001513   8.571865   .8378702    333   11.55804 |
     |--------------------------------------------------------|
  7. |  3           0   1.783374          0    250   9.932148 |
  8. |  3   -4.205753   3.471823    .903377    250   10.26523 |
  9. |  3   -5.813741   5.284095   .8869014    250   9.899544 |
 10. |  3   -10.75781   9.226316   .8897415    250   9.963054 |
     |--------------------------------------------------------|
 11. |  4           0   2.659683          0   1000   9.965787 |
 12. |  4   -1.896251   7.326583    .452011   1000    10.2468 |
     |--------------------------------------------------------|
 13. |  5           0   1.788106          0    125   10.19591 |
 14. |  5   -.3524966   3.554765   1.258989    125   9.704389 |
 15. |  5   -5.160278   5.281302   1.241889    125   9.424936 |
 16. |  5   -2.534792   9.098642   1.254965    125    9.63901 |
     |--------------------------------------------------------|
 17. |  6           0    2.59058          0   1000   10.24419 |
 18. |  6   -.9324588   7.323151   .4550278   1000    10.1048 |
     |--------------------------------------------------------|
 19. |  7           0   1.980234          0    167   9.982729 |
 20. |  7    2.224448   4.243467   1.107253    167   10.25116 |
 21. |  7    19.95125   8.395834   2.312336    166   28.08104 |
     |--------------------------------------------------------|
 22. |  8           0   2.729582          0    250   10.84464 |
 23. |  8    -2.63299   7.399555   .9415223    250   10.19852 |
     |--------------------------------------------------------|
 24. |  9           0   1.715954          0    500   10.19733 |
 25. |  9   -1.278558    3.40995   .6354408    500   9.894792 |
 26. |  9   -1.119229    5.39144     .63723    500   9.952158 |
 27. |  9    10.36862   9.488178   .7932376    500   14.51301 |
     |--------------------------------------------------------|
 28. | 10           0   2.627868          0   1000   10.13876 |
 29. | 10    6.005856   7.302384   .5452951   1000    13.9482 |
     +--------------------------------------------------------+

A plot of the empirical estimates

Mixed-effects model with a linear function

$ \begin{equation} \hat \gamma_{ij} = (\beta_1 + b_{1i}) x_{ij} + \epsilon_{ij} \end{equation} $

In [3]:
drmeta md dose, se(semd) data(n sd) id(id) type(type_md) ml

One-stage random-effects dose-response model     Number of studies =        10
Optimization   = ml                                  Number of obs =        19
           AIC = 240.04                              Model chi2(1) =      0.73
Log likelihood = -118.02019                            Prob > chi2 =    0.3943
------------------------------------------------------------------------------
          md |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        dose |   .3138377   .3683861     0.85   0.394    -.4081857    1.035861
------------------------------------------------------------------------------
---------------------------------------------
  Random-effects parameters  |   Estimate
-----------------------------+---------------
var(dose,dose)               |    1.334027
---------------------------------------------
LR test vs. no random-effects model = 571.30704       Prob >= chi2(1) = 0.0000

Mixed-effects model with restricted cubic splines

$ \begin{equation} \hat \gamma_{ij} = (\beta_1 + b_{1i})s_1(x_{ij}) + (\beta_2 + b_{2i})s_2(x_{ij}) + \epsilon_{ij} \label{eq:m_s} \end{equation} $

with three knots $\left(k_1, k_2, k_3\right)$, typically located at fixed percentiles of the dose distribution, the two splines are

$ \begin{align*} s_1(x_{ij}) &= x_{ij} \nonumber \\ s_2(x_{ij}) &= \frac{ \left(x_{ij} - k_1 \right)_{+}^3 - \frac{k_3 - k_1}{k_3 - k_2} \left(x_{ij} - k_2 \right)_{+}^3 + \frac{k_2 - k_1}{k_3 - k_2} \left(x_{ij} - k_3 \right)_{+}^3}{ (k_3 - k_1)^2} \end{align*} $

In [4]:
mkspline doses = dose, nk(3) cubic displayknots
mat knots = r(knots)
drmeta md doses1 doses2 , se(semd) data(n sd) id(id) type(type_md) ml

             |     knot1      knot2      knot3 
-------------+---------------------------------
        dose |  2.086257   4.350319    8.50176 



One-stage random-effects dose-response model     Number of studies =        10
Optimization   = ml                                  Number of obs =        19
           AIC = 107.34                              Model chi2(2) =     86.21
Log likelihood = -48.669605                            Prob > chi2 =    0.0000
------------------------------------------------------------------------------
          md |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      doses1 |   -1.26233   .1895313    -6.66   0.000    -1.633805   -.8908556
      doses2 |    2.76801   .5284361     5.24   0.000     1.732295    3.803726
------------------------------------------------------------------------------
---------------------------------------------
  Random-effects parameters  |   Estimate
-----------------------------+---------------
var(doses1,doses1)           |    .1336763
var(doses2,doses2)           |    2.137952
cov(doses1,doses2)           |    .5345965
---------------------------------------------
LR test vs. no random-effects model = 615.5756        Prob >= chi2(3) = 0.0000
In [5]:
drmeta_graph , matk(knots)  dose(2(.5)10) ref(5)  name(figure2, replace) ///
 ytitle("Mean Difference") list yline(0, lp(dot) lc(black)) xlabel(2(1)10) ylabel(#7) ///
 addplot(-2*(d-5)+.2*(d^2-25))  plotopts(lc(blue))
     _x   _t1        _t2     _xb     _lb     _ub  
      2     2          0    2.15    0.79    3.51  
    2.5   2.5   .0017208    1.53    0.33    2.72  
      3     3   .0185358    0.94   -0.09    1.97  
    3.5   3.5   .0686515    0.45   -0.39    1.29  
      4     4   .1702902    0.10   -0.52    0.72  
    4.5   4.5    .341548   -0.06   -0.40    0.28  
      5     5   .5907288    0.00    0.00    0.00  
    5.5   5.5   .9095089    0.25   -0.15    0.66  
      6     6   1.287951    0.67   -0.20    1.53  
    6.5   6.5   1.716116    1.22   -0.15    2.60  
      7     7   2.184068    1.89   -0.04    3.81  
    7.5   7.5   2.681868    2.63    0.13    5.13  
      8     8   3.199579    3.43    0.34    6.53  
    8.5   8.5   3.727262    4.26    0.56    7.96  
      9     9   4.256619    5.10    0.79    9.40  
    9.5   9.5   4.785977    5.93    1.02   10.85  
     10    10   5.315334    6.77    1.24   12.29  

A plot of the estimated summary dose-response relationship

2. Odds Ratios

In [6]:
use http://www.stats4life.se/data/or_drm, clear
In [7]:
list, sepby(id)
     +-----------------------------------------------------------+
     | id        bmi           b        seb   case      n   type |
     |-----------------------------------------------------------|
  1. |  1   22.00238   -.3890369    .094743    362   1000      1 |
  2. |  1   26.92995           0          0    480   1000      1 |
     |-----------------------------------------------------------|
  3. |  2   22.09101   -.4829789   .1943198     74    250      1 |
  4. |  2   26.88089           0          0    107    250      1 |
     |-----------------------------------------------------------|
  5. |  3   22.35459   -.9275737   .1373499    148    500      1 |
  6. |  3    27.0792           0          0    270    500      1 |
     |-----------------------------------------------------------|
  7. |  4   22.11353   -.7965673   .0961867    310   1000      1 |
  8. |  4   26.89151           0          0    527   1000      1 |
     |-----------------------------------------------------------|
  9. |  5   21.16003   -.8437273   .1169753    228    667      1 |
 10. |  5   24.36551   -1.021478   .1177787    215    667      1 |
 11. |  5   27.68648           0          0    380    666      1 |
     |-----------------------------------------------------------|
 12. |  6    21.1872    .4269972   .2421495     57    167      1 |
 13. |  6   24.51042           0          0     44    167      1 |
 14. |  6   27.81176    1.034574   .2358377     82    166      1 |
     |-----------------------------------------------------------|
 15. |  7   22.05972    -.539418    .193787     85    250      1 |
 16. |  7    26.8837           0          0    127    250      1 |
     |-----------------------------------------------------------|
 17. |  8   22.03318   -.6075508    .133712    172    500      1 |
 18. |  8   26.84427           0          0    254    500      1 |
     |-----------------------------------------------------------|
 19. |  9     21.235           0          0    114    334      1 |
 20. |  9   24.64635   -.0910647   .1685295    117    333      1 |
 21. |  9   27.66506    .8185734   .1650729    190    333      1 |
     |-----------------------------------------------------------|
 22. | 10   22.25245   -.7423262   .1347532    158    500      1 |
 23. | 10   27.14518           0          0    254    500      1 |
     +-----------------------------------------------------------+

In [8]:
mkspline bmis = bmi, nk(3) cubic displayknots
mat knots = r(knots)
drmeta b bmis1 bmis2 , se(seb) data(n case) type(type)  id(id) ml

             |     knot1      knot2      knot3 
-------------+---------------------------------
         bmi |  22.03318   24.51042    27.0792 



One-stage random-effects dose-response model     Number of studies =        10
Optimization   = ml                                  Number of obs =        13
           AIC = -3.75                               Model chi2(2) =    236.95
Log likelihood = 6.877037                              Prob > chi2 =    0.0000
------------------------------------------------------------------------------
           b |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       bmis1 |  -.1190594   .0342939    -3.47   0.001    -.1862741   -.0518446
       bmis2 |    .341312   .0442469     7.71   0.000     .2545897    .4280343
------------------------------------------------------------------------------
---------------------------------------------
  Random-effects parameters  |   Estimate
-----------------------------+---------------
var(bmis1,bmis1)             |    .0005846
var(bmis2,bmis2)             |    .0000788
cov(bmis1,bmis2)             |   -.0002146
---------------------------------------------
LR test vs. no random-effects model = 1.4161565       Prob >= chi2(3) = 0.7018
In [9]:
drmeta_graph ,  matk(knots)  dose(21(.2)28) list ref(24) ///
    addplot(-2.3*(d-24)+0.05*(d^2-24^2)) ///
    plotopts(lc(blue)) eform  ///
    ytitle("Adjusted Odds Ratio") ///
    xtitle("Body Mass Index (kg/m{sup:2})") ///
    name(fig4, replace) ylabel(1 1.2 1.5 2 3 4, angle(horiz))
      _x    _t1        _t2    _xb    _lb    _ub  
      21     21          0   1.29   1.08   1.54  
    21.2   21.2          0   1.26   1.07   1.48  
    21.4   21.4          0   1.23   1.06   1.43  
    21.6   21.6          0   1.20   1.05   1.38  
    21.8   21.8          0   1.17   1.04   1.33  
      22     22          0   1.15   1.03   1.28  
    22.2   22.2   .0001823   1.12   1.02   1.23  
    22.4   22.4   .0019384   1.09   1.01   1.19  
    22.6   22.6   .0071521   1.07   1.00   1.15  
    22.8   22.8   .0177084   1.05   0.99   1.11  
      23     23   .0354925   1.03   0.98   1.08  
    23.2   23.2   .0623895   1.01   0.98   1.05  
    23.4   23.4   .1002846   1.00   0.98   1.03  
    23.6   23.6   .1510629   1.00   0.98   1.01  
    23.8   23.8   .2166096   1.00   0.99   1.00  
      24     24   .2988097   1.00   1.00   1.00  
    24.2   24.2   .3995485   1.01   1.00   1.02  
    24.4   24.4   .5207111   1.03   1.02   1.04  
    24.6   24.6    .664127   1.05   1.04   1.07  
    24.8   24.8   .8299745   1.09   1.07   1.11  
      25     25    1.01654   1.13   1.11   1.16  
    25.2   25.2   1.222004   1.19   1.16   1.22  
    25.4   25.4    1.44455   1.25   1.22   1.29  
    25.6   25.6   1.682359   1.33   1.28   1.37  
    25.8   25.8   1.933614   1.41   1.35   1.47  
      26     26   2.196497   1.51   1.43   1.59  
    26.2   26.2   2.469189   1.61   1.51   1.72  
    26.4   26.4   2.749874   1.73   1.61   1.87  
    26.6   26.6   3.036731   1.87   1.71   2.04  
    26.8   26.8   3.327945   2.01   1.82   2.23  
      27     27   3.621696   2.17   1.94   2.43  
    27.2   27.2   3.916234   2.35   2.07   2.66  
    27.4   27.4   4.210792   2.54   2.21   2.91  
    27.6   27.6   4.505349   2.74   2.35   3.18  
    27.8   27.8   4.799907   2.96   2.51   3.48  
      28     28   5.094463   3.19   2.67   3.81  

3. Hazard Ratios

In [10]:
use http://www.stats4life.se/data/hr_drm, clear
In [11]:
list, sepby(id)
     +---------------------------------------------------------------+
     | id       walk           b        seb   case          n   type |
     |---------------------------------------------------------------|
  1. |  1   .2793251    1.126792   .1099376    229   777.3834      2 |
  2. |  1   2.395885           0          0    137   1704.023      2 |
     |---------------------------------------------------------------|
  3. |  2   .0882498   -.3158149   .0945557    245   643.3843      2 |
  4. |  2   .4880067   -.4475349   .0940529    230   781.8015      2 |
  5. |  2   1.342982   -.4929771   .0933166    225   919.5527      2 |
  6. |  2   3.770511           0          0    236   624.6072      2 |
     |---------------------------------------------------------------|
  7. |  3   .1528921           0          0    317   930.5045      2 |
  8. |  3   .9615004    -.466862   .0849445    265   1599.395      2 |
  9. |  3   3.790052   -1.683847   .1093979    121   2677.427      2 |
     |---------------------------------------------------------------|
 10. |  4   .3283299    .1397779   .0482351    938   2870.116      2 |
 11. |  4   2.683378           0          0    880   3799.281      2 |
     |---------------------------------------------------------------|
 12. |  5    .161672    .1995442    .082466    319   854.0303      2 |
 13. |  5   1.018704           0          0    297   1233.004      2 |
 14. |  5   3.623844    .4628477   .0810954    315   882.9999      2 |
     |---------------------------------------------------------------|
 15. |  6   .3058116           0          0    910   3236.071      2 |
 16. |  6   2.623137   -.7453712   .0521537    656   6035.189      2 |
     |---------------------------------------------------------------|
 17. |  7   .2896355           0          0    459    1528.16      2 |
 18. |  7   2.600973   -.0614597   .0696512    429   1965.065      2 |
     |---------------------------------------------------------------|
 19. |  8   .1643253           0          0    633   1895.231      2 |
 20. |  8   .9466987   -.6235549   .0609065    496   3383.479      2 |
 21. |  8   3.628917   -1.893922   .0803656    214   5525.964      2 |
     |---------------------------------------------------------------|
 22. |  9   .2770668   -.3582188   .1000653    241   664.4189      2 |
 23. |  9   2.416099           0          0    238    629.959      2 |
     |---------------------------------------------------------------|
 24. | 10   .0915176           0          0    122   262.4762      2 |
 25. | 10   .5305347   -.0982256    .132568    118    384.079      2 |
 26. | 10   1.393327   -.6411862   .1384295    103   605.1273      2 |
 27. | 10   3.700739    -.284176   .1392116    108   476.0671      2 |
     |---------------------------------------------------------------|
 28. | 11   .2826045           0          0    470   1419.543      2 |
 29. | 11   2.666771   -.8159121   .0740083    335   3000.297      2 |
     |---------------------------------------------------------------|
 30. | 12   .1044894    .4428782    .137967    117   342.9781      2 |
 31. | 12   .5042356    .4215609   .1358672    119   416.5633      2 |
 32. | 12   1.306113           0          0    100   573.4026      2 |
 33. | 12   4.133028    .5414947   .1364696    116   393.4916      2 |
     |---------------------------------------------------------------|
 34. | 13   .3325906           0          0    944   3051.644      2 |
 35. | 13   2.747587   -.3644896    .049243    811   4645.575      2 |
     |---------------------------------------------------------------|
 36. | 14   .0761284           0          0    119   311.4999      2 |
 37. | 14   .4929709    .0550717   .1327669    116   379.6888      2 |
 38. | 14   1.319347   -.0694216   .1364633    112   461.9148      2 |
 39. | 14   3.353945   -.0353648   .1451746    107   509.0948      2 |
     |---------------------------------------------------------------|
 40. | 15    .098099    .1451558   .0660526    484   1215.047      2 |
 41. | 15   .5199782           0          0    461   1703.439      2 |
 42. | 15   1.401148   -.2061256   .0681398    411   2092.471      2 |
 43. | 15   3.964579   -.4415459   .0704884    375   2626.173      2 |
     |---------------------------------------------------------------|
 44. | 16   .1557107    .7911428   .0639705    638   1732.345      2 |
 45. | 16   .9153742    .3412233   .0638025    545   2929.215      2 |
 46. | 16   3.362979           0          0    455   3810.334      2 |
     |---------------------------------------------------------------|
 47. | 17   .1461527           0          0    315   969.7536      2 |
 48. | 17   .9265271   -.6323112    .085915    247   1689.296      2 |
 49. | 17   3.391632   -1.275282   .0967459    171   2380.976      2 |
     |---------------------------------------------------------------|
 50. | 18   .3254461           0          0    940   2752.091      2 |
 51. | 18   2.688968    .4142469   .0479734    957   2388.768      2 |
     |---------------------------------------------------------------|
 52. | 19   .2956077    1.238176   .0785387    457   1631.048      2 |
 53. | 19   2.596582           0          0    255   3508.605      2 |
     |---------------------------------------------------------------|
 54. | 20   .0878508    .2148942   .0952621    239   673.9454      2 |
 55. | 20   .5163683           0          0    216   945.9922      2 |
 56. | 20   1.494186   -1.035894   .1104081    133   1773.297      2 |
 57. | 20   4.092521   -2.629489   .1900485     32   2318.375      2 |
     |---------------------------------------------------------------|
 58. | 21   .0839196           0          0    480   1209.023      2 |
 59. | 21   .5001501   -.3648245   .0671704    433   1958.418      2 |
 60. | 21   1.340028   -1.014745   .0735737    323   3020.412      2 |
 61. | 21   3.945487   -2.344692   .1030391    121    4358.41      2 |
     |---------------------------------------------------------------|
 62. | 22   .0911063     .194189   .0663708    477   1317.607      2 |
 63. | 22   .5386549           0          0    447   1796.323      2 |
 64. | 22   1.377821   -.5047383   .0703692    370   2629.764      2 |
 65. | 22   3.860601   -1.064545   .0781567    262   3493.606      2 |
     |---------------------------------------------------------------|
 66. | 23   .1682133    .6471067   .0862075    311   973.0405      2 |
 67. | 23   .9215855           0          0    247    1765.15      2 |
 68. | 23   3.432787   -1.284732   .1181887    101   2752.034      2 |
     |---------------------------------------------------------------|
 69. | 24   .0914306           0          0    245   525.5971      2 |
 70. | 24   .5131332   -.2545962   .0933586    229    797.797      2 |
 71. | 24   1.432576   -.5888675   .0995204    203    1156.81      2 |
 72. | 24   4.051638    .2843482   .0972842    234   576.9636      2 |
     |---------------------------------------------------------------|
--more--

Mixed-effects model with piecewise linear splines

$ \begin{equation} \hat \gamma_{ij} = (\beta_1 + b_{1i})(x_{ij}) + (\beta_2 + b_{2i})(x_{ij}>2)(x_{ij}-2) + \epsilon_{ij} \end{equation} $

In [12]:
// generate the degree-1 spline with a knot at 2 
gen walkplus = (walk>2)*(walk-2)
In [13]:
drmeta b walk walkplus, se(seb) data(n case) type(type)  id(id) ml

One-stage random-effects dose-response model     Number of studies =        30
Optimization   = ml                                  Number of obs =        61
           AIC = 37.55                               Model chi2(2) =    110.27
Log likelihood = -13.773298                            Prob > chi2 =    0.0000
------------------------------------------------------------------------------
           b |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        walk |  -.4678671   .0536744    -8.72   0.000     -.573067   -.3626673
    walkplus |   .5432787   .0626325     8.67   0.000     .4205213     .666036
------------------------------------------------------------------------------
---------------------------------------------
  Random-effects parameters  |   Estimate
-----------------------------+---------------
var(walk,walk)               |    .0766958
var(walkplus,walkplus)       |    .0507463
cov(walk,walkplus)           |   -.0136841
---------------------------------------------
LR test vs. no random-effects model = 2713.6          Prob >= chi2(3) = 0.0000

Linear trend per 30 min/wk between 0 and 2 h/wk

In [14]:
lincom walk*1/2, eform
 ( 1)  .5*walk = 0

------------------------------------------------------------------------------
           b |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .7914144   .0212393    -8.72   0.000     .7508619     .834157
------------------------------------------------------------------------------

Linear trend per 30 min/wk between 2 and 4 h/wk

In [15]:
lincom (walk+walkplus)*1/2, eform
 ( 1)  .5*walk + .5*walkplus = 0

------------------------------------------------------------------------------
           b |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   1.038426   .0340727     1.15   0.250     .9737464    1.107401
------------------------------------------------------------------------------