Closed michaldanaj closed 2 weeks ago
Yeah unfortunately read_stan_csv
isn't working with the latest cmdstan csv files. We recommend using the provided functionality with cmdstanr to read the results into R instead of using cmdstanr to fit models and rstan to read the results. Maybe the code from the Stan forum post I linked to in this comment will help. It gives you a way to make an object with similar structure to what you need I think. Sorry for the hassle.
in addition to my previous comment, another option could be to run an older version of cmdstan. I think it might just be as of 2.35.0 that this is an issue, so you could try installing e.g. 2.34.0. cmdstanr::install_cmdstan()
will let you specify version = "2.34.0"
. That might work with the code you're trying to run.
@michaldanaj I wrote a more thorough guide to avoiding this issue here: https://github.com/stan-dev/rstan/issues/1133#issuecomment-2466698446
@jgabry I think we can close this issue since it's a dupe of #1133 so we can put any discussion about it there.
Thank you, @jgabry and @katrinabrock.
General solution from here worked for me.
Great, thank you!
Summary:
'n_kept not found' error during rstan::read_stan_csv(fit$output_files()).
Instead of fixing it, is it possible to change original code to make it work?
Description:
I try to run this code, but I get an error
It has already been mentioned in #1133, but please help me circumvent it.
Reproducible Steps:
To reproduce, I installed fresh conda environment with cmdstan, cmdstanr and rstan installed as adviced in getting started.
My code to reproduce:
Current Output:
Expected Output:
No error.
RStan Version:
2.35.0.9000
R Version:
R version 4.4.1 (2024-06-14)
rstan Version:
rstan version 2.35.0.9000 (Stan version 2.35.0)
cmdstanr Version:
This is cmdstanr version 0.8.1
Operating System:
Arch Linux Linux arch 6.11.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024 03:30:41 +0000 x86_64 GNU/Linux