inference_inla {makemyprior} | R Documentation |
Run inference
Description
This function helps you run inference with INLA using a prior object from make_prior.
You must have INLA installed to run this. INLA can be installed with:
install.packages("INLA", repos = c(getOption("repos"), INLA = "https://inla.r-inla-download.org/R/stable"), dep = TRUE)
.
Also see r-inla.org.
Usage
inference_inla(prior_obj, use_likelihood = TRUE, print_prior = TRUE, ...)
Arguments
prior_obj |
An object from make_prior, from makemyprior_gui, from inference_stan, or from inference_inla (for refitting model) |
use_likelihood |
Whether to sample from the prior only (FALSE, can be used for e.g. debugging or to look at the priors on variance parameters when using an HD prior, see also Details), or to use the likelihood and data to get the posterior (TRUE, default). |
print_prior |
Whether to print a text with the chosen prior or not (default TRUE) |
... |
Other values to be sent to INLA.
Useful arguments include |
Details
Jeffreys' prior is improper. If use_likelihood = FALSE
and Jeffreys' prior is used for the total variance, the prior will be changed to a Gaussian(0,1) prior on
the log total variance. This means that it does not make sense to look at the variances/standard deviations/precisions,
but the variance proportions will be correct. Note that this is only an issue when sampling from the prior
(i.e., not using the likelihood).
Value
A named list with a prior object (prior
), an inla-object (inla
) and some data inla requires (inla_data
).
Examples
## Not run:
vignette("make_prior", package = "makemyprior")
## End(Not run)
ex_prior <- makemyprior_example_model()
if (interactive() && requireNamespace("INLA")){
posterior <- inference_inla(ex_prior)
plot(posterior)
}