Skip to content

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

Description

@paciorek

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions