Dev dirchlet linear - #1516
Conversation
|
This branch needs to be rebased to main. I have done it locally and can push for you if you want but I wasn't sure what was best for you given there are two of you working on this branch. With the rebase, I wiped out all changes to tests/gtest/CmakeLists.txt and then added the Dirchlet-mulitnomial test back in after near the fimsMath tests rather than at the end of the file. Second, why do you have the naming convention of |
…l_tests_output.txt
Removed comment about using the FIMS custom sum function.
Removed unnecessary include for fims_vector.hpp.
…test inputs for DM PMF read from csv created and verified with "Test_value_diric_multinom.R"
Use the global lgamma (::lgamma) in ddiric_multinom to avoid incorrect fims_math resolution, and update calls accordingly. Add fims_math include to the Dirichlet-multinomial functor and export the functor header from distributions.hpp. Fix Rcpp distribution interface bugs and naming/initialization issues: correct make_shared/copy-constructor types for the DDirichletMultinomial interface, initialize the underlying theta from initial_value_m, and update Rcpp bindings (method names, fields and expose theta). These changes address compilation/runtime errors and ensure the Dirichlet-multinomial distribution is properly registered and usable from R.
Export DDirichletMultinomDistribution in NAMESPACE to make the new distribution available to package users. Also add DDirichletMultinomialDistributionsInterface to inst/WORDLIST so the identifier is recognized by the package wordlist (avoids spellcheck/lint issues).
Added 'dirichlet_multinomial' to available distributions and created a new function for it.
Updated documentation @details to clarify the implementation of the Dirichlet-multinomial log-probability mass function.
…roposed fix to switch between composition distribution types in "fix_helper_setup_R1.docx". More general solution recommended for multiple composition types and other submodel components.
…ration-tests-validation.R to support Dirichlet-Multinomial distribution.
77a1e1b to
9a653d8
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1516 +/- ##
==========================================
- Coverage 85.02% 83.32% -1.70%
==========================================
Files 106 108 +2
Lines 9386 9692 +306
Branches 537 555 +18
==========================================
+ Hits 7980 8076 +96
- Misses 1369 1573 +204
- Partials 37 43 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| Type theta_n = theta * n; | ||
|
|
||
| // 1. Base Multinomial combinatorial term: log(n!) = lgamma(n + 1) | ||
| Type log_like = ::lgamma(n + static_cast<Type>(1.0)); |
There was a problem hiding this comment.
use fims_math::lgamma, which uses TMB's atomic lgamma function when #ifdef TMB_MODEL and std::lgamma when TMB is not defined. We could also use lgamma without the global :: in front, but we might prefer to be more explicit.
|
@msupernaw the branch is failing the pkgdown action because of missing documentation. In inst/include/interface/rcpp/rcpp_objects/rcpp_distribution.hpp, add a class-level doc block for DDirichletMultinomialDistributionsInterface and a member doc for theta. |
What is the feature?
How have you implemented the solution?
Does the PR impact any other area of the project, maybe another repo?
Instructions for code reviewer
👋Hello reviewer👋, thank you for taking the time to review this PR!
nit:(for nitpicking) as the comment type. For example,nit:I prefer using adata.frame()instead of amatrixbecause ...This PR is now ready to be merged.Checklist