-
Notifications
You must be signed in to change notification settings - Fork 30
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
Pass on extra arguments to the likelihood #234
Comments
I believe the only way to do it at present it to pass extra information in as global variables. In R, if a function can't find a variable in its own environment, it looks in the parent environment. So any variables in the global environment are available inside the function. e.g. print(environment()) f <- function(x){ f("myargument") |
I absolutely like the package. It makes my life easy when analyzing uncertainty associated with estimates using a MCMC approach. It would be great if the package allows us to pass extra argument to the likelihood function in a future version. It may be just a personal preference, but I feel that it makes code flows better when I write small modular functions rather than a big function that lumps everything into it. |
Hi DJackCai / all, apologies, it seems I forgot responding to this issue. Note that this is identical to #200, so see discussion there. As @woodwards says, in the current version of BT, this can be done by accessing a global variable. So, define your data outside the likelihood, then you should be able to switch. I personally never saw the need for passing data arguments to the likelihood, but given that so many people want to use it, I'm happy to consider if this can be done with the next revision of BT. Best |
Hi Florian, Thanks for your feedback! I just write a wrapper function that glues everything into my likelihood function for now. I would highly appreciate it if you could consider adding this feature in next revision of BT :) Rui |
Dear Florian
I was trying to use the DREAMzs algorithm to calibrate a land surface model for soil moisture estimation. The land surface model setting implies that ancillary forcing data (e.g. precipitation, temperature) and observed soil moisture data are needed to simulate the model and define the likelihood function.
Normally in the modelling workflow, I would put the forcing data and observed data as function arguments in addition to parameters - this allows the coupling with an external function that extracts the ancillary data from the data storage and thus allows generalisable implementation for different sites.
However, the createBayesianSetup in BayesianTools doesn't seem to allow me to pass additional arguments of forcing data and observed data, nor does runMCMC - there is no "..." feature in these functions.
In comparison, for the older dream package, we can pass additional modelling arguments by populating the " FUN.pars " argument:
dream(FUN, func.type, pars, FUN.pars = list(), INIT = LHSInit,
INIT.pars = list(), control = list(), measurement)
So I just wonder if there are any ways in the package to pass on extra arguments (other than parameters to be calibrated) to the likelihood function?
Your assistance would be really appreciated.
Jack
The text was updated successfully, but these errors were encountered: