You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
}
}
}
}
The text was updated successfully, but these errors were encountered:
The example below causes the error. I explored a bit more this morning and it seems to only happen when I use a subscript in the name of the coefficient (i.e., if I use beta in place of beta_x below, it works).
dat <- list(
y =rnorm(100, .5, .2),
x=rnorm(100, 0, 1)
)
dat$x[sample(100, 2)] <- NA
mod <- alist(
y ~ dnorm(mu, sigma),
mu <- gm + beta_x * x,
gm ~ dnorm(.5, .3),
beta_x ~ dnorm(0,1),
x ~ dnorm(0,1),
sigma ~ dexp(1)
)
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)
}
}
}
}
The text was updated successfully, but these errors were encountered: