1

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.

jan pierre
  • 13
  • 4
  • 1
    Please provide a minimal working example. See http://stackoverflow.com/help/how-to-ask, http://stackoverflow.com/help/mcve, http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – coffeinjunky May 04 '17 at 13:55
  • 1
    It will be easier to help you if you include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data and the code you are running. Picture of data or output aren't particularly helpful. Also, please give the desired output so possible solutions can be tested. – MrFlick May 04 '17 at 13:56

1 Answers1

1

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
Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
  • Thank you very much Marco Sandri ! It works perfectly ! But I was wondering from where those formula come from ? – jan pierre May 04 '17 at 14:46
  • It is the formula that connects the beta coefficients of a logistic regression to the ORs: ORs= exp(betas). https://stats.stackexchange.com/questions/35013/exponentiated-logistic-regression-coefficient-different-than-odds-ratio – Marco Sandri May 04 '17 at 14:48