The extractPriors function does not extract the correct values of the model hyperparameters.
In this reproducible example, the function is not able to extract the correct value for the prior in the var_1 linear component:
# Create some dummy data
trainData <- data.frame(
y <- sample(c(0, 1), size = 100, replace = TRUE),
var_1 <- rnorm(100)
)
# Define model components
components <- ~ Intercept(1) +
var_1(main = var_1, model = "linear", copy = NULL, mean.linear = 0, prec.linear = 0.05)
# Fit the model
model <- inlabru::bru(
components,
inlabru::like(
family = "binomial",
data = trainData,
formula = y ~ Intercept + var_1
)
)
# Extract hyperparameter information
priorParams <- INLAutils:::extractPriors(model)
# Prior precision for var_1 component
var_1_prec <- priorParams$prec[2]
var_1_prec # 0.001 (it should be 0.05)
The model is correctly using the input information for the var_1 precision prior, as it is demonstrated with:
model$all.hyper$linear[[2]]$prior.prec # 0.05
The
extractPriorsfunction does not extract the correct values of the model hyperparameters.In this reproducible example, the function is not able to extract the correct value for the prior in the
var_1linear component:The model is correctly using the input information for the
var_1precision prior, as it is demonstrated with: