library(rstan) ###R version 4.1.1, rstan version 2.21.3### ###how to install package rstan, please see https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started### setwd("~")###Set working directory, please replace it with your working directory### ####Stan_models### ###α=0.01### p0.01.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.01;} } " ###α=0.1### p0.1.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.1;} }" ###α=0.2### p0.2.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.2;} }" ###α=0.3### p0.3.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.3;} }" ###α=0.4### p0.4.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.4;} }" ###α=0.5### p0.5.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.5;} }" ###α=0.6### p0.6.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.6;} }" ###α=0.7### p0.7.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.7;} }" ###α=0.8### p0.8.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.8;} }" ###α=0.9### p0.9.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*0.9;} }" ###α=1### p1.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real mu; // relative treatment effect (log OR) in RCTs real tau; // the heterogeneity parameter in NRSIs real mu1[J];//baseline risks in RCTs (log odds) real tau1;// the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu1[i]); ptrt[i] =inv_logit(mu1[i] +mu+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); zeta ~normal(0,1); tau1 ~ normal(0,0.5); mu1 ~ normal(0,10); mu ~ normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); for (i in 1:k) { target +=normal_lpdf(y[i] | mu,y_se[i]+tau)*1;} }" power.prior.stan <- "data { int k;//Number of NRSIs real y[k];//Effect in NRSIs real y_se[k]; //stdev in NRSIs int J;//Number of RCTs int n_t[J];//Number of subjects in RCTs, treatment int r_t[J];//Number of events, treatment int n_c[J];//Number of subjects in RCTs, Control int r_c[J];//Number of events, Control } parameters { real theta; // relative treatment effect (log OR) real tau; // the heterogeneity parameter real w1;//down-weight factor for study 1 real w2;//down-weight factor for study 2 real w3;//down-weight factor for study 3 real w4;//down-weight factor for study 4 real w5;//down-weight factor for study 5 real w6;//down-weight factor for study 6 real w7;//down-weight factor for study 7 real w8;//down-weight factor for study 8 real w9;//down-weight factor for study 9 real w10;//down-weight factor for study 10 real mu[J];//baseline risks in RCTs (log odds) real tau1;the heterogeneity parameter in RCTs vector[J] zeta;// individual treatment effects in RCTs } transformed parameters { real pctrl[J]; real ptrt[J]; for (i in 1:J) {pctrl[i] =inv_logit(mu[i]); ptrt[i] =inv_logit(mu[i] +theta+zeta[i]*tau1);} } model { //prior distributions tau ~ normal (0, 0.5); w1~beta(4,1);//Fralick et al. (2017)-Moderate risk of bias w2~beta(1.5,1);//Wang et al. (2017)-Serious risk of bias w3~beta(4,1);//kim et a. (2018)-Moderate risk of bias w4~beta(4,1);//Ueda et a. (2018)-Moderate risk of bias w5~beta(1.5,1);//Wang et al. (2019)-Serious risk of bias w6~beta(1.5,1);//Wang et al. (2019)-Serious risk of bias w7~beta(1.5,1);//Wang et al. (2019)-Serious risk of bias w8~beta(1.5,1);//Wang et al. (2019)-Serious risk of bias w9~beta(4,1);//Douros et a. (2020)-Moderate risk of bias w10~beta(4,1);//McGurnaghan et a. (2019)-Moderate risk of bias tau1 ~ normal(0,0.5); mu ~ normal(0,10); zeta ~normal(0,1); theta~normal(0,2.82); r_c ~ binomial(n_c,pctrl); r_t ~ binomial(n_t,ptrt); target +=normal_lpdf(y[1] | theta,y_se[1]+tau)*w1; target +=normal_lpdf(y[2] | theta,y_se[2]+tau)*w2; target +=normal_lpdf(y[3] | theta,y_se[3]+tau)*w3; target +=normal_lpdf(y[4] | theta,y_se[4]+tau)*w4; target +=normal_lpdf(y[5] | theta,y_se[5]+tau)*w5; target +=normal_lpdf(y[6] | theta,y_se[6]+tau)*w6; target +=normal_lpdf(y[7] | theta,y_se[7]+tau)*w7; target +=normal_lpdf(y[8] | theta,y_se[8]+tau)*w8; target +=normal_lpdf(y[9] | theta,y_se[9]+tau)*w9; target +=normal_lpdf(y[10] | theta,y_se[9]+tau)*w10; } " set.seed(2023) ###RCT data### meta.data.rct <- as.data.frame(matrix(NA, 7,4)) colnames(meta.data.rct) <- c("rtrt","ntrt","rctrl","nctrl") meta.data.rct$rtrt <- c(0,1,1,0,1,1,1) meta.data.rct$ntrt <- c(735,447,1652,233,888,985,205) meta.data.rct$rctrl <- c(1,0,1,1,0,0,0) meta.data.rct$nctrl <- c(549,233,1050,230,437,247,209) k.rct <- dim(meta.data.rct)[1] ###RWE data### k.rwe <- 10 R <- k.rwe###the number of NRSIs M <- k.rct###the number of RCTs y_nrsi <- log(c(2.12,2.06,0.85,1.73,1.44,1.32,2.48,1.31,3.62,0.53))###log-or for RWE study y_se_nrsi <- c((log(3.38)-log(1.33))/(2*1.96),(log(3.61)-log(1.17))/(2*1.96),(log(1.40)-log(0.52))/(2*1.96),(log(3.63)-log(0.82))/(2*1.96), (log(1.68)-log(1.23))/(2*1.96),(log(1.81)-log(0.96))/(2*1.96),(log(4.03)-log(1.53))/(2*1.96),(log(1.61)-log(1.07))/(2*1.96), (log(4.50)-log(2.91))/(2*1.96),(log(0.92)-log(0.31))/(2*1.96)) ##power prior## pp.data <- list(J =M, n_t=meta.data.rct$ntrt, r_t=meta.data.rct$rtrt,n_c=meta.data.rct$nctrl,r_c=meta.data.rct$rctrl,k=R,y=y_nrsi,y_se=y_se_nrsi) fit.p0.01 <- stan(model_code = p0.01.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.1 <- stan(model_code = p0.1.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.2 <- stan(model_code = p0.2.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.3 <- stan(model_code = p0.3.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.4 <- stan(model_code = p0.4.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.5 <- stan(model_code = p0.5.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.6 <- stan(model_code = p0.6.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.7 <- stan(model_code = p0.7.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.8 <- stan(model_code = p0.8.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p0.9 <- stan(model_code = p0.9.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.p1 <- stan(model_code = p1.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) fit.pp <- stan(model_code = power.prior.stan, data = pp.data,chains = 4,iter = 5000, cores=4,control=list(adapt_delta = 0.99)) parameter.fit.p0.01 <- extract(fit.p0.01, permuted = TRUE) parameter.fit.p0.1 <- extract(fit.p0.1, permuted = TRUE) parameter.fit.p0.2 <- extract(fit.p0.2, permuted = TRUE) parameter.fit.p0.3 <- extract(fit.p0.3, permuted = TRUE) parameter.fit.p0.4 <- extract(fit.p0.4, permuted = TRUE) parameter.fit.p0.5 <- extract(fit.p0.5, permuted = TRUE) parameter.fit.p0.6 <- extract(fit.p0.6, permuted = TRUE) parameter.fit.p0.7 <- extract(fit.p0.7, permuted = TRUE) parameter.fit.p0.8 <- extract(fit.p0.8, permuted = TRUE) parameter.fit.p0.9 <- extract(fit.p0.9, permuted = TRUE) parameter.fit.p1 <- extract(fit.p1, permuted = TRUE) parameter.fit.pp <- extract(fit.pp, permuted = TRUE) p0.01.theta <- parameter.fit.p0.01$mu p0.1.theta <- parameter.fit.p0.1$mu p0.2.theta <- parameter.fit.p0.2$mu p0.3.theta <- parameter.fit.p0.3$mu p0.4.theta <- parameter.fit.p0.4$mu p0.5.theta <- parameter.fit.p0.5$mu p0.6.theta <- parameter.fit.p0.6$mu p0.7.theta <- parameter.fit.p0.7$mu p0.8.theta <- parameter.fit.p0.8$mu p0.9.theta <- parameter.fit.p0.9$mu p1.theta <- parameter.fit.p1$mu pp.theta <- parameter.fit.pp$theta p0.01.theta.median <- quantile(p0.01.theta,0.5);p0.01.theta.l <- quantile(p0.01.theta,0.025);p0.01.theta.u <- quantile(p0.01.theta,0.975) p0.1.theta.median <- quantile(p0.1.theta,0.5);p0.1.theta.l <- quantile(p0.1.theta,0.025);p0.1.theta.u <- quantile(p0.1.theta,0.975) p0.2.theta.median <- quantile(p0.2.theta,0.5);p0.2.theta.l <- quantile(p0.2.theta,0.025);p0.2.theta.u <- quantile(p0.2.theta,0.975) p0.3.theta.median <- quantile(p0.3.theta,0.5);p0.3.theta.l <- quantile(p0.3.theta,0.025);p0.3.theta.u <- quantile(p0.3.theta,0.975) p0.4.theta.median <- quantile(p0.4.theta,0.5);p0.4.theta.l <- quantile(p0.4.theta,0.025);p0.4.theta.u <- quantile(p0.4.theta,0.975) p0.5.theta.median <- quantile(p0.5.theta,0.5);p0.5.theta.l <- quantile(p0.5.theta,0.025);p0.5.theta.u <- quantile(p0.5.theta,0.975) p0.6.theta.median <- quantile(p0.6.theta,0.5);p0.6.theta.l <- quantile(p0.6.theta,0.025);p0.6.theta.u <- quantile(p0.6.theta,0.975) p0.7.theta.median <- quantile(p0.7.theta,0.5);p0.7.theta.l <- quantile(p0.7.theta,0.025);p0.7.theta.u <- quantile(p0.7.theta,0.975) p0.8.theta.median <- quantile(p0.8.theta,0.5);p0.8.theta.l <- quantile(p0.8.theta,0.025);p0.8.theta.u <- quantile(p0.8.theta,0.975) p0.9.theta.median <- quantile(p0.9.theta,0.5);p0.9.theta.l <- quantile(p0.9.theta,0.025);p0.9.theta.u <- quantile(p0.9.theta,0.975) p1.theta.median <- quantile(p1.theta,0.5);p1.theta.l <- quantile(p1.theta,0.025);p1.theta.u <- quantile(p1.theta,0.975) pp.theta.median <- quantile(pp.theta,0.5);pp.theta.l <- quantile(pp.theta,0.025);pp.theta.u <- quantile(pp.theta,0.975) median.value <- c(p0.01.theta.median,p0.1.theta.median,p0.2.theta.median,p0.3.theta.median,p0.4.theta.median,p0.5.theta.median,p0.6.theta.median,p0.7.theta.median,p0.8.theta.median, p0.9.theta.median,p1.theta.median,pp.theta.median) l.value <- c(p0.01.theta.l,p0.1.theta.l,p0.2.theta.l,p0.3.theta.l,p0.4.theta.l,p0.5.theta.l,p0.6.theta.l,p0.7.theta.l,p0.8.theta.l, p0.9.theta.l,p1.theta.l,pp.theta.l) u.value <- c(p0.01.theta.u,p0.1.theta.u,p0.2.theta.u,p0.3.theta.u,p0.4.theta.u,p0.5.theta.u,p0.6.theta.u,p0.7.theta.u,p0.8.theta.u, p0.9.theta.u,p1.theta.u,pp.theta.u) p0.01 <- length(which( p0.01.theta >0))/length(p0.01.theta) p0.1 <- length(which( p0.1.theta >0))/length(p0.1.theta) p0.2 <- length(which( p0.2.theta >0))/length(p0.2.theta) p0.3 <- length(which( p0.3.theta >0))/length(p0.3.theta) p0.4 <- length(which( p0.4.theta >0))/length(p0.4.theta) p0.5 <- length(which( p0.5.theta >0))/length(p0.5.theta) p0.6 <- length(which( p0.6.theta >0))/length(p0.6.theta) p0.7 <- length(which( p0.7.theta >0))/length(p0.7.theta) p0.8 <- length(which( p0.8.theta >0))/length(p0.8.theta) p0.9 <- length(which( p0.9.theta >0))/length(p0.9.theta) p1 <- length(which( p1.theta >0))/length(p1.theta) pp <- length(which( pp.theta >0))/length(pp.theta) p.value <- c(p0.01,p0.1,p0.2,p0.3,p0.4,p0.5,p0.6,p0.7,p0.8,p0.9,p1,pp) result.data <- round(cbind(median.value,l.value,u.value,p.value),2) ###plot### or_dataset <- data.frame(Model=c("0.01","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","Random"),Median=result.data[,1],lower=result.data[,2],upper=result.data[,3]) or_dataset$Model <- factor(or_dataset$Model,levels = c("0.01","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","Random")) annotation_log_or <- data.frame( x=c(1.5,1.5,1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.75,1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75,1.75,1.75,1.75,1.75,2.1,2.05,2.05, 2.05, 2.05, 2.05, 2.05, 2.05, 2.05, 2.05, 2.05, 2.05, 2.05), y = c(12.5,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,12.5,12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,12.5,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), label=c('Median', '0.34','0.43','0.43','0.43','0.42','0.41','0.40', '0.39', '0.36','0.32', '0.26', '0.03', '95% CrI','(-0.21-0.86)','(0.06-0.80)','(0.02-0.81)','(-0.02-0.82)','(-0.05-0.85)','(-0.12-0.88)','(-0.20-0.91)','(-0.30-0.96)','(-0.41-1.01)','(-0.56-1.07)','(-0.79-1.20)','(-1.30-1.40)', 'P(log-OR>0)','0.90','0.98','0.98','0.97','0.96','0.94','0.92','0.89','0.85','0.79','0.70','0.52')) Figure.s2 <- ggplot(or_dataset, aes(Median, Model)) + geom_point(size=1) + geom_errorbarh(aes(xmax =upper, xmin = lower),height = 0.1,size=0.5)+ geom_vline(aes(xintercept=0))+ scale_x_continuous(limits=c(-1.5, 2.1)) + xlab('Log odds ratio (μ)') + ylab("Alpha used for power prior ") + theme_bw() + geom_text(data=annotation_log_or,aes(x=x,y=y,label=label),size=4)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),axis.title = element_text(size = 15,face = "bold",color = "black"), axis.text.y = element_text(size=10, face = "bold",color = "black"), axis.text.x = element_text(size=10, face = "bold",color = "black")) ggsave(Figure.s2, filename = "~\\Figure_s2.png", dpi = 300, height =24, width =28, units = "cm")