-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feedback on GAMs and GPs post #1
Comments
Thanks so much for the feedback @tomicapretto , I'll work through the points this coming week.
Very interested! I would be great to see how to do hierarchical splines in Bambi! |
Just a note to say I think I've addressed your comments above @tomicapretto ! Did you, by any chance, try (or manage) to do hierarchical splines with Bambi? |
Hi @NathanielF I was not able to come back to that but I'll try to get an example as soon as possible :D |
No worries! Thanks @tomicapretto |
Hi Nathaniel! Following our discussion on bambinos/bambi#796, here I'm adding some notes I wrote down while reading your post. You're doing a massive contribution, thanks!
Bambi uses its own implementation called 'formulae' (github.com/bambinos/formulae). I created it to support mixed effects model formulas (i.e. the (1 | group) syntax).
I'm not sure why you want to use
intercept=True
. This means the vector basis spanned by the columns of spline include the intercept. Thus, the underlying design matrix is not of full rank and there is a redundant parameter. You could drop the intercept by adding a "0" to the RHS of the formula, or just not passintercept=True
. This can help https://bambinos.github.io/bambi/notebooks/splines_cherry_blossoms.html#advanced-watch-out-the-underlying-design-matrix (i just detected a typo in the first paragraph, beta is of length "p", not "n").I see later, when you use
bs_patsy
, you do"bs_patsy(dev_periods, knots=knots, degree=3, include_intercept=True) - 1"
which is not introducing redundancies beacuse the intercept is spanned once.A small detail, but in the plot above that text you have legends appearing twice.
You could also create that plot with the
interpret
submodule. See when we usepps=True
here. You could call it twice and then you would get the two bands (once with pps=True and other without it).model_type == 'unpooled'
? I think there can be an error there (a parameter that is not used)tau
as sigma for bothbeta_g
andbeta
? I think it only makes sense in the second case, unless you also want to partially pool the spline coefficients among them (without considering year). This looks interesting though.In a first pass, it's not clear to me what's the relationship between all the curves in there. For example, is any of the curves the sum or difference between another curves?
I think the readibility of the cell will improve if you create a function to create the knots for you so you don't repeat it 6 times.
Just wanted to say this model is hierarchical but it's only partially pooling the intercepts. I think it's possible to have hierarchical splines in Bambi using a custom prior. I could try to put together an example if you're interested.
Other suggestions:
Typos:
hierarhical
->hierarchical
in "[...] though we’re specifying a hierarhical model we [...]"The text was updated successfully, but these errors were encountered: