Gqs() failing because of transformed parameters--any fixes?

Hi again,

I am trying to get k-fold cross-validation going in Rstan, about which I had posted here. The loops still does not work, however, with the following error:

Wrong number of parameter values in draws from fitted model.  Expecting 432 columns, found 1264 columns

This issue seems to arise because of the problems of gqs() handling transformed parameters discussed here. My question is:

  • has this been fixed by now?

  • or alternatively, is there any workaround other than pushing the transformed parameters to generated quantities?

My transformed parameter block is quite essential to the model, and I have no idea how I could get rid of it without breaking the model. It looks like this:

transformed parameters{
  matrix[4,4] Rho = L_omega*L_omega';
  vector[4] theta[N_id];
  vector<lower=0>[N_id] rho;
  vector<lower=0>[N_id] gamma;
  vector<lower=0>[N_id] delta;
  vector<lower=0>[N_id] sigma;
  for (n_id in 1:N_id){
    theta[n_id] = ints + diag_pre_multiply(tau_s, L_omega_s) * Z[n_id];
    rho[n_id] = exp(theta[n_id,1]);  // constraint to be greater than 0
    gamma[n_id] = exp(theta[n_id,2]);  // constraint to be greater than 0
    delta[n_id] = exp(theta[n_id,3]);  // constraint to be greater than 0
    sigma[n_id] = exp(theta[n_id,4]); // constraint to be greater than 0
  } 

and the transformed parameters rho, gamma, delta, and sigma are the ones used in the model part.

Any ideas?

Thanks,
Max

This has been solved here. Apologies for cross-posting.

Max