# Longitudinal model over time # Emax time-course function # Fixed treatment effects for ET50 # Random treatment effects for Emax with multi-arm correction model{ # Begin Model Code for(i in 1:NS){ # Run Through all NS trials l.E0[i] ~ dnorm(0,0.0001) # prior for baseline nuisance parameter mu.Emax[i] ~ dnorm(0,0.0001) mu.ET50[i] ~ dnorm(0,0.0001) delta.Emax[i,1] <- 0 w.Emax[i,1] <- 0 for (k in 1:narm[i]){ for (m in 1:fups[i]) { # Run through all observations within a study y[i,k,m] ~ dnorm(theta[i,k,m], prec[i,k,m]) # Normal likelihood prec[i,k,m] <- pow(se[i,k,m], -2) theta[i,k,m] <- exp(l.E0[i]) + (Emax[i,k] * time[i,m]) / (exp(l.ET50[i,k]) + time[i,m]) # Time-course function resdev[i,k,m] <- pow((y[i,k,m] - theta[i,k,m]),2) * prec[i,k,m] # residual deviance for normal likelihood dev[i,k,m] <- -2* (log(pow((prec[i,k,m]/(2*3.14159)),0.5) * exp(-0.5*(pow((y[i,k,m]-theta[i,k,m]),2)*prec[i,k,m])))) # deviance for normal likelihood } armdev[i,k] <- sum(dev[i,k,1:fups[i]]) resarmdev[i,k] <- sum(resdev[i,k,1:fups[i]]) # Relative effects for time-course parameters Emax[i,k] <- mu.Emax[i] + delta.Emax[i,k] l.ET50[i,k] <- mu.ET50[i] + delta.ET50[i,k] } studydev[i] <- sum(armdev[i, 1:narm[i]]) resstudydev[i] <- sum(resarmdev[i, 1:narm[i]]) # Consistency equations for(k in 2:narm[i]){ # Random effects for Emax delta.Emax[i,k] ~ dnorm(md.Emax[i,k], taud.Emax[i,k]) md.Emax[i,k] <- d.Emax[treat[i,k]] - d.Emax[treat[i,1]] + sw.Emax[i,k] # Fixed effects for ET50 delta.ET50[i,k] <- d.ET50[treat[i,k]] - d.ET50[treat[i,1]] # Multi-arm correction taud.Emax[i,k] <- tau.Emax * 2*(k-1)/k w.Emax[i,k] <- (delta.Emax[i,k] - d.Emax[treat[i,k]] + d.Emax[treat[i,1]]) sw.Emax[i,k] <- sum(w.Emax[i,1:(k-1)])/(k-1) } } d.Emax[1] <- 0 d.ET50[1] <- 0 # Priors on relative treatment effects for (k in 2:NT){ d.Emax[k] ~ dnorm(0,0.001) d.ET50[k] ~ dnorm(0,0.001) } # Priors on between-study SD sd.Emax ~ dunif(0,2) tau.Emax <- pow(sd.Emax, -2) totdev <- sum(studydev[]) totresdev <- sum(resstudydev[]) # Model ends }