pymc-devs / pymc-experimental

https://pymc-experimental.readthedocs.io
Other
72 stars 46 forks source link

add zerosum hierarchy #271

Closed ferrine closed 2 months ago

ferrine commented 7 months ago

Usecases

a + b - hierarchy without interactions, a, b - zerosum
a*b - hierarchy with interactions, a, b - zerosum, a_b - interaction effect with zerosum

(1 | a) + b - ??? should it be even considered?

API

with pm.Model(coords=dict(groups=range(10), stages=range(3))):
    mean = pm.Normal("mu")
    sigma = pm.Exponential("sigma")
    z = zerosum_hierarchy("z ~ groups + stages", importance=dict(groups=10), named=False)
    group_param = mean + z * sigma
ferrine commented 5 months ago

converted this PR to draft to just keep the progress

ferrine commented 2 months ago

Meanwhile @aseyboldt suggested to use builder api, agreed with him

ricardoV94 commented 2 months ago

What's the builder API?