'R: Convergence issues with jagam (mgcv R package)

I am trying to fit following model:

mod <- jagam(y_freq ~ 
           s(x, bs="cr", fx=FALSE, k=5) + 
           s(x, by=a, bs="cr", fx=FALSE, k=5) + 
           s(x, by=b, bs="cr", fx=FALSE, k=5) + 
           s(x, by=c, bs="cr", fx=FALSE, k=5),
         family = binomial(), data = dt, 
         file = "file.jags", 
         weights = dt$total)

where 'a' is a numeric variable with 0 and 1 as potential values, 'b' is another numeric variable with 0 and 1 as potential values, and 'c' is the interaction between 'a' and 'b'.

As I would like to correct for overdispersion, I update the jags file that gets created by the jagam function as follows:

model {
  eta <- X %*% b
  for (i in 1:n) {
    y[i] ~ dbin(p[i],w[i])
    p[i] ~ dbeta(alpha[i], beta[i]) T(0.001,0.999) 
    alpha[i] = phi[i] * mu[i]
    beta[i] = phi[i] * (1 - mu[i])  
    phi[i] ~ dexp(1/250)
    mu[i] <-  ilogit(eta[i])
  } 
#splines are defined below here
}

After updating the file, I use the functions jags.model, jags.sample (for parameters: b, rho and mu) with 100k iterations and 3 chains, and sim2jam. After I check for convergence with the coda package, I get for all three chains following results (only one shown here):

example plot for one chain for rho parameter

I get traces for 8 rho parameters, for which only two seem to converge. I cannot show the results for the other parameters (b and mu) as there are too many (40 for b) to show on a plot.

I would like to know which of these 8 parameters for rho correspond to the null-space parameters, and what the cause of the convergence issue could be (too many parameters, too many splines, ...) and how to fix it?

Thank you,

Kate



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source