Alan Polansky
2013-08-14
Hello All:
I am trying to replicate the analysis of Arab, Rigdon and Basu (2012) [Journal of Quality Technology, Vol. 44, No. 1, 28-38] in JAGS. The model statement given in the paper for WinBUGS is
model{ C<-100000000 for (i in 1:K){ for (j in 1:N[i]){ #Define PEXP likelihood using the “zeros-trick” zeros[i,j] <- 0 zeros[i,j]~dpois(phi[i,j]) phi1[i,j] <- pow((delta[i]/mu[i])*pow(j, delta[i]-1),-1) *exp(-x[i,j]*pow((delta[i]/mu[i]) *pow(j, delta[i]-1),-1)) phi[i,j] <- -log(phi1[i,j])+C } } #Non-informative gamma prior distributions for #parameters for (i in 1:K){ mu[i] ~ dgamma(0.1,0.1) delta[i] ~ dgamma(0.1,0.1) } }
I have specified the following jags model:
data { for (i in 1:K) { for (j in 1:N[i]) { zeros[i,j] <- 0 } } } model { C<-100000000 for (i in 1:K) { for (j in 1:N[i]) { zeros[i,j] ~ dpois(phi[i,j]) phi1[i,j] <- pow((delta[i]/mu[i])* pow(j,delta[i]-1),-1)* exp(-1*x[i,j]*pow((delta[i]/mu[i])* pow(j, delta[i]-1),-1)) phi[i,j] <- 1*log(phi1[i,j])+C } } for (i in 1:K) { mu[i]~dgamma(0.1,0.1) delta[i]~dgamma(0.1,0.1) } }
The data are given by
x <- structure(c(327, 637, 278, 353, 401, 231, 125, 40, 261, 96, 36, 20, 7, 197, 990, 49, 18, 361, 6, 36, 191, 211, 159, 260, 107, 54, 107, 82, 341, 176, 277, 53, 32, 175, 171, 16, 54, 97, 51, 79, 24, 101, 332, 63, 10, 117, 350, 293, 510, 216, 132, 26, 72, 5, 110, 118, 176, 4, 303, 119, 10, 125, 247, 5, 34, 9, 9, 25, 165, 60, 45, 80, 85, 4, 454, 39, 324, 112, 27, 101, 142, 35, 2, 10, 59, 184, 39, 258, 70, 162, 16, 167, 249, 97, 57, 90, 8, 81, 212, 59, 103, 176, 34, 46, 204, 3, 11, 360, 21, 18, 182, 37, 5, 90, 152, 32, 116, 8, 3, 15, 158, 219, 30, 245, 144, 315, 44, 405, 24, 79, 80, 32, 18, 20, 32, 49, 53, 266, 0, 248, 38, 31, 84, 0, 0, 140, 10, 259, 218, 0, 0, 0, 311, 283, 122, 0, 0, 0, 61, 150, 0, 0, 0, 0, 0, 24, 0, 0), .Dim = c(6L, 28L)) N <- c(23,25,27,28,26,23) K <- 6
When I run the script I get the following error:
Welcome to JAGS 3.1.0 on Wed Aug 14 11:46:40 2013 JAGS is free software and comes with ABSOLUTELY NO WARRANTY Loading module: basemod: ok Loading module: bugs: ok Reading data file LHDarb.txt Compiling data graph Resolving undeclared variables Allocating nodes Initializing Reading data back into data table Compiling model graph Resolving undeclared variables Allocating nodes Graph Size: 1750 Initializing model Error in node zeros[3,3] Invalid parent values Deleting model
This appears to be due to the large value of 990 in the data.
If I replace the data point with something smaller it seems to work fine, but there
are major convergence issues.
Questions:
Have I specified the model correctly?
What will fix the error?
Thanks for any help anyone has.