Poisson response imputation compilation error

Open
#419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

The failure comes from the ulam model-list syntax, where a constrained vector declaration like vector<lower=0>[3147] lands inside the Stan model block and Stan rejects it. Start by reproducing the error with a minimal ulam model that declares a constrained vector of fixed length, then read how the package translates declarations into Stan code. Done means either the model compiles from the declared form or the docs and error message show the correct way to declare a bounded latent vector. No comments or pull request exist, so confirm the maintainer's expected syntax before changing anything.

Written by the indexing model from the issue text.

Description

Hi everyone,

I am trying to impute a response variable that ~Poisson or ~Gamma-Poisson but I get this compilation error probably because Stan doesn't like constraints in the model compartment.

25: model{
26: vector[3147] R_merge;
27: vector<lower=0>[3147] lambda;
^
28: phi ~ exponential( 1 );
29: D ~ normal( 0 , 3 );

Expected "[" expression "]" for vector size.

Is there any way to deal with this within the Ulam environment without having to hardcode everything into Stan? You cannot get the stancode() before the it compiles I believe, so ones has to write everything from scratch.

Thank you!

Dominant language
R
Stars
2.4k
Forks
632
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from rmcelreath/rethinking

All issues in rmcelreath/rethinking

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.