# Longitudinal model over time # Emax time-course function # Fixed treatment effects for ET50 # Fixed treatment effects for Emax # Multivariate likelihood (compound symmetry covariance structure) to account for correlation between time points # Correlation coefficient (rho) estimated within model - deviance / residual deviance not calculated as saturated model is not uniquely defined 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 delta.ET50[i,1] <- 0 for (k in 1:narm[i]){ # Generates covariance matrix upper and lower triangles for (c in 1:(fups[i]-1)) { for (r in (c+1):fups[i]) { cov.mat[i,k,r,c] <- se[i,k,c]*se[i,k,r]*rho # Lower triangle cov.mat[i,k,c,r] <- se[i,k,c]*se[i,k,r]*rho # Upper triangle } } # Generates covariance matrix diagonals for (m in 1:fups[i]) { cov.mat[i,k,m,m] <- pow(se[i,k,m],2) } y[i,k,1:fups[i]] ~ dmnorm.vcov(theta[i,k,1:fups[i]], cov.mat[i,k,1:fups[i],1:fups[i]]) # Multivariate normal likelihood (uses dmnorm.vcov function from JAGS > 4.3.0) for (m in 1:fups[i]) { # Run through all observations within a study 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 } # 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] } # Consistency equations for (k in 2:narm[i]){ delta.Emax[i,k] <- d.Emax[treat[i,k]] - d.Emax[treat[i,1]] delta.ET50[i,k] <- d.ET50[treat[i,k]] - d.ET50[treat[i,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) } # Prior for correlation between time points rho ~ dunif(-1,1) # Model ends }