bug in the csv files
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
The CSV files generated by the sampling function contain duplicated lines.
Description:
I run sampling with the sample_file argument. This generates CSV files containing the simulations. These files contain duplicated lines, just after the warm-up.
Reproducible Steps:
library(rstan)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
# stan model
stancode <- 'data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // s.e. of effect estimates
}
parameters {
real mu;
real<lower=0> tau;
real eta[J];
}
transformed parameters {
real theta[J];
for (j in 1:J)
theta[j] = mu + tau * eta[j];
}
model {
eta ~ normal(0, 1);
y ~ normal(theta, sigma);
}'
# compile model
stanmodel <- stan_model(model_code = stancode, model_name="schools")
# stan data
standata <- list(J = 4,
y = c(28, 8, -3, 7),
sigma = c(15, 10, 16, 11))
# sampling
samples <- sampling(stanmodel, data = standata,
iter = 1500, warmup = 500, chains = 4,
sample_file="stansamples")
Current Output:

RStan Version:
_rstan version 2.12.1_
R Version:
R version 3.3.1 (2016-06-21)
Operating System:
Ubuntu 14.04
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided RStan example, focusing on sampling(..., sample_file="stansamples") and the generated CSV files immediately after warm-up. Compare the output across the four chains and confirm that the completed files contain no duplicated simulation lines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100