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
In a number of cases our error msgs are non-informative when no brackets are provided for non-scalars (see below) (note we are much better when brackets are provided but the indexing is missing). One possibility would be to write a little system to check code based on knowing dimensions of distribution values and parameters and knowing expected dimensions for various DSL functions.
m <- nimbleModel(code, inits = list(mn = rep(0, 2), I = diag(rep(0,2)), b = c(1,2), Z =matrix(rnorm(4),2)))
Error in parentExprReplaced[[iI + 2]] :
object of type 'symbol' is not subsettable
code <- nimbleCode({
b ~ dmnorm(mn, I)
})
m <- nimbleModel(code, inits = list(mn = rep(0, 2), I = diag(rep(1,2)), b = c(1,2)))
cm <- compileNimble(m)
Error: Error, sizeUnaryCwiseSquare was called with an argument that is not a matrix
m <- nimbleModel(code, inits = list(mn = rep(0, 2), I = diag(rep(1,2)), b = c(1,2), Z =matrix(rnorm(4),2)))
Error in if (is.numeric(v) && any(v < 0)) { :
missing value where TRUE/FALSE needed
The text was updated successfully, but these errors were encountered:
I fixed a portion of this. In some (but not all) cases if a RHS term is missing indexing we now tell the user that that variable might be the one needing indexing.
E.g., that works for
y[1:3]~dmulti(p,n)
y[1:3]~dmnorm(mu[1:3], prec)
but not for
p[1:3]~ddirch(alpha)
y[1:3]~dmnorm(mu, prec[1:3,1:3])
In a number of cases our error msgs are non-informative when no brackets are provided for non-scalars (see below) (note we are much better when brackets are provided but the indexing is missing). One possibility would be to write a little system to check code based on knowing dimensions of distribution values and parameters and knowing expected dimensions for various DSL functions.
Examples:
code <- nimbleCode({
b[1:2] ~ dmnorm(mn[1:2], I[1:2,1:2])
z <- Z%*%b
})
code <- nimbleCode({
b ~ dmnorm(mn, I)
})
code <- nimbleCode({
b ~ dmnorm(mn, I)
z[1:2] <- Z[1:2,1:2]%*%b[1:2]
})
The text was updated successfully, but these errors were encountered: