Repository navigation
Fix pda.create.btprior() support for exponential priors - #4328
Open
pranshup04 wants to merge 1 commit into
Open
pranshup04 wants to merge 1 commit into
pranshup04 wants to merge 1 commit into
Conversation
- Omit unused paramb argument when constructing dexp/rexp closures in pda.create.btprior(), preserving two-parameter and optional-ncp distributions (chisq, t). - Add regression tests for exponential priors (NA and 0 paramb), mixed normal+exp priors, and chisq/t noncentrality preservation. - Update CHANGELOG.md and modules/assim.batch/NEWS.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes
PEcAn.assim.batch::pda.create.btprior()so it can construct exponential ("exp") priors alongside two-parameter priors.Reproduction & Cause
On
develop(ccaf2c2a24), constructing an exponential prior fails immediately withunused argument (b):ddist_generator()andrdist_generator()inmodules/assim.batch/R/pda.bayestools.helpers.Runconditionally passed bothaandbtomatch.fun(paste0("d", distn))andmatch.fun(paste0("r", distn)). Whilepda.define.prior.fn()(pda.utils.R) andplot.da.Ralready handledistn == "exp"withoutparamb,pda.bayesian.tools()subsequently passes the selected priors topda.create.btprior(), whererexp()(called duringBayesianTools::createPrior()) anddexp()reject the extrabargument.Changes
modules/assim.batch/R/pda.bayestools.helpers.R): Omit the unusedb(paramb) argument inddist_generator()andrdist_generator()whenas.character(distn) == "exp", and remove the resolvedTODOcomment. Two-parameter distributions and distributions accepting an optional noncentrality parameter (chisq,t) continue receivingbunchanged. Discrete one-parameter distributions (pois,geom) are intentionally left out of this PR's scope.modules/assim.batch/tests/testthat/test.bt_prior.R): Added coverage for"exp"priors withparamb = NA_real_andparamb = 0(verifyingdexp(..., log = TRUE)log-density andrexp()sample mean/variance), mixednorm+exppriors, andchisq+tnoncentrality preservation withparamb = 0.CHANGELOG.md,modules/assim.batch/NEWS.md): Documented the fix underPEcAn.assim.batch 1.9.1.9000andUnreleased -> Fixed.Validation
PEcAn.assim.batch(R CMD INSTALL --no-multiarch) and rantestthat::test_local()in an offline PEcAn Docker container (R 4.4.3,BayesianToolsinstalled):[ FAIL 0 | WARN 0 | SKIP 0 | PASS 23 ](test.autoburnin.R: 7,test.bt_prior.R: 16).PEcAnRTM::prospect_bt_prior("4", ...)with an exponentialNprior (sampler()returned a valid 5-parameter draw).git diff --cached --checkcleanly. Full monorepo test suites and live BETY/MCMC workflow runs were not executed.Motivation and Context
Exponential priors are already explicitly supported elsewhere in
PEcAn.assim.batch(pda.define.prior.fn(),plot.da.R) and inPEcAn.utils::distn.stats(), and are reached directly frompda.bayesian.tools(). This PR alignspda.create.btprior()with the rest of the package without altering existing two-parameter or optional-ncpbehavior.Review Time Estimate
Types of changes
Checklist: