stan-dev / stan-dev/stanc3

pedantic mode incorrectly warning about 2 priors?

Open
#746 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
OCaml
Stars
160
Forks
59
Avg merge
21h 45m
Merged PRs (30d)
26

Description

@rybern Using the latest CmdStanR from github I was trying out pedantic mode (which is really cool!) and I got an unexpected warning:


stan_file <- write_stan_file(
"parameters {
  real x;
  real sigma;
}
model {
  x ~ normal(0, sigma);
  sigma ~ exponential(1);
}"
)
mod <- cmdstan_model(stan_file, stanc_options = list("warn-pedantic"=TRUE))
Compiling Stan program...
Warning:
  The parameter sigma has 2 priors.
Warning at '/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/RtmpwDnKa2/model-e66b730e6be7.stan', line 6, column 16 to column 21:
  A normal distribution is given parameter sigma as a scale parameter
  (argument 2), but sigma was not constrained to be strictly positive.
Warning at '/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/RtmpwDnKa2/model-e66b730e6be7.stan', line 7, column 2 to column 7:
  Parameter sigma is given a exponential distribution, which has strictly
  positive support, but sigma was not constrained to be strictly positive.

The second two warnings make sense but the first one about sigma having 2 priors isn't correct. There's only one prior on sigma. Is this a bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning with the R and Stan snippet in the issue using stanc3 pedantic mode. Trace the pedantic warning that reports two priors and determine why it counts sigma twice. Done means the example reports only the valid support warnings while preserving the other diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml, r
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.