Hello,
I’m implementing a preferential sampling model based on the framework
Pati, Reich, and Dunson (2011). In this approach, I jointly model the spatial point process (representing the sampling locations) and the continuous outcome, linking them through a shared spatial field that accounts for the preferential sampling mechanism. The joint model has two components:
Intensity model : \Lambda(x) = \exp{\alpha + S_1(x)}
Observational model: Y_i = \mu + \beta S_1(x_i) + S_2(x_i) + Z_i
Where S_1 and S_2 are two independent Gaussian processes and the parameter \beta controls the degree of preferentiality in the sampling of the Y_i.
I wanted to ask how I can specify \beta S_1(x_i) in the model components. I have tried using copy = "S1" and fixed = FALSE, but the model runs very slowly, and I have to stop it before it finishes. Is this the correct way to implement it, or is there a more efficient approach?
```
intensity_model <- bru_obs(
family = "cp",
formula = geometry ~
Intercept_intensity +
S1,
domain = list(geometry = mesh),
data = dm_shp,
tag = "Intensity"
)
yi_model <- bru_obs(
"gaussian",
formula = y_i ~
Intercept_obs +
beta +
S2 +
epsilon,
data = dm_shp,
tag = "Observations"
)
cmp <- ~
Intercept_intensity(1) +
Intercept_obs(1) +
S1(main = geometry, model = spde_intensity) +
beta(main = geometry, copy = "S1", fixed = FALSE) +
S2(main = geometry, model = spde_y) +
epsilon(ID, model = "iid")
mod <- bru(
cmp,
intensity_model,
yi_model,
options = list(
control.inla = list(
int.strategy = "eb"
),
bru_max_iter = 1,
num.threads = "5:1"
)
)
```