
R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R是自由软件，不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。

R是个合作计划，有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。

用'demo()'来看一些示范程序，用'help()'来阅读在线帮助文件，或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.

[原来保存的工作空间已还原]

> library(xlsx)
> library(meta)
载入需要的程辑包：metadat
Loading 'meta' package (version 7.0-0).
Type 'help(meta)' for a brief overview.
Readers of 'Meta-Analysis with R (Use R!)' should install
older version of 'meta' package: https://tinyurl.com/dt4y5drs
Warning messages:
1: 程辑包‘meta’是用R版本4.2.3 来建造的 
2: 程辑包‘metadat’是用R版本4.2.3 来建造的 
> se <-(metagen $ uci - metagen $ lci)/ (2*1.96)
Error in metagen$uci : 类别为'closure'的对象不可以取子集
> metagen <- read.xlsx("metaregression.xlsx",1)
> se <-(metagen $ uci - metagen $ lci)/ (2*1.96)
> lnhr<- log(metagen$ hr)
> metagen <- cbind(metagen,lnhr,se)
> res <- rma(yi=lnhr,sei=se,method="REML",mods=age,data=metagen)
Error in rma(yi = lnhr, sei = se, method = "REML", mods = age, data = metagen) : 
  没有"rma"这个函数
> library(metafor)
载入需要的程辑包：Matrix
载入需要的程辑包：numDeriv

Loading the 'metafor' package (version 4.2-0). For an
introduction to the package please type: help(metafor)

An updated version of the package (version 4.4-0) is available!
To update to this version type: install.packages("metafor")

Warning message:
程辑包‘metafor’是用R版本4.2.3 来建造的 
>  res <- rma(yi=lnhr,sei=se,method="REML",mods=age,data=metagen)
> res

Mixed-Effects Model (k = 16; tau^2 estimator: REML)

tau^2 (estimated amount of residual heterogeneity):     0.0513 (SE = 0.0560)
tau (square root of estimated tau^2 value):             0.2264
I^2 (residual heterogeneity / unaccounted variability): 42.48%
H^2 (unaccounted variability / sampling variability):   1.74
R^2 (amount of heterogeneity accounted for):            1.12%

Test for Residual Heterogeneity:
QE(df = 14) = 21.8782, p-val = 0.0812

Test of Moderators (coefficient 2):
QM(df = 1) = 1.1936, p-val = 0.2746

Model Results:

         estimate      se     zval    pval    ci.lb   ci.ub    
intrcpt   -0.2316  0.7052  -0.3284  0.7426  -1.6136  1.1505    
mods       0.0136  0.0124   1.0925  0.2746  -0.0108  0.0379    

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

> 
