I use the hierarchical modeling framework described by Kruschke to establish a comparison between the two models in JAGS. The idea in this structure is to run and compare several versions of a model, indicating each version as one level of a categorical variable. Then the subsequent distribution of this categorical variable can be interpreted as the relative probability of various models.
In the code below, I am comparing two models. Models are identical in shape. Each of them has a single parameter to be estimated mE. As you can see, the models differ in their priorities. Both priorities are distributed as beta distributions, which have a mode of 0.5. However, the preliminary distribution for model 2 is much more concentrated. Please also note that I used pseudo-primers, which, I hoped, made the chains get stuck on one of the models. But the model is still stuck.
Here is the model:
model {
m ~ dcat( mPriorProb[] )
mPriorProb[1] <- .5
mPriorProb[2] <- .5
omegaM1[1] <- 0.5 #true prior
omegaM1[2] <- 0.5 #psuedo prior
kappaM1[1] <- 3 #true prior for Model 1
kappaM1[2] <- 5 #puedo prior for Model 1
omegaM2[1] <- 0.5 #psuedo prior
omegaM2[2] <- 0.5 #true prior
kappaM2[1] <- 5 #puedo prior for Model 2
kappaM2[2] <- 10 #true prior for Model 2
for ( s in 1:Nsubj ) {
mE1[s] ~ dbeta(omegaM1[m]*(kappaM1[m]-2)+1 , (1-omegaM1[m])*(kappaM1[m]-2)+1 )
mE2[s] ~ dbeta(omegaM2[m]*(kappaM2[m]-2)+1 , (1-omegaM2[m])*(kappaM2[m]-2)+1 )
mE[s] <- equals(m,1)*mE1[s] + equals(m,2)*mE2[s]
z[s] ~ dbin( mE[s] , N[s] )
}
}
Here is the R code for the relevant data:
dataList = list(
z = c(81, 59, 36, 18, 28, 59, 63, 57, 42, 28, 47, 55, 38,
30, 22, 32, 31, 30, 32, 33, 32, 26, 13, 33, 30),
N = rep(96, 25),
Nsubj = 25
)
, MCMC m = 1 m = 2. priors pseudo priors , MCMC m = 2. 1 2, . , MCMC , , , . , JAGS m = 1. 6000 , .
, - , .
Cheers,