-
Notifications
You must be signed in to change notification settings - Fork 11
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
Syntax issues when defining hyperpriors #450
Comments
Hi @gingjehli, This is expected behavior. When specifying priors there should not be spaces. Spaces in formulas are simply parsed out, like in many programming languages, so even if you write I am going to close this issue for now. Please feel free to reopen it if you still run into problems :). |
Hi Paul, the problem is that it would be great if it did parse out the
space as if it wasn’t there but it turns out it does not actually do that
(ie. With the space it doesn’t actually implement the hierarchy but the
user would not know that unless they carefully checked how the priors get
implemented in the model output). It took us a while to figure out why
Nadja couldn't replicate my approach to using hyperpriors until she finally
realized she had inserted a space.
If this is not simple to change (eg to remove spaces prior to |) we can
simply make sure to clearly document this for the user that they need to
make sure not to put any spaces!
…On Fri, May 31, 2024 at 9:55 AM Paul Xu ***@***.***> wrote:
Hi @gingjehli <https://github.com/gingjehli>,
This is expected behavior. When specifying priors there should not be
spaces. Spaces in formulas are simply parsed out, like in many programming
languages, so even if you write (1 | participant_id), the correct name
for the term is still 1|participant_id.
I am going to close this issue for now. Please feel free to reopen it if
you still run into problems :).
—
Reply to this email directly, view it on GitHub
<#450 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG7TFFGYLBO62BUPMQJRQ3ZFB6LXAVCNFSM6AAAAABIRUL6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBSGIZDMMRUGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi Michael, I agree that it can be confusing that the formula does the parsing but not prior specifications. I think the best solution to this is for Let me coordinate with Tomi about this and see what the best way forward. For now, it'd probably be best to document this as a rule in our documentation. I'll work on this. |
Bambi issue here bambinos/bambi#815 |
Michael and I just noticed the following syntax issue for prior specification.
Specifically, it matters whether one uses: "1 |participant_id" or "1|participant_id".
Example with the spacing:
sm6 = hssm.HSSM( data=data, include=[ { "name": "v", "formula": "v ~ 0 + (1 | participant_id)", "prior": { "1 |participant_id": {"name": "Normal", "mu": {"name": "Normal", "mu": 1, "sigma": 2, "initval": 1}, "sigma": {"name": "HalfNormal", "sigma": 1 }, }, }, }, ], noncentered = False, )
provides this output:
v: Formula: v ~ 0 + (1 | participant_id) Priors: v_1|participant_id ~ Normal(mu: 0.0, sigma: HalfNormal(sigma: 2.5)) Link: identity Explicit bounds: (-inf, inf)
Example without the spacing:
sm6 = hssm.HSSM( data=data, include=[ { "name": "v", "formula": "v ~ 0 + (1 | participant_id)", "prior": { "1|participant_id": {"name": "Normal", "mu": {"name": "Normal", "mu": 1, "sigma": 2, "initval": 1}, "sigma": {"name": "HalfNormal", "sigma": 1 }, }, }, }, ], noncentered = False, )
provides this output:
v: Formula: v ~ 0 + (1 | participant_id) Priors: v_1|participant_id ~ Normal(mu: Normal(mu: 1.0, sigma: 2.0, initval: 1.0), sigma: HalfNormal(sigma: 1.0)) Link: identity Explicit bounds: (-inf, inf)
note that the model should be specified with hyperpriors (so the example without the spacing is correct!)
The text was updated successfully, but these errors were encountered: