The inlabru syntax for model formulae is different from what
INLA::inla
considers a valid.
In inla most of the effects are defined by adding an f(...)
expression to
the formula.
In inlabru the f
is replaced by an arbitrary (exceptions: const
and
offset
) string that will determine the label of the effect. See Details for
further information.
Arguments
- components
A component_list object
- lhoods
A list of one or more
lhood
objects- object
Object to operate on
- ...
Arguments passed on to other methods
- x
A
summary_bru_model
object to be printed
Details
For instance
y ~ f(myspde, ...)
in INLA is equivalent to
y ~ myspde(...)
in inlabru.
A disadvantage of the inla way is that there is no clear separation between
the name of the covariate and the label of the effect. Furthermore, for some
models like SPDE it is much more natural to use spatial coordinates as
covariates rather than an index into the SPDE vertices. For this purpose
inlabru provides the main
argument. For convenience, the main
argument
can be used like the first argument of the f function, e.g., and is the first
argument of the component definition.
The INLA
model formula
y ~ f(temperature, model = 'linear')
is equivalent to the inlabru
component and formula definition
y ~ temperature(temperature, model = 'linear')
and
y ~ temperature(main = temperature, model = 'linear')
as well as
y ~ temperature(model = 'linear')
which sets main = temperature
.
On the other hand, main
can also be a function mapping, e.g the
sp::coordinates()
function:
y ~ mySPDE(coordinates, ...)
This extracts the coordinates from the data object, and maps it to the latent
field via the information given in the mapper
, which by default is
extracted from the model
object, in the case of spde
model objects.
Morevover, main
can be any expression that evaluates within your data as an
environment.
For instance, if your data has columns 'a' and 'b', you can create a fixed
effect of 'sin(a+b)' by setting map
in the following way:
y ~ myEffect(sin(a+b))