-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Prototype for set_inits() #1646
base: master
Are you sure you want to change the base?
Conversation
- works with Intercept and b for all distributional parameters - does not work with random effects and special parameters - tests for helper functions and local test for brm with set_inits
This is a great addition to But, I also saw that @venpopov included a |
Thank you a lot @venpopov! Currently, I am a bit overwhelmed with things so it may take a while until I get back to this issue. But I highly appreciate your work and I am confident it will provide a good basis for making this feature work generally for any kinds of brms models. |
I understand. Should I keep working on this if I want to add things, or would you prefer me to leave it as is until you get a chance to look over it? |
I don't know yet. let me think about it
Ven Popov ***@***.***> schrieb am Sa., 13. Apr. 2024, 13:32:
… I understand. Should I keep working on this if I want to add things, or
would you prefer me to leave it as is until you get a chance to look over
it?
—
Reply to this email directly, view it on GitHub
<#1646 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADCW2AEFYORGS6RYVZ42ONTY5EJVTAVCNFSM6AAAAABGCROVFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJTGYYTSOJXGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I like the general outline of the functionality. Especially the user interface is very pretty I think. As for the par_info. Perhaps we can abstract the functionality of mapping to the Stan parameters to be reusable for both priors (stan code generation) and setting inits. If we just copy the relevant code, I worry this will become hard to maintain with new terms being potentially added in the future. I will think about it a bit more. |
Glad you like the general design! I totally agree we should abstract/refactor common functionality - to make it easier to maintain, less error prone, allow for easier future extension. I didn't do it in the prototype because I wanted to make something simple that works without messing around and potentially breaking the existing code. But we are on the same page about the need for abstraction. I just saw your email, will respond there in a bit |
A brief summary of what we discussed. par_info:
quality control:
UI:
|
Just a quick update from my side - unfortunately I didn't find the time to work on this and I'll be on vacation for 2 weeks. I'll get back to it when I come back |
As discussed in #1645, here is a prototype for a
set_inits()
function modeled afterset_prior()
Here's a functioning example, setting inits on
Intercept
andb_sigma
:Created on 2024-04-11 with reprex v2.1.0
Implementation
set_inits()
takes arguments following theset_prior()
syntax and creates a data.frame of classbrmsinits
set_inits()
can be added together just like forset_prior()
brm()
there is now the following piece of new code:which calls
.inits_fun()
internal function to generate a list of inits from the specification of thebrmsinits
object.inits_fun()
takes as argument the brmsinits object, the bterms object, the data and the standatapar_info()
which generates lists of type:by using some of the code from
stan_predictor
Limitations and generalization
This currently only works for the
Intercept
andb
type parameters for all population parameters and families. It does not work for random effectssd
and for thez
vector. This is where I would appreciate your help to generalize this (the current code uses a par_info_fe() function to generate the information for the fixed effects. Similar functions would be needed for the random effects and other special parametersTests
I added tests for all the internal helper functions, and also a test for
brm
with set_inits() in thetests/local
folderAdditional features
Would be nice to have
staninits
, which takes the formula, data and set_inits and generates the inits listconstant(x)
syntax as for the priordefault_inits
, similar todefault_prior
, which shows the structure of how to specify inits for the valid parameters. the default values themselves are nto very informative - uniform(-2,2) on the unconstained scale, but the point is to see which parameters you can specify inits for