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

Refactor fi_pool_cluster() #26

Open
fredjaya opened this issue Dec 4, 2023 · 1 comment
Open

Refactor fi_pool_cluster() #26

fredjaya opened this issue Dec 4, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@fredjaya
Copy link
Collaborator

fredjaya commented Dec 4, 2023

Low priority enhancements to improve code readability and unit testing such as:

  • Breaking up components into separate functions for:
    • form == "beta"
    • form == "discrete"
    • form %in% c("logitnorm", "cloglognorm")
    • real_scale == FALSE
  • Remove avoidable nesting of if (form %in% c("discrete", "beta")) { (comment on why beta and discrete have to be calculated similarly still addresses this)

Thoughts?

@fredjaya fredjaya assigned fredjaya and AngusMcLure and unassigned fredjaya Dec 4, 2023
@fredjaya fredjaya added the enhancement New feature or request label Dec 4, 2023
@AngusMcLure
Copy link
Owner

I agree the function needs restructuring in some way. I think the real_scale TRUE and FALSE cases should be handled by the same function.

We could also definitely split up into separate (non_exported) functions which fi_cluster calls in the backend. Perhaps named something like:

  • fi_beta
  • fi_discrete
  • fi_linknorm

To do this, we'd move phi() and log_one_minus_phi() out as separate utility functions which would be called by all three. These two utility functions would also need additional arguments for sensitivity, specificity, and pool size passed to them. This will make some of the more math-heavy code harder to read as we'll be replaced phi(p) with phi(p, s, varphi, psi), but I think this is pretty minor, compared to the benefits.

Will do this, but low priority for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants