Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runLaplace with uncompiled Laplace object fails (gr_logLik_pTransformed not found) #1498

Open
paciorek opened this issue Oct 20, 2024 · 0 comments
Labels

Comments

@paciorek
Copy link
Contributor

It's fine for compiled Laplace object, so this is simply a minor cleanup issue.

model_code <- nimbleCode({
# priors
intercept ~ dnorm(0, sd = 100)
beta ~ dnorm(0, sd = 100)
sigma ~ dhalfflat()
# random effects and data
for(i in 1:10) {
# random effects
ran_eff[i] ~ dnorm(0, sd = sigma)
for(j in 1:5) {
# data
y[i,j] ~ dpois(exp(intercept + beta*X[i,j] + ran_eff[i]))
}
}
})

set.seed(123)
X <- matrix(rnorm(50), nrow = 10)
model <- nimbleModel(model_code, constants = list(X = X), calculate = FALSE,
buildDerivs = TRUE) # Here is the argument needed for AD.
model$intercept <- 0
model$beta <- 0.2
model$sigma <- 0.5
model$calculate()
model$simulate(model$getDependencies('ran_eff'))
model$calculate()
model$setData('y')
glmm_laplace <- buildLaplace(model, c('intercept','beta','sigma'))
runLaplace(glmm_laplace, c(0,0,1))
#  [Warning] Running an uncompiled Laplace or AGHQ algorithm. Use compileNimble() for faster execution.
#Error in optimize(pStart = pStart, method = method, hessian = hessian,  : 
 # object 'gr_logLik_pTransformed' not found
@paciorek paciorek added the bug label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant