epinowcast / primarycensored

Primary event censored distributions.
https://primarycensored.epinowcast.org/
Other
7 stars 1 forks source link

How to define empty array for Stan #170

Open athowes opened 3 days ago

athowes commented 3 days ago

I'm unsure about this but in the documentation it suggests using this for empty array for primary_params:

https://github.com/epinowcast/primarycensored/blob/d65f69c4722508919142ae12df8ca61d1f1deb09/inst/stan/functions/primarycensored.stan#L78

When I try compling something like that with Stan I get:

Compiling Stan program...
Syntax error in '/var/folders/4r/hkp4v9fn3wx044_hk8qnsjxw0000gn/T/RtmpD3IIlw/model-fe643c985a5a.stan', line 12, column 34 to column 35, parsing error:
   -------------------------------------------------
    10:    real D = positive_infinity();
    11:    int primary_id = 1; // Uniform
    12:    array[0] real primary_params = {};
                                           ^
    13:    return primarycensored_lpmf(d | dist_id, params, pwindow, d_upper, D, primary_id, primary_params);
    14:  }
   -------------------------------------------------

Expression expected after "{" in array expression.

make: *** [/var/folders/4r/hkp4v9fn3wx044_hk8qnsjxw0000gn/T/RtmpD3IIlw/model-fe643c985a5a.hpp] Error 1

Error: An error occured during compilation! See the message above for more information.

If it's not valid syntax suggest change to documentation.

seabbs commented 2 days ago

We should update it to: https://mc-stan.org/docs/reference-manual/expressions.html#vector-matrix-array-expressions.section