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

priorsense integration not working #538

Closed
jonathonmellor opened this issue Feb 19, 2025 · 7 comments · Fixed by #540
Closed

priorsense integration not working #538

jonathonmellor opened this issue Feb 19, 2025 · 7 comments · Fixed by #540
Labels
bug Something isn't working

Comments

@jonathonmellor
Copy link

Thanks all for your hard work on this package, it's great!

Describe the bug
epidist fit object produces error when passed to priorsense.

To Reproduce
Taking a latent model that is working well otherwise, of the form:

epidist::epidist(
      formula = mu ~ 1 + age_group,
      algorithm = "meanfield",
      draws = 1000,
      backend = "cmdstanr"
    )

Running (or different permutations of variables or functions):

powerscale_plot_dens(fit, variable = c("Intercept", "Intercept_sigma")) +
  theme_minimal()

Produces the error:
Error in purrr::map_dbl():
ℹ In index: 1.
Caused by error in purrr::map_dbl():
ℹ In index: 1.
Caused by error in if (is.null(cens) || cens == 0) ...:
! missing value where TRUE/FALSE needed
Run rlang::last_trace() to see where the error occurred.

Expected behavior
The output should be that of a typical priorsense package.

Screenshots

Image

Desktop (please complete the following information):
Running on Linux, epidist v0.2, priorsense v1.0.4

Additional context
I appreciate this may not be a problem with epidist itself but could be priorsense. I note it in part because it looks like it might not be working on the website either (unless outputs aren't intended)

Image

@seabbs
Copy link
Contributor

seabbs commented Feb 19, 2025

Thanks for the report on this @jonathonmellor we are aware and think it may be related to other R side likelihood integration issues (#479 #476 #526 )

Closing #479 in favour of this issue due to a clear problem statement.

@seabbs
Copy link
Contributor

seabbs commented Feb 19, 2025

I appreciate this may not be a problem with epidist itself but could be priorsense. I note it in part because it looks like it might not be working on the website either (unless outputs aren't intended)

This is definitely an us problem so good to report.

I am looking at this properly next week if I don't get to it by end of day today

@athowes
Copy link
Collaborator

athowes commented Feb 19, 2025

This error:

Caused by error in if (is.null(cens) || cens == 0) ...:

Is the same as the error with loo in #526. (Already had suspicions, but.)

@seabbs
Copy link
Contributor

seabbs commented Feb 19, 2025

yes it looks to be.

I assume its related to this internal modification and following code block.

prep$data$cens <- -1

I am in the middle of modifying this for #476 so a dream scenario is this magically fixes itself but in reality I assume it will take a follow up investigation.

@seabbs seabbs changed the title Epidist & priorsense priorsense integration not working Feb 19, 2025
@seabbs seabbs added the bug Something isn't working label Feb 19, 2025
@seabbs
Copy link
Contributor

seabbs commented Feb 19, 2025

The loo functionality is now working as expected (but very slowly) in a branch

 powerscale_sensitivity(fit, cores = 10)

doesn't error but does take all of time (i.e it has been running for 20 minutes) so isn't very practical to use

@seabbs
Copy link
Contributor

seabbs commented Feb 19, 2025

See the update in this draft PR: #540

TLDR with the changes made there and for the distributions for which there are analytical solutions this now works in a tractable amount of time. For dists where this is not the case I think #476 gates real world use.

@seabbs
Copy link
Contributor

seabbs commented Feb 26, 2025

This should now work on main but note I am going to take another checking pass at this in #476 as I haven't done extensive testing to make sure the output of priorsense is "correct" (though I am also not aware of any reason why it wouldn't be at the moment`.

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

Successfully merging a pull request may close this issue.

3 participants