rr-forestplot

How to extract values from metabin using R?


I’m trying to do a meta-analysis with R. After using the function metabin from the package meta, I obtain this

Here is a simplified version of my data :

data <- data.frame(matrix(rnorm(40,25), nrow=17, ncol=8))
centres<-c("LYON","SAINT  ETIENNE","REIMS","TOULOUSE","SVP","NANTES","STRASBOURG","GRENOBLE","ANGERS","TOULON","MARSEILLE","COLMAR","BORDEAUX","RENNES","VALENCE","CAEN","NANCY")
rownames(data) = centres
colnames(data) = c("case_exposed","witness_exposed","case_nonexposed","witness_nonexposed","exposed","nonexposed","case","witness")
metabin( data$case_exposed, data$case, data$witness_exposed, data$witness, studlab=centres,
       data=data, sm="OR")

I would like to only extract the values of OR and 95%-CI in the fixed effect model and the random effects model, so I could put them in another array. Is there anyway this is possible ?

I tried to use summary, but it doesn’t change anything. Thanks for your help.


Solution

  • Consider the following example:

    library(meta)
    data(Olkin95)
    meta1 <- metabin(event.e, n.e, event.c, n.c,
                     data = Olkin95, subset = c(41, 47, 51, 59),
                     method = "Inverse")
    summary(meta1)
    

    The estimated RR (with 95% CI) from the fixed and random models are

    Number of studies combined: k = 4
    
                             RR           95%-CI     z  p-value
    Fixed effect model   0.4407 [0.2416; 0.8039] -2.67   0.0075
    Random effects model 0.4434 [0.2038; 0.9648] -2.05   0.0403
    

    You can extract these values using:

    (est.fixed <- unlist(summary(meta1)$fixed))
    
              TE         seTE        lower        upper            z            p        level 
    -0.819414226  0.306710201 -1.420555173 -0.218273278 -2.671623649  0.007548526  0.950000000
    
    (RR.fixed <- exp(est.fixed[1]))
    
           TE 
    0.4406897 
    
    (CI.fixed <- exp(c(est.fixed[1]-1.96*est.fixed[2],est.fixed[1]-1.96*est.fixed[2])))
    
           TE        TE 
    0.2415772 0.2415772
    

    Similarly for the random effect model:

    (est.random <- unlist(summary(meta1)$random))
             TE        seTE       lower       upper           z           p       level          df 
    
    -0.81325423  0.39665712 -1.59068790 -0.03582057 -2.05027011  0.04033808  0.95000000          NA 
    
    (RR.random <- exp(est.random[1]))
    
           TE 
    0.4434127 
    
    (CI.random <- exp(c(est.random[1]-1.96*est.random[2],est.random[1]+1.96*est.random[2])))
    
           TE        TE 
    0.2037825 0.9648272