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 (exception: offset
) string that will
determine the label of the effect. See Details for further information.
bru_model(components, lhoods)
A bru_model object
A component_list object
A list of one or more lhood
objects
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 new main
agument. 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.
y ~ f(temperature, model = 'linear')
is equivalent to
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, map can also be a function mapping, e.g the coordinates function of the sp package :
y ~ mySPDE(coordinates, ...)
This exctract 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))