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

Infinite loop in icc() for some brms models #905

Closed
bwiernik opened this issue Jul 11, 2024 · 4 comments · Fixed by #906
Closed

Infinite loop in icc() for some brms models #905

bwiernik opened this issue Jul 11, 2024 · 4 comments · Fixed by #906
Assignees
Labels
3 investigators ❔❓ Need to look further into this issue

Comments

@bwiernik
Copy link
Contributor

a <- seq(from = 0, to = 30)
b1 <- rbeta(length(a), 3, 1)
b2 <- rbeta(length(a), 3, 1)

d <- data.frame(id = c(a,a),
                value = c(b1, b2))

mod_bayes <- suppressMessages(suppressWarnings(brms::brm(value ~ 1 + (1 | id),
                 data = d,
                 family = brms::Beta)))

icc(mod_bayes)

The sequence of internal function to compute distribution and residual variance loops back into .compute_variances() seemingly endlessly. (Maybe not endlessly, but we are re-estimating the same updated models to get "null" models and "sigma" variance many many times as the functions loop back through the parent compute_variances() function.) We should adjust this function to ensure we only resample each updated model 1 time.

@bwiernik
Copy link
Contributor Author

One possible quick fix here would be to pass already-computed distributions as a list to each internal all, so that we re-estimate them only conditionally

@strengejacke
Copy link
Member

Where is the model refit multiple times? I think, the null-model is only computed once and pass as argument inside .compute_variances() (at least for the latest insight version).

@strengejacke strengejacke added the 3 investigators ❔❓ Need to look further into this issue label Jul 13, 2024
@bwiernik
Copy link
Contributor Author

Did you try running the example? When it starts to compute .variance_distributional(), get_sigma() drops it back into the a new iteration of compute_variance(), which computes the null model again. I stopped the function, but it refits something at least 30 times before I stopped it.

@strengejacke strengejacke transferred this issue from easystats/performance Jul 17, 2024
@strengejacke strengejacke self-assigned this Jul 17, 2024
strengejacke added a commit that referenced this issue Jul 17, 2024
@bwiernik
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants