rmcelreath / rethinking

Statistical Rethinking course and book package
2.1k stars 596 forks source link

'reject' stan command conflicts with UCBadmit data #413

Open bjbarrett opened 8 months ago

bjbarrett commented 8 months ago

Was going thru the examples on the github page. Running this code:

data( UCBadmit )
UCBadmit$male <- as.integer(UCBadmit$applicant.gender=="male")
UCBadmit$dept <- rep( 1:6 , each=2 )
UCBadmit$applicant.gender <- NULL

m_glmm1 <- ulam(
    alist(
        admit ~ binomial(applications,p),
        logit(p) <- a[dept] + b*male,
        a[dept] ~ normal( abar , sigma ),
        abar ~ normal( 0 , 4 ),
        sigma ~ half_normal(0,1),
        b ~ normal(0,1)
    ), data=UCBadmit )

I got this error:

Syntax error in '/var/folders/xy/d1z300jj79j9swfc9hkg6v1h0000gq/T/Rtmpip9UOG/model-180f658fd6385.stan', line 2, column 18 to column 24, parsing error:
   -------------------------------------------------
     1:  data{
     2:      array[12] int reject;
                           ^
     3:      array[12] int applications;
     4:      array[12] int admit;
   -------------------------------------------------

Expected a new identifier but found reserved keyword 'reject'.

make: *** [/var/folders/xy/d1z300jj79j9swfc9hkg6v1h0000gq/T/Rtmpip9UOG/model-180f658fd6385.hpp] Error 1

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

I think the reject column in the UCBadmitdata should be remaned to avoid this.