【问题标题】:Compare proportions of subgroup meta-analysis using Odds ratios使用优势比比较亚组荟萃分析的比例
【发布时间】:2020-05-05 14:20:55
【问题描述】:

我使用meta 包中的 metaprop 对比例进行了随机效应元分析。我想使用优势比和 95% 置信区间来比较 group Agroup B 的比例,如下例所示。有没有办法做到这一点?

我找到了这个链接http://www.metafor-project.org/doku.php/tips:comp_two_independent_estimates,但它没有回答我的问题。

【问题讨论】:

    标签: r


    【解决方案1】:

    无需编写新代码,只需使用已有的功能即可:

    library(metafor)
    
    df <- structure(list(study_nr = c(1, 4, 5, 6, 7, 8, 9, 10, 
                                      11, 14, 15, 18, 19, 20), 
                             group = c("A", "A", "A", "A", "A", "A", "A", 
                                       "A", "A", "B", "B", "B", "B", "B"), 
                             n_tot = c(1190, 37, 47, 26, 300, 402, 405, 
                                       195, 89, 47, 93, 49, 227, 61), 
                             n_event = c(189,2, 1, 0, 21, 11, 1, 
                                         8, 4, 2, 21, 4, 13, 5)), 
                        class = c("tbl_df", "tbl", "data.frame"), 
                        row.names = c(NA, -14L))
    df
    
    # compute log(odds) and corresponding sampling variances
    df <- escalc(measure="PLO", xi=n_event, ni=n_tot, data=df)
    df
    
    # fit meta-regression model with 'group' as moderator
    res <- rma(yi, vi, mods = ~ group, data=df, method="DL")
    res
    
    # obtain the OR and 95% CI
    predict(res, newmods=1, intercept=FALSE, transf=exp, digits=2)
    
    # test if the log(OR) is significantly different from 0
    anova(res, L=c(0,1), transf=exp, digits=2)
    

    【讨论】:

    • 这正是我想要的,非常感谢!我很难理解 newmods 参数如何与分类变量一起使用,但您似乎可以这样指定级别:0 表示参考类别,1 表示第一级,2 表示第二级,依此类推。
    • 不完全。对于两级因子(虚拟编码为 0/1),1 确实会为您提供第二个(非参考)组的系数。但是因素将 $p$ 水平将由模型中的 $p-1$ 虚拟变量表示,然后您需要为 newmods 指定一个向量以选择正确的系数(除 1 之外的所有 0 表示您想要的系数)。
    【解决方案2】:

    我想我已经找到了答案,我会在这里发布,以防将来有人有同样的问题。

    其实很简单,我们只需要对从 metaprop 或 metaregression 对象获得的 logit-transformed 估计取幂即可获得 Odds ratios:

        library(metafor)
        library(meta) 
        library(dplyr)
    
        df <- structure(list(study_nr = c(1, 4, 5, 6, 7, 8, 9, 10, 
                                          11, 14, 15, 18, 19, 20), 
                             group = c("A", "A", "A", "A", "A", "A", "A", 
                                       "A", "A", "B", "B", "B", "B", "B"), 
                             n_tot = c(1190, 37, 47, 26, 300, 402, 405, 
                                       195, 89, 47, 93, 49, 227, 61), 
                             n_event = c(189,2, 1, 0, 21, 11, 1, 
                                         8, 4, 2, 21, 4, 13, 5)), 
                        class = c("tbl_df", "tbl", "data.frame"), 
                        row.names = c(NA, -14L))
    

    需要设置 tau.common = TRUE 才能将结果与元回归进行比较

        m <- metaprop(event = n_event, n = n_tot, data = df, 
                      comb.fixed = FALSE, method = "Inverse",
                      byvar = group, tau.common = T)
    
    
        m
        # Output truncated...
    
        #> Test of heterogeneity:
        #>       Q d.f.  p-value
        #>  109.01   13 < 0.0001
        #> 
        #> Results for subgroups (random effects model):
        #>             k proportion           95%-CI  tau^2    tau     Q   I^2
        #> group = A   9     0.0408 [0.0199; 0.0818] 0.9127 0.9553 87.69 90.9%
        #> group = B   5     0.0879 [0.0367; 0.1959] 0.9127 0.9553 21.05 81.0%
        #> 
        #> Test for subgroup differences (random effects model):
        #>                     Q d.f.  p-value
        #> Between groups   1.82    1   0.1768
        #> Within groups  108.73   12 < 0.0001
        #> 
        #> Details on meta-analytical method:
        #> - Inverse variance method
        #> - DerSimonian-Laird estimator for tau^2 (assuming common tau^2 in subgroups)
        #> - Jackson method for confidence interval of tau^2 and tau
        #> - Logit transformation
        #> - Clopper-Pearson confidence interval for individual studies
        #> - Continuity correction of 0.5 in studies with zero cell frequencies
    

    我们可以手动计算 B 组与 A 组的优势比

        round((0.0879 / (1-0.0879)) / (0.0408 / (1-0.0408)), 2)
        #> [1] 2.27
    

    现在使用元回归估计

        metareg(m, group)
        #> 
        #> Mixed-Effects Model (k = 14; tau^2 estimator: DL)
        #> 
        #> tau^2 (estimated amount of residual heterogeneity):     0.9127 (SE = 0.6639)
        #> tau (square root of estimated tau^2 value):             0.9553
        #> I^2 (residual heterogeneity / unaccounted variability): 88.96%
        #> H^2 (unaccounted variability / sampling variability):   9.06
        #> R^2 (amount of heterogeneity accounted for):            0.00%
        #> 
        #> Test for Residual Heterogeneity:
        #> QE(df = 12) = 108.7341, p-val < .0001
        #> 
        #> Test of Moderators (coefficient 2):
        #> QM(df = 1) = 1.8245, p-val = 0.1768
        #> 
        #> Model Results:
        #> 
        #>          estimate      se     zval    pval    ci.lb    ci.ub 
        #> intrcpt   -3.1586  0.3779  -8.3578  <.0001  -3.8993  -2.4179  *** 
        #> groupB     0.8184  0.6059   1.3507  0.1768  -0.3692   2.0060      
        #> 
        #> ---
        #> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
    
    

    现在,只需对 B 组的估计取幂即可得到 B 与 A 的优势比

        round(exp(0.8184), 2)
        #> [1] 2.27
    
    <sup>Created on 2020-05-06 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup>
    

    【讨论】:

    • 我将发布这个从 metareg 对象中检索优势比及其 95% CI 的小函数,以防有人感兴趣:get_oddsratios &lt;- function(metareg.object) { bind_cols(term = rownames(metareg.object$b), OR = metareg.object$b[,1], ci.lb = metareg.object$ci.lb, ci.ub = metareg.object$ci.ub) %&gt;% mutate_if(is.numeric, exp) %&gt;% bind_cols(pval = metareg.object$pval) %&gt;% mutate(pval = round(pval, 4)) }
    最近更新 更多