docs icon indicating copy to clipboard operation
docs copied to clipboard

normal_id_glm signature missing

Open andrjohns opened this issue 4 years ago • 8 comments

According to the documentation one of the signatures for normal_id_glm is:

real normal_id_glm_lpdf(vector y | row_vector x, real alpha, vector beta, real sigma)

But this signature is not available in 2.26:

library(cmdstanr)
#> This is cmdstanr version 0.1.3
#> - Online documentation and vignettes at mc-stan.org/cmdstanr
#> - CmdStan path set to: /home/andrew/.cmdstanr/cmdstan-2.26.0
#> - Use set_cmdstan_path() to change the path

mod = "data {
  int<lower=0> N;
  vector<lower=0, upper=200>[N] kid_score;
  row_vector<lower=0, upper=1>[N] mom_hs;
}
parameters {
  real alpha;
  vector[1] beta;
  real<lower=0> sigma;
}
model {
  sigma ~ cauchy(0, 2.5);
  target += normal_id_glm_lpdf(kid_score | mom_hs, alpha, beta, sigma);
}
"
mod = cmdstan_model(write_stan_file(mod))
#> Compiling Stan program...
#> 
#> Semantic error in '/tmp/RtmpmtAWHQ/model-1ec5266a7c73.stan', line 13, column 12 to column 70:
#>    -------------------------------------------------
#>     11:  model {
#>     12:    sigma ~ cauchy(0, 2.5);
#>     13:    target += normal_id_glm_lpdf(kid_score | mom_hs, alpha, beta, sigma);
#>                      ^
#>     14:  }
#>     15:
#>    -------------------------------------------------
#> 
#> Ill-typed arguments supplied to function 'normal_id_glm_lpdf'. Available signatures:
#> (real, matrix, real, vector, vector) => real
#> (real, matrix, vector, vector, vector) => real
#> (vector, row_vector, real, vector, vector) => real
#> (vector, row_vector, vector, vector, vector) => real
#> (vector, matrix, real, vector, real) => real
#> (vector, matrix, vector, vector, real) => real
#> Instead supplied arguments of incompatible type: vector, row_vector, real, vector, real.
#> 
#> make: *** [make/program:53: /tmp/RtmpmtAWHQ/model-1ec5266a7c73.hpp] Error 1
#> Error: An error occured during compilation! See the message above for more information.

Created on 2021-02-01 by the reprex package (v0.3.0)

andrjohns avatar Feb 01 '21 15:02 andrjohns

The exposed signatures are:

normal_id_glm_lpdf(real, matrix, real, vector, vector) => real
normal_id_glm_lpdf(real, matrix, vector, vector, vector) => real
normal_id_glm_lpdf(vector, row_vector, real, vector, vector) => real
normal_id_glm_lpdf(vector, row_vector, vector, vector, vector) => real
normal_id_glm_lpdf(vector, matrix, real, vector, real) => real
normal_id_glm_lpdf(vector, matrix, vector, vector, real) => real

stanc2 supported

normal_id_glm_lpdf(vector, matrix, real, vector, real) => real
normal_id_glm_lpdf(vector, matrix, vector, vector, real) => real

rok-cesnovar avatar Feb 01 '21 16:02 rok-cesnovar

What we need to check here is whether this is maybe a docs error as opposed to a missing signature.

@t4c1 you were involved with some of these broadcast discussion. Do you remember anything about this?

rok-cesnovar avatar Feb 01 '21 16:02 rok-cesnovar

All I remember is that Math supports many signatures that are not exposed.

t4c1 avatar Feb 01 '21 16:02 t4c1

Huh, it looks like most of the signatures don't line up with the documentation.

These are the current Stanc3 signatures for real y outcome:

(real | matrix, real, vector, vector)
(real | matrix, vector, vector, vector)

These are the signatures in the documentation:

(real | matrix, real, vector, real)
(real | matrix, vector, vector, real)

The Stanc3 signatures for vector y outcome with row_vector x:

(vector | row_vector, real, vector, vector) 
(vector | row_vector, vector, vector, vector)

And the documentation:

(vector | row_vector, real, vector, real)
(vector | row_vector, vector, vector, real)

andrjohns avatar Feb 03 '21 11:02 andrjohns

I can update the signatures and/or doc, just need to decide what the signatures should be

andrjohns avatar Feb 03 '21 11:02 andrjohns

The docs was added after exposing the signatures (I went and checked) so this looks like a docs issue to me.

rok-cesnovar avatar Feb 03 '21 11:02 rok-cesnovar

Moved this to docs.

rok-cesnovar avatar Feb 15 '21 13:02 rok-cesnovar

@andrjohns do you still see the same mismatch between signatures and doc?

avehtari avatar May 30 '24 11:05 avehtari