| spatial_car_proper | R Documentation |
Convenience wrapper for spatial_car(..., proper = TRUE). Creates a
proper conditional autoregressive (CAR) spatial random effect with the
autocorrelation parameter rho estimated from the data.
Use this when you want spatial autocorrelation to be a parameter of the model rather than fixed at 1 (as in ICAR). rho ~= 0 collapses to IID, rho ~= 1 approaches ICAR.
spatial_car_proper(
adjacency,
level = c("group", "obs"),
group_var = NULL,
shared = NULL
)
adjacency |
Symmetric adjacency matrix ( |
level |
Either |
group_var |
Name of the grouping variable in the data; required
when |
shared |
Optional shared-effect handle (see model docs). |
A tulpa_spatial object with type = "car_proper".
spatial_car() for ICAR (rho fixed at 1),
spatial_bym2() for the BYM2 decomposition.
adj <- matrix(0, 10, 10)
for (i in 1:9) adj[i, i+1] <- adj[i+1, i] <- 1
spec <- spatial_car_proper(adj, level = "group", group_var = "site")
print(spec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.