modelIPDnetmetaNRS <-function(){
# IPD-NRS
for (i in 1:np.NRS) { # loop through individuals
# binomial likelihood of 0/1 bianry outcome y for each individual i of study j in arm k
y.NRS[i]~dbern(p.NRS[i])
# logistic transformation with treatment-by-covariate interactions - to estimate Odds Ratio (OR)
logit(p.NRS[i]) <- u.NRS[studyid.NRS[i]]+theta.NRS[studyid.NRS[i],treat.NRS[i]]*(1-equals(treat.NRS[i],baseline.NRS[i]))
}
for(j in 1:(nIPD.NRS)) { # loop through IPD studies
w.NRS[j,1]<- 0
theta.NRS[j,t.NRS[j,1]]<- 0
for (k in 2:na.NRS[j]) { # loop through non-referent IPD arms
# distribution of random effects
theta.NRS[j,t.NRS[j,k]] ~ dnorm(md.NRS[j,t.NRS[j,k]],precd.NRS[j,t.NRS[j,k]])
# accounting for correlation between effect sizes estimated in multi-arm trials
md.NRS[j,t.NRS[j,k]]<- mean.NRS[j,k] + sw.NRS[j,k]
w.NRS[j,k]<- (theta.NRS[j,t.NRS[j,k]] - mean.NRS[j,k])
sw.NRS[j,k]<- sum(w.NRS[j,1:(k-1)])/(k-1)
precd.NRS[j,t.NRS[j,k]]<- prec.NRS *2*(k-1)/k
# consistency equations
mean.NRS[j,k] <-d.NRS[t.NRS[j,k]] - d.NRS[t.NRS[j,1]]
}}
#** PRIORS
#----- priors for NRS
# prior distribution for log-odds in baseline arm of study j
for (j in 1:(nIPD.NRS)) {u.NRS[j] ~ dnorm(0,.01)}
# prior distribution for heterogeneity
tau.NRS ~ dnorm(0,1)%_%T(0,)
prec.NRS<- 1/pow(tau.NRS,2)
# prior distribution for basic parameters
d.NRS[ref.NRS] <- 0
for(k in 1:(ref.NRS-1)) {
d.NRS[k] ~ dnorm(0,.001)
}
for(k in (ref.NRS+1):nt.NRS) {
d.NRS[k] ~ dnorm(0,.001)
}
}
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.