# Considering spatial autocorrelation in hurdle model using brms

**URL:** <https://discourse.mc-stan.org/t/considering-spatial-autocorrelation-in-hurdle-model-using-brms/25368>\
**Category:** Modeling\
**Tags:** brms\
**Created:** [November 19, 2021, 7:49am UTC](https://discourse.mc-stan.org/t/considering-spatial-autocorrelation-in-hurdle-model-using-brms/25368 "2021-11-19T07:49:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marie\_stan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/marie_stan/32/12450_2.png) [@marie\_stan](https://discourse.mc-stan.org/u/marie_stan)\
**Post date:** [November 19, 2021, 7:49am UTC](https://discourse.mc-stan.org/t/considering-spatial-autocorrelation-in-hurdle-model-using-brms/25368/1 "2021-11-19T07:49:55Z")

</div>

I’m trying to construct a hurdle model considering spatial autocorrelations.  
But it returned an error; “Error: SAR terms are not implemented for this family.”

I search for examples applying SAR to hurdle model using brms, but there wasn’t. Does this error mean SAR has not been applied in hurdle models yet?

```
fbmodel <- brm(bf(total_2005 ~ 
                   Thickness.average + Depth.range + 
                    Depth.average +
                   sigma.BTM + sigma.S100 +
                   to.BTM + to.S100 + 
                   offset(totalnet_2005) 
                  + sar(fish.nb, type = "error"), 
                  hu ~
                    Thickness.average + Depth.range + 
                    Depth.average + 
                    sigma.BTM + sigma.S100 +
                    to.BTM + to.S100 ), 
                   data = ff,
                   data2 = list(fish.nb = fish.nb),
                   family = hurdle_lognormal(),
                   prior = c(set_prior("normal(0,10)", class = "b")),
                   warmup = 500,
                   iter = 1000,
                   chains = 4,
                   cores = 4,
                   inits = 0, 
                   save_all_pars = TRUE,
                   backend = "cmdstanr",
                   control = list(adapt_delta = 0.99, max_treedepth = 15),
                   save_model = "test_stanscript",
                   file = "test")

```

Thanks,
