4.1 Linear predictor (LP)
library(INLA)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Loading required package: foreach
##
## Attaching package: 'foreach'
## The following objects are masked from 'package:purrr':
##
## accumulate, when
## Loading required package: parallel
## This is INLA_22.12.16 built 2022-12-23 13:24:10 UTC.
## - See www.r-inla.org/contact-us for how to get help.
## - To enable PARDISO sparse library; see inla.pardiso()
library(ggplot2)
- step one: writing linear predictor as an R formula
\[Response \quad variable \sim fixed + random \quad effect\]
Random effect are put inside f()
with a name of model arguments (“iid”)
\[\eta_i = \beta_o + \beta_1x_1 + \beta_2x_2 + u_i \]
\[u_i \sim N(0, \sigma^2_u) \]
~ x1 + x2 + f(i, model = "iid") y
~ 0 = b0 + x1 + x2 + f(i, model = "iid") y