Skip to content

Exception: no more scalars to read with sum_to_zero_vector #3366

@mhollanders

Description

@mhollanders

Good day,

I've written a Stan program that takes in an indicator int<lower=0, upper=1> NB to toggle between Poisson and negative binomial models.

I model the overdispersion terms hierarchically and In the parameters block, I define:

parameters {
  vector<lower=0>[NB] phi_a, phi_t;  // NB overdispersion intercept and scale
  sum_to_zero_vector[NB* S] phi_z;  // overdispersion z-scores
}

When NB = 0 I get the following error and the program fails to run:

Exception: no more scalars to read

When I remove the indicator and replace it with

parameters {
  sum_to_zero_vector[S] phi_z;  // overdispersion z-scores
}

It works fine. I tried to create a reprex to isolate the issue but didn't manage.

Cheers,

Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions