Skip to content

Outsource uncertainty#96

Open
shawndove wants to merge 40 commits intomainfrom
outsource_uncertainty
Open

Outsource uncertainty#96
shawndove wants to merge 40 commits intomainfrom
outsource_uncertainty

Conversation

@shawndove
Copy link
Collaborator

No description provided.

@shawndove shawndove force-pushed the outsource_uncertainty branch from 183b767 to d3dcdd2 Compare January 9, 2026 12:32
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 88.46154% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.19%. Comparing base (de24e6e) to head (68f1bd9).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
R/add_ci.R 85.71% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   75.74%   75.19%   -0.55%     
==========================================
  Files          65       66       +1     
  Lines        3982     4051      +69     
==========================================
+ Hits         3016     3046      +30     
- Misses        966     1005      +39     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shawndove shawndove requested a review from wlangera January 9, 2026 14:56
@shawndove
Copy link
Collaborator Author

This update moves the uncertainty calculation to a separate step of the workflow. Now all indicators except Hill diversity (which calculates internally using iNEXT) are calculated without CIs. The user can then add them using the add_ci() function, which defaults to bootstrapping the whole dataset using dubicube, but also provides the option to do it at the indicator level using the internal code.
Putting the uncertainty in a separate step was more work, but it should be more robust and easier to update. It will also make it easier to add ci function for maps in the future.

Copy link
Collaborator

@wlangera wlangera left a comment

Choose a reason for hiding this comment

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

Hi Shawn,
Thanks for the quick work. I doubt I will have time to do a complete review in January, because of my other deliverables.
Therefore, I already made some comments so you can work further on this if you want.

We should also have unit tests and perhaps a vignette. This vignette could also just be conceptual with links to the dubicube package.

Let me know what you think

Copy link
Collaborator

@wlangera wlangera left a comment

Choose a reason for hiding this comment

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

I have updated dubicube.

Here is a review of the documentation.

#' * `indicator`: Bootstrapping is done by resampling indicator
#' values. This is faster for large cubes but less robust.
#'
#' @param ci_type (Optional) Type of bootstrap confidence intervals to
Copy link
Collaborator

Choose a reason for hiding this comment

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

"norm" is not a good default. Please use the order in dubicube:
type = c("perc", "bca", "norm", "basic") (perc can be the default)

https://b-cubed-eu.github.io/dubicube/reference/calculate_bootstrap_ci.html

#' `dubicube::bootstrap_cube()`. (Default: `list()`)
#' @param ci_args (Optional) Named list of additional arguments passed to
#' `dubicube::calculate_bootstrap_ci()`. (Default: `list()`)
#' @param ... Additional arguments passed to the underlying functions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this mean? Where can we find this underlying function? (It is not meantioned in the @params)

#' @param ... Additional arguments passed to the underlying functions.
#'
#' @details
#' The function acts as a bridge to the `dubicube` package for statistical
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#' The function acts as a bridge to the `dubicube` package for statistical
#' The function acts as a bridge to the \pkg{dubicube} package for statistical

#'
#' @details
#' The function acts as a bridge to the `dubicube` package for statistical
#' heavy lifting.
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does statistical heavy lifting mean? It is used to calculate bootstrap confidence intervals

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