top of page
*Example 26: Normal–normal analysis
*Here we follow the approach of Carlin (1992) for the normal–normal analysis of the beta-blockers data.
*For our normal–normal analysis, we consider data in wide form and concentrate on modeling estimates of log odds-ratios from 22 studies.
cd "C:\Users\bowest\OneDrive - Victoria University of Wellington - STAFF\Desktop"
use https://www.stata-press.com/data/r18/betablockers_wide, clear
describe
/* Contains data from https://www.stata-press.com/data/r18/betablockers_wide.dta
Observations: 22 Beta-blockers data in wide form
Variables: 7 5 Feb 2022 19:02
(_dta has notes)
--------------------------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
--------------------------------------------------------------------------------------------------
study byte %9.0g Study identifier
deaths0 int %9.0g Number of deaths in the control group
total0 int %9.0g Number of subjects in the control group
deaths1 int %9.0g Number of deaths in the treatment group
total1 int %9.0g Number of subjects in the treatment group
D double %10.0g Log odds-ratio (based on empirical logits)
var double %10.0g Squared standard error of log odds-ratio
--------------------------------------------------------------------------------------------------
Sorted by:
*/
local color3 mcolor("maroon%70")
local color2 mcolor("blue%80")
local color1 mcolor("green%80")
bayesmh D D[study], likelihood(normal(var)) noconstant ///
prior({D[study]}, normal({d},{sig2})) ///
prior({d}, normal(0,1000)) ///
prior({sig2}, igamma(0.001,0.001)) ///
block({sig2}, gibbs) ///
block({d}, gibbs) ///
rseed(17)
return list
bayesstats ess {d} {sig2}
graph export bayesdiagn.png, replace
bayesgraph diagnostics {d} {sig2}
matrix bayesES= e(mean)
matrix list bayesES
matrix EScri= e(cri)
matrix list EScri
global bayesES=round(bayesES[1,1], 0.0001)
global lower=round(EScri[1,1], 0.0001)
global upper=round(EScri[2,1], 0.0001)
di $bayesES
di $lower
di $upper
gen SE= sqrt(var)
meta set D SE
meta summarize , random(reml)
meta forestplot _id _plot _esci , random(reml) ciopts(color(navy)) omarkeropts(mcolor(maroon)) markeropts(mcolor(navy)) ///
nullrefline(lcolor(gs12) lwidth(thin)) esrefline(lcolor(maroon) lpattern(shortdash) lwidth(thin)) cibind(parentheses) xlabel(, labsize(small)) title("") columnopts(_esci , format(%9.3f)) ///
customoverall( $bayesES $lower $upper, label("Bayesian Mean [95% cred. interval] ") `color1' ) ///
note("[Random (Reml) ] " , size(small)) ///
name(graph1, replace)
meta forestplot , random(reml) ciopts(color(navy)) omarkeropts(mcolor(maroon)) markeropts(mcolor(navy)) ///
nullrefline(lcolor(gs12) lwidth(thin)) esrefline(lcolor(maroon) lpattern(shortdash) lwidth(thin)) columnopts(_es, format(%9.3f)) ///
customoverall( $bayesES $lower $upper, label("Bayesian Mean [95% cred. interval] ") `color1' ) ///
name(graph2, replace)
meta forestplot , random(reml) ciopts(color(navy)) omarkeropts(mcolor(maroon)) markeropts(mcolor(navy)) ///
nullrefline(lcolor(gs12) lwidth(thin)) esrefline(lcolor(maroon) lpattern(shortdash) lwidth(thin)) columnopts(_es, format(%9.3f)) ///
customoverall( $bayesES $lower $upper, label("Bayesian Mean [95% cred. interval] ") `color1' ) ///
name(graph3, replace)
bottom of page
Comments