如何使用 R 从 metabin 中提取值?
How to extract values from metabin using R?
我正在尝试使用 R 进行荟萃分析。使用包 meta 中的函数 metabin 后,我获得
this
这是我的数据的简化版本:
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")
我只想提取固定效应模型和随机效应模型中的OR和95%-CI的值,这样我就可以把它们放在另一个数组中。无论如何这可能吗?
我尝试使用摘要,但它没有任何改变。
感谢您的帮助。
考虑以下示例:
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)
固定模型和随机模型的估计 RR(95% CI)为
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
您可以使用以下方法提取这些值:
(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
同样适用于随机效应模型:
(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
我正在尝试使用 R 进行荟萃分析。使用包 meta 中的函数 metabin 后,我获得 this
这是我的数据的简化版本:
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")
我只想提取固定效应模型和随机效应模型中的OR和95%-CI的值,这样我就可以把它们放在另一个数组中。无论如何这可能吗?
我尝试使用摘要,但它没有任何改变。 感谢您的帮助。
考虑以下示例:
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)
固定模型和随机模型的估计 RR(95% CI)为
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
您可以使用以下方法提取这些值:
(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
同样适用于随机效应模型:
(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