stata软件meta分析操作详细攻略
- 格式:ppt
- 大小:1.61 MB
- 文档页数:38
⼿把⼿教你⽤Stata进⾏Meta分析Meta简明教程(7)Meta简明教程⽬录1. 认识⼀下meta⽅法! | Meta简明教程(1)2. ⼀⽂初步学会Meta⽂献检索 | Meta简明教程(2)3. 如何搞定“⽂献筛选” | Meta简明教程(3)4.Meta分析⽂献质量评价 | Meta简明教程(4)5.Meta分析数据提取| Meta简明教程(5)6.⼀⽂学会revman软件| Meta简明教程(6)Meta简明教程(7)上⼀期介绍了Revman 软件对⼆分类数据、连续型数据、诊断性试验数据、⽣存-时间数据进⾏meta分析,本期将利⽤Stata对以上数据进⾏meta分析。
⼤家可以到本公众号下载Stata软件(重磅推荐:分类最全的统计分析相关软件,了解⼀下?请关注、收藏以备⽤)Stata12.0 界⾯⼀、⼆分类数据分析数据形式例:研究阿司匹林(aspirin)预防⼼肌梗死(MI)7个临床随机对照试验,观察死亡率,数据提取如下:操作步骤1.构建数据1)启动Stata 12.0 软件后,可以直接点击⼯具栏中DataEditor (edit)按钮。
也可在在菜单栏中点击Data→Data Editor→ DataEditor (edit),出现以下界⾯。
2)点击变量名位置,依次输⼊研究名称(research),阿司匹林组死亡数(a),阿司匹林组存活数(b),安慰剂组死亡数(c),安慰剂组存活数(d)3)录⼊数据:在变量值区域输⼊数据2. 数据分析1)导⼊meta模块:在Command窗⼝中进⾏编程,⾸先需要在Stata中安装meta模块:在Command窗⼝输⼊“sscinstall metan”,选中点回车。
结果窗⼝中出现下⾯的结果,说明已经安装了meta模块。
2)输⼊meta分析代码:在Command窗⼝输⼊ “Command窗⼝输⼊ “metan a b c d, or fixed”,点回车,完成结果分析。
STATA已经有独立的模块(metandi)来做诊断性试验的meta分析,所用方法是拟合了一个两水平的混合logistic回归模型。
虽然该模块还没有与metan模块类似的对话框,但是应该来说已经是一个比较大的进步。
最终的呈现结果不仅能给出基于多水平模型估计得到的南京58信息网ROC曲线下面积(hierarchical summary receiver operating characteristic,hsroc),同时能得到“拐点”信息(summary point),以下摘选该模块的帮助内容来简要介绍该模块。
Titlemetandi -- Meta-analysis of diagnostic accuracySyntaxmetandi tp fp fn tn [if] [in] [, plot gllamm force ip(g|m) nip(#) nobivariate nohsroc nosummarypt detail level(#) trace nolog]by is allowed with metandi; see [D] by.See metandi postestimation for features available after estimation, in particular, the predict command. metandiplot graphs the results from metandi.Descriptionmetandi performs meta-analysis of diagnostic test accuracy studies in which both the index test under study and the reference test (gold standard) are dichotomous. It takes as input four variables: tp, fp, fn, and tn, giving the number of true positives, false positives, false negatives, and true negatives within each study. It fits a two-level mixed logistic regression model, with independent binomial distributions for the true positives and true negatives conditional on the sensitivity and specificity in each study, and a bivariate normal model for the logit transforms of sensitivity and specificity between studies.In Stata 10, metandi fits the model by using the official Stata command xtmelogit by default. In Stata 8 or 9, metandi uses the user-written command gllamm, which must be installed.To ensure you have the most recent version of gllamm, type ssc install gllamm, replace.metandi does not allow covariates to be fit; i.e., meta-regression of diagnostic accuracy is not supported.。
基因多态性(SNP)meta分析stata流程及结果解释遗传关联研究旨在评估遗传变异与表型之间的关联。
在过去的几年或几十年中,这类研究的数量呈指数增长,但是由于实验设计,样本量较小和其他一些错误的原因,得到的结果往往是不可重复的,导致很多结果有矛盾。
meta分析由于可以将这些文献结果整合起来,提高统计效率,能够很好的解决这种差异,并能够识别基因型和表型之间的真实关联,正受到越来越多的关注。
基因多态性(SNP)多态性的研究也越来越多。
由于数据易于获得,分析结果看起来比较高大尚,发表文章相对比较容易,受到广大在校学生和医生们的青睐。
由于SNP的meta分析和传统meta分析比不太一样,现就讲SNP的meta 分析流程和结果稍做解释。
1、数据格式目前,SNP的meta分析建议用stata完成,从Hardy-Weinberg 检验到敏感性分析,都有一个完整的过程。
一般来说,把数据整理成以下格式即可,其中,cases表示实验组,controls表示对照组。
2、Hardy-Weinberg检验由于基因分型错误,或者选择偏倚和不恰当的分层,可能会发生HWE偏倚。
因此,在汇总数据之前,应在每项研究中检查HWE的拟合优度。
使用stata识别低质量的研究,可以计算出HW-P值和调整后的HW-P值。
从下表看,P均大于0.05,说明没有HWE偏倚。
3、遗传模型给定两个等位基因(A,a),可能出现三种基因型(AA,Aa,aa)可以以不同方式产生不同的遗传模型。
基于生物学遗传模型进行不同模型的评估。
包括等位基因对比(A与a),隐性(AA与Aa + aa),显性(AA + Aa与aa)和超显性(Aa与AA + aa))遗传模型以及成对比较(AA与aa,AA与Aa和Aa与aa的比较)。
多次检验,使用Bonferroni方法调整P值。
4、异质性评估异质性的评估可以采用多种指标进行,一般来说有tau^2,Q值,I^2以及P值的计算,假如存在异质性,则可以使用亚组分析来解决。
Stata软件在诊断性研究的meta分析中的命令在诊断性研究的meta分析中可以计算合并阳性似然比、合并阴性似然比、诊断OR值、ROC值、SROC曲线、HSROC-bivariate meta-analysis等。
Stata进行诊断研究meta分析时的起始命令:*Variable codes: tp=true positives; fp=false positives; tn=true negatives;fn=false negatives*add .5 to all zero cellsgen zero=0replace zero=1 if tp==0|fp==0|fn==0|tn==0replace tp=tp+.5 if zero==1replace fp=fp+.5 if zero==1replace fn=fn+.5 if zero==1replace tn=tn+.5 if zero==1gen tpr= tp/(tp+fn)gen fpr=fp/(fp+tn)gen logittpr=ln(tp/fn)gen logitfpr=ln(fp/tn)gr7 tpr fpr, s(O) noaxis ysize(6) xsize(6) xline(0(.1)1) yline(0(.1)1) tlab(0(.1)1) xlab(0(.1)1) ylab(0(.1)1) t1(1-Specificity) l1(Sensitivity) b2(1-Specificity) b1(ROC Plot of Sensitivity vs Specificity)gr7 logittpr logitfprspearman logittpr logitfpr1.1 合并阳性似然比命令:metan tp fn fp tn, rr random nowt sortby(author) xlab(.01,1,100) label(namevar=author, yearvar=pubyear) t1(Summary LR+, Random Effects)2.2 合并阴性似然比命令:metan fn tp tn fp, rr random nowt sortby(author) xlab(.01,1,100) label(namevar=author, yearvar=pubyear) t1(Summary LR-, Random Effects)2.3 合并诊断OR值命令:metan tp fn fp tn, or random nowt sortby(author) xlab(.01,1,100) label(namevar=author, yearvar=pubyear) t1(Summary Diagnostic Odds Ratio, Random Effects)2.4 ROC值命令:gr7 tpr fpr, s(O) noaxis ysize(6) xsize(6) xline(0(.1)1) yline(0(.1)1) tlab(0(.1)1) xlab(0(.1)1) ylab(0(.1)1) t1(1-Specificity) l1(Sensitivity) b2(1-Specificity) b1(ROC Plot of Sensitivity vs Specificity)2.5 SROC曲线命令:gen sum= logittpr+ logitfprgen diff= logittpr- logitfprregress diff sumpredict yhatgr7 diff yhat sum, ylab(3,4,5,6,7,8) xlab(-4,-3,-2,-1,0,1,2) c(.l) s(oi)gen tse=1/(1+(1/(exp(_cons/1-_b)*(fpr/spec)^1+_b/1-_b)))(constant and b are derived from the above regression model)*plot SROC curve (generic)gr7 se tse fpr, ysize(6) xsize(6) noaxis xline(0(.1)1) yline(0(.1)1) tlab(0(.1)1) xlab(0(.1)1)ylab(0(.1)1) s(Oi) c(.s) l1(Sensitivity) b2(1-Specificity) ti(Summary ROC Curve) key1(" ")key2(" ")2.6 HSROC-bivariate meta-analysis命令:metandi tp fp fn tn, plot (基于SROC命令)2.7 发表偏倚命令:gen or=(tp*tn)/(fp*fn)gen lnor=ln(or)gen selnor=(1/tp)+(1/fp)+(1/fn)+(1/tn)*Begg and Egger test for publication bias with Begg's funnel plot: metabias lnor selnor, graph(begg)*Begg and Egger tests for subgroups (eg. Covariate=1)metabias lnor selnor if covariate==1, graph(begg)。
用stata进行单个率meta分析程序总结感谢版主对我的方法进行验证,这里整理一下方面大家研究谷歌的程序(标红部分,分批录入stata12.0.可得到结果。
)clearinput study cases total1 20 10002 40 50003 30 15004 25 3300endgen p = .gen se = .// get proportions and std errorsforv i =1(1)4 {cii total[`i'] cases[`i']qui replace p = r(mean) in `i'qui replace se = r(se) in `i'}// get the inverse variance-weighted proportion// use the official Stata -vwls- commandgen cons =1vwls p cons, sd(se)// use the user written -metan- command// for fixed-effects meta-analysismetan p se, nograph fixed// for random-effects meta-analysismetan p se, nograph random我的数据,用谷歌方法运行的命令:clearinput study cases total1 76 4512 86 2023 24 974 401 2502endgen p = .gen se = .forv i =1(1)4 {cii total[`i'] cases[`i']qui replace p = r(mean) in `i' qui replace se = r(se) in `i'}gen cons =1vwls p cons, sd(se)metan p se, nograph fixed metan p se, nograph random我自已编的程序结果见贴子中的图片:录入格式,r nclearinput study r n1 0.831 1542 0.828 1343 0.88 100endgenerate ser=sqrt(r*(1-r)/n)metan r ser, fixed label(namevar=study)metan r ser, random label(namevar=study)metafunnel r ser。
Both the output and the graph show that there is a clear effect of streptokinase in protecting against death following myocardial infarction. The meta-analysis is dominated by the large GISSI-12and ISIS-23trials which contribute 76·2% of the weight in this analysis. If required, the text showing the weights or treatment effects may be omitted from the graph (options nowt and nostats, respectively). The metan command will perform all the commonly used fixed effects (inverse variance method, Mantel–Haenszel method and Peto’s method) and random effects (DerSimonian and Laird) analyses. These methods are described in Chapter 15. Commands labbe to draw L’Abbé plots (see Chapters 8 and 10) and funnel to draw funnel plots (see Chapter 11) are also included. 352Note that meta performs both fixed and random effects analyses by default and the tabular output includes the weights from both analyses. It is clear that the smaller studies are given relatively more weight in the random effects analysis than with the fixed effect model. Because the meta command requires only the estimated treatment effect and its standard error, it will be particularly useful in meta-analyses of studies in which the treatment effect is not derived from the standard 2 ×2 table. Examples might include crossover trials, or survival trials, when the treatment effect might be measured by the hazard ratio derived from Cox regression. Example 2: intravenous magnesium in acute myocardial infarction The following table gives data from 16 randomised controlled trials of intravenous magnesium in the prevention of death following myocardial infarction. These trials are a well-known example where the results of a meta-analysis8were contradicted by a single large trial (ISIS-4)9–11(see also Chapters 3 and 11).355Dealing with zero cellsWhen one arm of a study contains no events – or, equally, all events – we have what is termed a “zero cell” in the 2 ×2 table. Zero cells create problems in the computation of ratio measures of treatment effect, and the standard error of either difference or ratio measures. For trial number 8 (Bertschart), there were no deaths in the intervention group, so that the estimated odds ratio is zero and the standard error cannot be estimated. A common way to deal with this problem is to add 0·5 to each cell of the 2 ×2 table for the trial. If there are no events in either the intervention or control arms of the trial, however, then any measure of effect summarised as a ratio is undefined, and unless the absolute (risk difference) scale is used instead, the trial has to be discarded from the meta-analysis.The metan command deals with the problem automatically, by adding 0·5 to all cells of the 2 ×2 table before analysis. For the commands which require summary statistics to be calculated (meta,metacum,metainf, metabias and metareg) it is necessary to do this, and to drop trials with no events or in which all subjects experienced events, before calculating the treatment effect and standard error.To drop trials with no events or all events:drop if dead1==0&dead0==0drop if dead1==tot1&dead0==tot0357By the late 1970s, there was clear evidence that streptokinase prevented death following myocardial infarction. However it was not used routinely until the late 1980s, when the results of the large GISSI-1 and ISIS-2 trials became known (see Chapter 1). The cumulative meta-analysis plot makes it clear that although these trials reduced the confidence interval for the summary estimate, they did not change the estimated degree of protection.Examining the influence of individual studiesThe influence of individual studies on the summary effect estimate may be displayed using the metainf command.15This command performs an influence analysis, in which the meta-analysis estimates are computed omitting one study at a time. The syntax for metainf is the same as that for the meta command. By default, fixed-effects analyses are displayed. Let’s perform this analysis for the magnesium data:metainf logor selogor, eform id (trialnam)361The label above the vertical axis indicates that the treatment effect estimate (here, log odds ratio) has been exponentiated. The meta-analysis is dominated by the ISIS-4 study, so omission of other studies makes little or no difference. If ISIS-4 is omitted then there appears to be a clear effect of magnesium in preventing death after myocardial infarction.Funnel plots and tests for funnel plot asymmetryThe metabias command16,17performs the tests for funnel-plot asymmetry proposed by Begg and Mazumdar18and by Egger et al.11(see Chapter 11). If the graph option is specified the command will produce either a plot of standardized effect against precision11(graph(egger)) or a funnel plot (graph(begg)). For the magnesium data there is clear evidence of funnel plot asymmetry if the ISIS-4 trial is included. It is of more interest to know if there was evidence of bias before the results of the ISIS-4 trial were known. Therefore in the following analysis we omit the ISIS-4 trial:metabias logor selogor if trial<16, graph(begg)Note: default data input format (theta, se_theta) assumed.if trialno < 16362The funnel plot appears asymmetric, and there is evidence of bias using the Egger (weighted regression) method (P for bias 0·007) but not using the Begg (rank correlation method). This is compatible with a greater statistical power of the regression test, as discussed in Chapter 11. The horizontal line in the funnel plot indicates the fixed-effects summary estimate (using363To use the metareg command, we need to derive the treatment effect estimate (in this case log risk ratio) and its standard error, for each study.generate logrr=log((cases1/tot1)/(cases0/tot0)) generate selogrr=sqrt((1/cases1)-(1/tot1)+(1/cases0)-(1/tot0))In their meta-analysis, Colditz et al. noted the strong evidence for heterogeneity between studies, and concluded that a random-effects meta-analysis was appropriate:meta logrr selogrr, eformMeta-analysis (exponential form)Pooled95% CI Asymptotic No. ofies MethodEst Lower Upper z_value p_value stud Fixed0.6500.6010.704-10.6250.00013 Random0.4900.3450.695-3.9950.000Test for heterogeneity: Q= 152.233 on 12 degrees of freedom (p= 0.000)Moment-based estimate of between studies variance = 0.309366。