Problem with defining imputed variable as a vector in generated stan code
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- Over a week
- Newbie friendliness
- 18/100
Research direction
The report points at the loop over right_symbols in the ulam code generator, where symbols are indexed with ii but a parameter's dims are read from symbols[[j]]. Reproducing it needs a model with an imputed variable used in a local vector expression, which the reporter has not supplied. The work is already a year old with no decision, so it needs a maintainer's view of intended behaviour before any fix.
Written by the indexing model from the issue text.
Description
I have an occasional issue In which the stan code does not identify a local variable as a vector when it depends on an imputed variable. I believe there is a bug the ulam code that is causing it. Below ii is the iterator for right_symbols but is used to index symbols on the third line. I tried changing the code to define j before that if statement, then index symbols with j, but it still resulted in the same error. I can keep chasing the issue, but I wanted to make sure I am not missing something. Let me know if you want me to generate something that reproduces the error.
for (ii in 1:length(right_symbols)) {
if (right_symbols[ii] %in% names(symbols)) {
if (symbols[[ii]]$type == "par") {
j <- which(names(symbols) == right_symbols[ii])
if (any(!is.na(symbols[[j]]$dims))) {
zzdims <- 0
if (length(symbols[[j]]$dims) == 1)
zzdims <- 1
else zzdims <- symbols[[j]]$dims[[2]]
the_dims <- max(the_dims, zzdims, na.rm = TRUE)
}
}
}
}
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rmcelreath/rethinking
-
Typo: p.381Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
rmcelreath/rethinking#482 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rmcelreath/rethinking#476 ·
-
Typo: p.302Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rmcelreath/rethinking#475 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
rmcelreath/rethinking#474 ·
-
Comma splice: p.557Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rmcelreath/rethinking#471 ·
All issues in rmcelreath/rethinking
Similar issues
-
1.7
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pharmaverse/admiral#3235 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SticsRPacks/CroPlotR#185 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day