Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjustr does not work with hurdle Poisson model in brms package #1

Closed
rpetrovska opened this issue Jun 20, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@rpetrovska
Copy link

I could not make adjustr work with a hurdle Poisson model in brms package.
My model is:

data1=data %>% mutate(ba_sqrt = sqrt(ba_median.p),dbh_log = log(dbh_median.p))
d = data1 %>% filter(species.p =="Acer platanoides" | species.p=="Acer pseudoplatanus" |species.p=="Fagus sylvatica" | species.p=="Ulmus glabra",
                      species.m =="Acer platanoides" | species.m=="Acer pseudoplatanus" |species.m=="Fagus sylvatica")
d$y=as.factor(d$year)
d$subplot=as.factor(d$subplot_id)
d$id=as.factor(d$id.m)

p1=c(prior_string("student_t(5,0,0.35)", class="Intercept"),
     prior("normal(0,0.2", class="b"),
     prior("student_t(5,0,0.21)", class="sd"),
     prior("logistic(-3,0.03)", class="Intercept", dpar="hu"),
     prior("normal(0,0.03", class="b", dpar="hu"),
     prior("student_t(5,0,0.03)", class="sd", dpar="hu"))

f2=brmsformula(count~ba_sqrt+dbh_log+species.p+species.m+dead_neigbour+y+(1+y|subplot_id)+(1|id.m),
               hu~ba_sqrt+species.p+y+(1+y|subplot_id)+(1|id.m), center=TRUE, decomp="QR")
fit2=brm(f2, data=d, family=hurdle_poisson(link = "log"), save_pars=save_pars(all = TRUE), cores  = 4, iter = 1000 + 4000, warmup = 1000, chains = 4, seed=123,
         sample_prior="yes",prior=p1, silent=TRUE, open_progress=FALSE, control = list(adapt_delta = 0.85, max_treedepth = 10))

extract_samp_stmts(fit2) # or
extract_samp_stmts(fit2$fit)

gives
Error in str2lang(x) : :1:30: unexpected '['
1: Y ~ hurdle_poisson_log_logit([
^

Enclosed is my data - https://drive.google.com/file/d/1HUMvG89pjNnQ-NNX-tlU6MFLCX_ci97y/view?usp=sharing

@CoryMcCartan CoryMcCartan self-assigned this Jun 21, 2021
@CoryMcCartan CoryMcCartan added the bug Something isn't working label Jun 21, 2021
@CoryMcCartan
Copy link
Owner

Thanks for filing! This is now fixed in the development version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants