inla.Rdinla performs a full Bayesian analysis of additive models using
Integrated Nested Laplace approximation
inla(
formula = NULL,
family = "gaussian",
contrasts = NULL,
data = NULL,
quantiles = c(0.025, 0.5, 0.975),
E = NULL,
offset = NULL,
scale = NULL,
weights = NULL,
Ntrials = NULL,
strata = NULL,
lp.scale = NULL,
link.covariates = NULL,
verbose = inla.getOption("verbose"),
lincomb = NULL,
selection = NULL,
control.compute = list(),
control.predictor = list(),
control.family = list(),
control.inla = list(),
control.fixed = list(),
control.mode = list(),
control.expert = list(),
control.hazard = list(),
control.lincomb = list(),
control.update = list(),
control.lp.scale = list(),
control.pardiso = list(),
control.stiles = list(),
control.taucs = list(),
control.numa = list(),
only.hyperparam = FALSE,
inla.call = inla.getOption("inla.call"),
inla.arg = inla.getOption("inla.arg"),
num.threads = inla.getOption("num.threads"),
keep = inla.getOption("keep"),
working.directory = inla.getOption("working.directory"),
silent = inla.getOption("silent"),
inla.mode = inla.getOption("inla.mode"),
safe = inla.getOption("safe"),
debug = inla.getOption("debug"),
.parent.frame = environment(formula)
)A inla formula like y ~1 + z + f(ind, model="iid") + f(ind2, weights, model="ar1") This is much like the formula
for a glm except that smooth or spatial terms can be added to the
right hand side of the formula. See f() for full details and
the web site www.r-inla.org for several worked out
examples. Each
smooth or spatial term specified through f should correspond to
separate column of the data frame data. The response variable,
y can be a univariate response variable, a list or the output of the
function inla.surv() for survival analysis models.
A string indicating the likelihood family. The default is
gaussian with identity link. See
names(inla.models()$likelihood) for a list of possible alternatives
and use inla.doc() for detailed docs for individual families.
Optional contrasts for the fixed effects; see ?lm or
?glm for details.
A data frame or list containing the variables in the model. The data frame MUST be provided
A vector of quantiles, \(p(0), p(1),\dots\) to compute for each posterior marginal. The function returns, for each posterior marginal, the values \(x(0), x(1),\dots\) such that $$\mbox{Prob}(X<x(p))=p$$
Known component in the mean for the Poisson likelihoods defined as
$$E_i\exp(\eta_i)$$ where $$\eta_i$$ is the linear
predictor. If not provided it is set to rep(1, n.data).
This argument is used to specify an a-priori known and fixed
component to be included in the linear predictor during fitting. This
should be NULL or a numeric vector of length either one or equal to
the number of cases. One or more offset() terms can be included in
the formula instead or as well, and if both are used, they are combined into
a common offset. If the A-matrix is used in the linear predictor
statement control.predictor, then the offset given in this
argument is added to eta*, the linear predictor related to the
observations, as eta* = A eta + offset, whereas an offset in the
formula is added to eta, the linear predictor related to the formula,
as eta = ... + offset.formula. So in this case, the offset defined
here and in the formula has a different meaning and usage.
Fixed (optional) scale parameters of the precision for Gaussian
and Student-T response models. Default value is rep(1, n.data).
Fixed (optional) weights parameters of the likelihood, so the
log-likelihood[i] is changed into weights[i]*log-likelihood[i]. Default
value is rep(1, n.data). WARNING: The normalizing constant for the
likelihood is NOT recomputed, so ALL marginals (and the marginal likelihood)
must be interpreted with great care.
A vector containing the number of trials for the
binomial likelihood and variantes, or the number of required
successes for the nbinomial2 likelihood. Default value is
rep(1, n.data).
Fixed (optional) strata indicators for tstrata likelihood model and similar. The documentation for each likelihood will inform if this argument is required.
A vector with same length as the predictor going into the
likelihood with either NA's or indices indexing the scaling
coefficients. NA or a index less or equal to 0 means no scaling. The
priors and properties of the scaling coefficients are set in
control.lp.scale. Note that only the non-offset part of the
linear predictor is scaled. This is an EXPERIMENTAL option.
A vector or matrix with covariates for link functions
Boolean indicating if the inla-program should run in a
verbose mode (default inla.getOption("verbose"))
Used to define linear combination of nodes in the latent
field. The posterior distribution of such linear combination is computed by
the inla function. See vignette Short tutorials from old www-page for information on how to define such linear combinations.
This is a similar argument to the one in
inla.posterior.sample and follow the same format. This argument
allows to define a subset of the latent field for which to compute an
approximated joint distribution. It will appear in result$selection.
See also ?inla.rjmarginal and the approriate vignette.
See ?control.compute
See ?control.family
See ?control.inla
See ?control.fixed
See ?control.mode
See ?control.expert
See ?control.hazard
See ?control.lincomb
See ?control.update
See ?control.pardiso
See ?control.stiles
See ?control.taucs
See ?control.numa
If TRUE, then only the hyperparameters are
computed.
The path to, or the name of, the inla-program. This
is program is installed together with the R-package, but, for
example, a native compiled version can be used instead to improve the
performance.
A string indicating ALL arguments to the 'inla' program and do not include default arguments. (This is an expert option and not intended for normal usage.)
Maximum number of threads the inla-program will
use, or as 'A:B' defining the number threads in the outer (A) and inner (B)
layer for nested parallelism. If B is set to -1, then one can force some
single function evaluations to be perfored in parallel, so
num.threads=4:-1 will locally behave like num.threads=4:1 (if
considered to be more efficient). If B > 1 then
num.threads=A:B and num.threads=A:-B are equivalent.
A boolean variable indicating that the working files (ini file,
data files and results files) should be kept. If TRUE and no
working.directory is specified, the model-files are stored in the
current directory called "inla.model" or "inla.model-NUMBER".
A string giving the name of an non-existing
directory where to store the model-files. Sometimes this argument is
required if the temporary directory returned with tempdir() not
writeable or has an encoding that is not supported.
If equal to 1L or TRUE, then the inla-program would be
“silent”. If equal to 2L, then supress also error messages from the
inla-program.
Run inla in compact-mode, or the
classic-mode. Default is to use the mode set by
inla.getOption("inla.mode") which is default compact-mode.
If TRUE, then enable possible restarts to improve initial
values and Hessian if needed.
If TRUE, print some debug output.
Internal use only
inla returns an object of class "inla". This is a
list containing at least the following arguments:
Matrix containing the mean and standard deviation (plus, possibly quantiles and cdf) of the the fixed effects of the model.
A list containing the posterior marginal densities of the fixed effects of the model.
List of matrices
containing the mean and standard deviation (plus, possibly quantiles and
cdf) of the the smooth or spatial effects defined through f().
A list containing the posterior marginal densities
of the random effects defined through f.
A matrix containing the mean and sd (plus, possibly quantiles and cdf) of the hyperparameters of the model
A list containing the posterior marginal densities of the hyperparameters of the model.
A matrix containing the mean and sd (plus, possibly quantiles and cdf) of the linear predictors \(\eta\) in the model
If compute=TRUE in
control.predictor, a list containing the posterior marginals of the
linear predictors \(\eta\) in the model.
A matrix containing the mean and sd (plus, possibly quantiles and cdf) of
the fitted values \(g^{-1}(\eta)\) obtained by transforming the linear
predictors by the inverse of the link function. This quantity is only
computed if marginals.fitted.values is computed. Note that if an
observation is NA then the identity link is used. You can manually
transform a marginal using inla.marginal.transform() or set the
argument link in the control.predictor-list; see
?control.predictor
If
compute=TRUE in control.predictor, a list containing the
posterior marginals of the fitted values \(g^{-1}(\eta)\) obtained by
transforming the linear predictors by the inverse of the link function.
Note that if an observation is NA then the identity link is used. You
can manually transform a marginal using inla.marginal.transform() or
set the argument link in the control.predictor-list; see
?control.predictor
If lincomb != NULL a list of matrices containing the mean and sd (plus, possibly
quantiles and cdf) of all linear combinations defined.
If lincomb != NULL a list of posterior
marginals of all linear combinations defined.
Provide
the approximated joint distribution for the selection
If
dic=TRUE in control.compute, the deviance information
criteria and effective number of parameters, otherwise NULL
If cpo=TRUE in control.compute, a list of
three elements: cpo$cpo are the values of the conditional predictive
ordinate (CPO), cpo$pit are the values of the probability integral
transform (PIT) and cpo$failure indicates whether some assumptions
are violated. In short, if cpo$failure[i] > 0 then some assumption is
violated, the higher the value (maximum 1) the more seriously.
If po=TRUE in control.compute, a list of one elements:
po$po are the values of the predictive ordinate (CPO)
(pi(yi|y))
If residuals=TRUE in
control.compute, a list of standardized residuals are provided, see
?control.compute for details
If
waic=TRUE in control.compute, a list of two elements:
waic$waic is the Watanabe-Akaike information criteria, and
waic$p.eff is the estimated effective number of parameters
If mlik=TRUE in control.compute, the log
marginal likelihood of the model (using two different estimates), otherwise
NULL
Expected effective number of parameters in the model. The standard deviation of the expected number of parameters and the number of replicas for parameter are also returned
A list of
two elements: mode$theta is the computed mode of the hyperparameters
and mode$x is the mode of the latent field given the modal value of
the hyperparameters.
The matched call.
The formula supplied
The number of hyperparameters in the model
The cpu time used by the inla function