Error in dim(x) <- c(dim(x), 1)

Hi,

A model that was running without any issue now gives me a weird error I can’t figure out. It seems to be a problem when I run it as a single chain. This doesn’t happen when I run four parallel chains.

I am running this on the university’s HPC after requesting a node with 4 cores, but I am running a single-chain initialization in my code before I run it with four parallel chains (and more iterations).

I appreciate any guidance.

fit_init <- mod$sample(
  data            = data_resp,
  seed            = 1234,
  chains          = 1,
  iter_warmup     = 50,
  iter_sampling   = 50,
  refresh         = 10,
  adapt_delta     = 0.99)
Running MCMC with 1 chain...

Chain 1 WARNING: There aren't enough warmup iterations to fit the
Chain 1          three stages of adaptation as currently configured.
Chain 1          Reducing each adaptation stage to 15%/75%/10% of
Chain 1          the given number of warmup iterations:
Chain 1            init_buffer = 7
Chain 1            adapt_window = 38
Chain 1            term_buffer = 5
Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 1 Exception: dgirt_model_namespace::log_prob: Sigma_P is not symmetric. Sigma_P[1,2] = inf, but Sigma_P[2,1] = inf (in '/tmp/Rtmp9gtCp4/model-11fac31d147089.stan', line 57, column 2 to column 24)
Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
...
...
...
Chain 1 Iteration: 10 / 100 [ 10%]  (Warmup)
Chain 1 Iteration: 20 / 100 [ 20%]  (Warmup)
Chain 1 Iteration: 30 / 100 [ 30%]  (Warmup)
Chain 1 Iteration: 40 / 100 [ 40%]  (Warmup)
Chain 1 Iteration: 50 / 100 [ 50%]  (Warmup)
Chain 1 Iteration: 51 / 100 [ 51%]  (Sampling)
Chain 1 Iteration: 60 / 100 [ 60%]  (Sampling)
Chain 1 Iteration: 70 / 100 [ 70%]  (Sampling)
Chain 1 Iteration: 80 / 100 [ 80%]  (Sampling)
Chain 1 Iteration: 90 / 100 [ 90%]  (Sampling)
Chain 1 Iteration: 100 / 100 [100%]  (Sampling)
Chain 1 finished in 2022.3 seconds.
Error in dim(x) <- c(dim(x), 1) :
  dims [product 150] do not match the length of object [3]

I think this is actually Most recent commit breaks CmdStanR models with 1 chain · Issue #386 · stan-dev/posterior · GitHub, not a cmdstan issue

1 Like

Thank you. I will keep an eye on this issue.

I reinstalled the posterior package

remotes::install_cran("posterior")

and I assume this should fix it.

1 Like

I just reverted that commit in posterior, so it should be ok to install from GitHub now too.

2 Likes