JAGS: node inconsistent with parents
<p>I am trying to apply Benedict Escoto's method from the paper "Bayesian Claim Severity with Mixed Distributions," published in Variance. I seem to be running into a JAGS simulation problem. When I run the code, JAGS gives me the following error:</p>

<p><strong>Error in node ones[1] Node inconsistent with parents</strong></p>

<p>The data is two-fold. First, there is a list of ground-up insurance claims. Information on their age in years, deductibles (truncation) and whether they have been capped (censoring, True or False) is provided. Second, there is a list of prior means and corresponding probability weights for a mixed exponential distribution.</p>

<p>One thing I noticed is that it works for one set of data of priors for mixed exponential distribution, but fails for another.</p>

<p>It works with:</p>

<p>Mean Weight
 50 0.3
 100 0.25
 500 0.25
 1500 0.1
 5000 0.07
 20000 0.03</p>

<p>But it fails with:</p>

<p>Mean Weight
 3 0.72
 14 0.19
 42 0.05
 138 0.02
 503 0.01
 1501 0.01</p>

<p>So it may have to do with parameter requirements for mixed exponential.</p>

<p>Data packet for JAGS is assembled as below</p>

<pre><code>jags.data &lt;- list(claims=(claim.df$x[!claim.df$capped]
                      - claim.df$truncation[!claim.df$capped]),
              capped.claims=(claim.df$x[claim.df$capped]
                      - claim.df$truncation[claim.df$capped]),
              alpha=alpha,
              means=actual.means,
              ones=rep(1, length(claim.df$[claim.df$capped])),                                                                                                                                  
              ages=claim.df$age[!claim.df$capped],
              capped.ages=claim.df$age[claim.df$capped],
              trend.shape=trend.shape,
              trend.rate=1/trend.scale)
</code></pre>

<p>Notice that object "ones" is given values of 1 for each capped claim.</p>

<p>The initial values are supplied as below:</p>

<pre><code>jags.init &lt;- list(means=list(weights=prior.weights),
              equal=list(weights=rep(1/m,m))) 
</code></pre>

<p>Some miscellaneous values are provided as follows:</p>

<pre><code>m &lt;- length(actual.means)
alpha0 &lt;- 20
alpha &lt;- prior.weights * alpha0
trend.prior.mu &lt;- .05
trend.prior.sigma &lt;- .01
trend.scale &lt;- trend.prior.sigma^2 / (1+trend.prior.mu)
trend.shape &lt;- (1+trend.prior.mu)/trend.scale
</code></pre>

<p>The JAGS model is coded as below:</p>

<pre><code>model &lt;- "model {
  weights ~ ddirch(alpha)
  trend.factor ~ dgamma(trend.shape, trend.rate)
  for (i in 1:length(claims)) {
    buckets[i] ~ dcat(weights)
    mu[i] &lt;- means[buckets[i]] / trend.factor^ages[i]
    claims[i] ~ dexp(1/mu[i])
  }
  for (i in 1:length(capped.claims)) {
    capped.buckets[i] ~ dcat(weights)
    capped.mu[i] &lt;- means[capped.buckets[i]]/trend.factor^capped.ages[i]
    prob.capped[i] &lt;- exp(-capped.claims[i]/capped.mu[i])
    ones[i] ~ dbern(prob.capped[i])
  }
}"
</code></pre>

<p>Dirichlet, Categorical and Gamma distributions are used for priors. Ones is Bernoulli distributed to characterize claims as capped or uncapped. </p>

<p>Finally, the model is run in JAGS with the following:</p>

<pre><code>model.out &lt;- autorun.jags(model, data=jags.data, inits=jags.init,
                      monitor=c("weights","trend.factor"),
                      startburnin=1000, startsample=5000,
                      n.chains=n.chains, interactive=FALSE, thin=thin.factor)
</code></pre>

<p>Would anyone have an idea what goes wrong? Thanks</p>