# Longitudinal model over time # Linear time-course function # Fixed treatment effects model{ # Begin Model Code for(i in 1:NS){ # Run Through all NS trials mu[i] ~ dnorm(0,0.0001) delta[i,1] <- 0 alpha[i] ~ dnorm(0,0.0001) # Prior on baseline nuisance parameter 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] <- alpha[i] + (beta[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 } beta[i,k] <- mu[i] + delta[i,k] # Relative effects for time-course parameters resarmdev[i,k] <- sum(resdev[i,k,1:fups[i]]) armdev[i,k] <- sum(dev[i,k,1:fups[i]]) } resstudydev[i] <- sum(resarmdev[i, 1:narm[i]]) studydev[i] <- sum(armdev[i, 1:narm[i]]) for(k in 2:narm[i]){ delta[i,k] <- d[treat[i,k]] - d[treat[i,1]] # Consistency equation } } d[1] <- 0 for (k in 2:NT){ d[k] ~ dnorm(0,0.0001) # Priors on relative treatment effects } totresdev <- sum(resstudydev[]) totdev <- sum(studydev[]) # Model ends }