LOO error with binomial mixture model

  • Operating System: Ubuntu 18.04
  • brms Version: 2.11.6

I am trying to calculate loo for a binomial mixture model but it loo throws the error:

Error in validate_ll(x) : All input values must be finite.

The model is specified as follows:

brm(u | trials(t) ~ 1
            , data = data
            , family =
                  mixture(binomial(link = "identity")
                        , binomial(link = "identity")
                          )
            , prior =
                  c(prior(beta(1, 20), class = Intercept, dpar = mu1)
                  , prior(beta(20, 1), class = Intercept, dpar = mu2))
            , chains = 4
            , cores = 4)

Is this an issue for these mixture models in general? is there any way around it?

Thanks!

What are your data u and t? And why link = “identity”? Do you get something sensible for posterior?

u are just counts of something happening, t is the total number of observations.

u    t
0    100
2    23
1000 1003

And why link = “identity”?

I though it was easier to specify the concrete priors I wanted that way (to make the model identifiable). But I get similar results without link = “identity”.

The posterior estimates are what I’d expect them to be.

Similar? Do you mean the error message is not the same as with the identity?

With the identity I would expect that you get probabilities which are less than 0 or larger than 1 which would cause non-finite log likelihood. This is even more likely with just three rows of observations, as then in LOO you have only two rows of observations and two mixture components.

Similar? Do you mean the error message is not the same as with the identity?

I mean it’s the same error message if I fit the model as:

model <- brm(bf(u | trials(t) ~ 1)
      , data = df_train_small
      , family =
            mixture(binomial, binomial)
      , prior =
            c(prior(normal(-4, 0.0001),
                    class = Intercept, dpar = mu1)
            , prior(normal(4, 0.2),
                    class = Intercept, dpar = mu2))
      , chains = 4
      , cores = 4)

Here’s the dataset.data-test.csv (5.1 KB)

Thanks for the clarification and the data. I hope I can test this some day next week.