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

Lfmcmc rand engine #51

Merged
merged 13 commits into from
Nov 20, 2024
Merged

Lfmcmc rand engine #51

merged 13 commits into from
Nov 20, 2024

Conversation

gvegayon
Copy link
Member

@gvegayon gvegayon commented Nov 20, 2024

The LFMCMC function no longer needs an epiworld_model object to be instantiated. A rand engine is automatically created when NULL is passed instead. The data type was changed to double (from int) to give more flexibility. I added a new test that uses LFMCMC to estimate the mean and standard deviation of a normal vector. Finally, I modified the vignette to have a better kernel function (does a better job now!).

Function Enhancements:

  • Modified the LFMCMC function to accept a NULL model, creating a new random-number generator engine if no model is provided. (R/LFMCMC.R, man/LFMCMC.Rd) [1] [2]
  • Updated the run_lfmcmc function to include parameter type conversions and ensure compatibility with the new LFMCMC implementation. (R/LFMCMC.R)

C++ Code Updates:

  • Changed the data type in the C++ code from int to double for better precision and compatibility with the new LFMCMC features. (src/cpp11.cpp, src/lfmcmc.cpp) [1] [2]
  • Added logic to the LFMCMC_cpp function to handle the creation of a new random-number generator engine when the model is NULL. (src/lfmcmc.cpp)

Testing and Documentation:

  • Adds new test to file test-lfmcmc.R to validate the functionality of the LFMCMC algorithm with different models and ensure accuracy. (inst/tinytest/test-lfmcmc.R)
  • Updated the vignette likelihood-free-mcmc.Rmd to reflect changes in the LFMCMC setup and usage examples. (vignettes/likelihood-free-mcmc.Rmd) [1] [2]
  • Adds Andrew Pulsipher as co-author of package

These changes collectively enhance the epiworldR package by providing more robust and flexible tools for model parameter estimation and simulation.

@gvegayon gvegayon marked this pull request as ready for review November 20, 2024 05:46
Copy link
Contributor

@apulsipher apulsipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the purpose of this PR to allow instantiation without a model. I've two questions/changes to address here.

Additionally, the PR is failing most of the checks. Changing the data type from int to double causes unit tests to fail and causes the examples at the top of the .R file to throw errors. Please fix those before merging!

R/LFMCMC.R Show resolved Hide resolved
inst/tinytest/test-lfmcmc-other-models.R Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.82%. Comparing base (21d89c7) to head (c96435d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   34.38%   34.82%   +0.44%     
==========================================
  Files          36       36              
  Lines        1908     1921      +13     
==========================================
+ Hits          656      669      +13     
  Misses       1252     1252              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

@apulsipher apulsipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved the issues we discussed. @gvegayon Can you check that I've added myself as author correctly before merging?

@gvegayon
Copy link
Member Author

I resolved the issues we discussed. @gvegayon Can you check that I've added myself as author correctly before merging?

LGTM!

@apulsipher apulsipher self-assigned this Nov 20, 2024
@apulsipher apulsipher merged commit cc673d1 into main Nov 20, 2024
14 checks passed
@apulsipher apulsipher deleted the lfmcmc-rand-engine branch November 20, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants