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

I’m trying to obtain the loo of a weighted binomial model, but I get the error in the title. The model has the structure:

brm(S|weights(w)~T+I(T^2)+(1|gr(phylo, cov = A))+(1|ID), family = bernoulli,
data = data, data2 = list(A=A), cores= 4, iter = 10000)

where w ranges over (0,1), A is a variance-covariance matrix from a phylogenetic distance matrix between species using ape::vcv.phylo, ID is a grouping random factor.

The summary for this model is:

Family: bernoulli
Links: mu = logit
Formula: S | weights(w) ~ T + I(T^2) + (1 | gr(phylo, cov = A)) + (1 | ID)
Data: data (Number of observations: 18311)
Draws: 4 chains, each with iter = 10000; warmup = 5000; thin = 1;
total post-warmup draws = 20000

Group-Level Effects:
~phylo (Number of levels: 12)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 0.32 0.09 0.19 0.53 1.00 8046 11408

~ID (Number of levels: 68)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 1.17 0.12 0.96 1.43 1.00 5715 9483

Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept -0.80 1.28 -3.33 1.73 1.00 8519 10476
T 1.45 0.01 1.42 1.47 1.00 28505 14687
ITE2 0.19 0.00 0.19 0.20 1.00 29161 14939

Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
Warning message:
There were 5 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See Runtime warnings and convergence problems

Does anyone know the cause of this error?

Thanks in advance,


Not sure if that is the cause of your problem but you do seem to have divergent transitions and should probably check the link offered by the warning to do something about them before continuing.

I ran into a similar issue sometimes with a similar model. I think what’s happening is the default brms priors are too loose and let the phylogenetic effect get really large and perfectly fit every observation. This lets the log-likelihood get really high and causes the Inf log-likelihoods that loo() is erroring on.

See this thread, including the functions I used to solve it near the end. I ended up using the integrated loo approach shown in section 5 of the roaches demo, though I had to evaluate the integral in R and take some additional steps to make sure it was numerically precise.

1 Like