'reject' stan command conflicts with UCBadmit data

Open
#413 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
r
Domain
data

Research direction

The failure comes from the reject column of the bundled UCBadmit dataset, which Stan treats as a reserved word when ulam generates the data block. Find where UCBadmit is defined in the package (its data file or data-raw script) and check whether the column is used elsewhere in the examples. Rename it, rebuild the dataset, then run the ulam example from the issue to confirm it compiles.

Written by the indexing model from the issue text.

Description

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 UCBadmit data should be remaned to avoid this.

Dominant language
R
Stars
2.4k
Forks
632
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rmcelreath/rethinking

All issues in rmcelreath/rethinking

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.