Skip to content

user guide's page 241- Unmapped Implementation error #1

Closed

Description

@bob-carpenter

From @bnicenboim on December 2, 2018 12:21

Line 8 of the unmapped implementation in the user guide's page 241 has this line:
vector[2] beta[K];

And this produces the following error:

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

No matches for: 

  real[] .* vector

Available argument signatures for operator.*:

  vector .* vector
  row vector .* row vector
  matrix .* matrix

No matches for: 

  real[] + ill formed

Available argument signatures for operator+:

  int + int
  real + real
  vector + vector
  row vector + row vector
  matrix + matrix
  vector + real
  row vector + real
  matrix + real
  real + vector
  real + row vector
  real + matrix
  +int
  +real
  +vector
  +row vector
  +matrix

Expression is ill formed
  error in 'model1a7a481d4cfe_no_map_rect' at line 18, column 53
  -------------------------------------------------
    16:   for (i in 1:2)
    17:     beta[ , i] ~ normal(mu[i], sigma[i]);
    18:   y ~ bernoulli_logit(beta[kk, 1] + beta[kk, 2] .* x);
                                                            ^
    19: }
  -------------------------------------------------

I'm pretty sure that this line should be matrix[K, 2] beta;
which fixes the error.

Current Version:

v2.18.0

Copied from original issue: stan-dev/stan#2707

Activity

  1. mitzimorris commented on Dec 18, 2018

    @mitzimorris
    Member

    shouldn't this be:

    y ~ bernoulli_logit(to_vector(beta[kk, 1]) + to_vector(beta[kk, 2]) .* x) ?

  2. bob-carpenter commented on Dec 18, 2018

    @bob-carpenter
    MemberAuthor

    @mitzimorris That, or change the underlying types so to_vector isn't needed.

    Also, there's another bug in the error message---it backtracked from the correct parse to an ill-formed one.

  3. added a commit that references this issue on Dec 19, 2018
  4. mitzimorris commented on Dec 19, 2018

    @mitzimorris
    Member

    fixed by commit d514b28

  5. mitzimorris commented on Dec 20, 2018

    @mitzimorris
    Member

    change the underlying types so to_vector isn't needed.

    left underlying types alone so that parameters line up with those of mapped version.

  6. added a commit that references this issue on Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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