Logit transformation of parameters in non-linear binomial model

Hi,

If I got it right, there is no intercept in the model below thanks to +0, and the parameters for species are bounded on [0,1] thanks to the lb and ub in the prior() function. Therefore, there is no issue with the identity link.

brm(counts | trials(n) ~ species + 0, 
         family = binomial(link = 'identity'), data, priors = 
            prior(beta(2,2), class = 'b', ub = 1, lb = 0))

Meanwhile, in the following model, there is an intercept, and you may end up with Intercept + b_{species s} > 1 which might trigger the issues you are pinpointing in your post because of the identity link?

brm(counts | trials(n) ~ species, 
         family = binomial(link = 'identity'), data,  priors = 
            prior(beta(2,2), class = 'Intercept', ub=1, lb=0) +
            prior(beta(2,2), class = 'b', ub = 1, lb = 0))

Likewise, in the model below, you may end up with a linear predictor > 1 (especially when including the RE ?) because you don’t set Se + Sp > 1 as a constraint. The need for such constraint has been noticed in this post for example Logistic Regression without a Gold Standard/Error in Observed Classification - #7 by wgoette.

mod <- brm(
bf(Count | trials(total) ~ inv_logit(Tprev ) * Se + (1 - inv_logit(Tprev )) * (1 - Sp),
              Tprev  ~ species + (1|site),
              Se + Sp ~ 1,
              nl = T),
family = binomial(link = 'identity'), data = data, chains = 1, prior = priors, control = list(
   adapt_delta = 0.99)

If you don’t want to edit the underlying stan code produced by the brms call, a fallback solution could be to do something like:

bf(Count | trials(total) ~ inv_logit(Tprev ) * Se + (1 - inv_logit(Tprev )) * (1 - Sp),
              Tprev  ~ species + (1|site),
              Se ~ inv_logit(exp(gamma_se)),
              Sp ~ inv_logit(exp(gamma_sp)),
              gamma_se + gamma_sp ~ 1,
              nl = T),

Because Se and Sp will be both bounded in ]0.5,1[ you will end up with Se + Sp > 1. You can set gamma_sp ~ N(.) and gamma_se ~ N(.), with parameters such that you get your desired ETI95% for Sp and Se. Note that Se > 0.5 and Sp > 0.5 are not huge assumptions, otherwise better off using coin toss.

I don’t know if this will solve your issue, but that might be worth a try.

Ps: Sorry for the multiple edits, I accidentally hit enter before everything was fine…

1 Like