Created
October 13, 2016 18:43
-
-
Save CnrLwlss/d6f4cd08df6063fab1670c9e3a35b737 to your computer and use it in GitHub Desktop.
Bayesian hierarchical model, written in JAGS, representing relationship between spots on a QFA plate. Constrained, uniform priors all the way through hierarchy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model { | |
tau_min <- 10000 | |
tau_max <- 1000000 | |
x0_min <- 0.0 | |
x0_max <- 0.05 | |
r_min <- 0.0 | |
r_max <- 10.0 | |
K_min <- 0.0 | |
K_max <- 0.5 | |
for (gene in 1:ngenes){ | |
for (spot in genemap[gene,2]:genemap[gene,3]){ | |
for (i in spotmap[spot,2]:spotmap[spot,3]) { | |
obs[i] ~ dnorm(pop[i],tau) | |
pop[i] <- (sK[spot]*sx0[spot]*exp(sr[spot]*time[i]))/(sK[spot]+sx0[spot]*(exp(sr[spot]*time[i])-1)) | |
}#i | |
sx0[spot] ~ dunif(max(x0_min,gx0[gene]-gx0_delta[gene]),min(x0_max,gx0[gene]+gx0_delta[gene])) | |
sx0_delta[spot] ~ dunif(0,gx0_delta[gene]) | |
sr[spot] ~ dunif(max(r_min,gr[gene]-gr_delta[gene]),min(r_max,gr[gene]+gr_delta[gene])) | |
sr_delta[spot] ~ dunif(0,gr_delta[gene]) | |
sK[spot] ~ dunif(max(K_min,gK[gene]-gK_delta[gene]),min(K_max,gK[gene]+gK_delta[gene])) | |
sK_delta[spot] ~ dunif(0,gK_delta[gene]) | |
}#spot | |
gx0[gene] ~ dunif(max(x0_min,x0-x0_delta),min(x0_max,x0+x0_delta)) | |
gx0_delta[gene] ~ dunif(0,x0_delta) | |
gr[gene] ~ dunif(max(r_min,r-r_delta),min(r_max,r+r_delta)) | |
gr_delta[gene] ~ dunif(0,r_delta) | |
gK[gene] ~ dunif(max(K_min,K-K_delta),min(K_max,K+K_delta)) | |
gK_delta[gene] ~ dunif(0,K_delta) | |
}#gene | |
tau ~ dunif(tau_min,tau_max) | |
x0 ~ dunif(x0_min,x0_max) | |
x0_delta ~ dunif(0,(x0_max-x0_min)/2.0) | |
r ~ dunif(r_min,r_max) | |
r_delta ~ dunif(0,(r_max-r_min)/2.0) | |
K ~ dunif(K_min,K_max) | |
K_delta ~ dunif(0,(K_max-K_min)/2.0) | |
}#model | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment