lnccbrown / HSSM

Development of HSSM package
Other
71 stars 10 forks source link

Prior for sv is not specified unless the model is hierarchical #364

Closed igrahek closed 3 months ago

igrahek commented 4 months ago

The code below works, but breaks with the following error if hierarchical=False

Error: ValueError: Please specify the prior or bounds for sv.

# Load a package-supplied dataset
data = hssm.load_data("cavanagh_theta")
data['response'] = data['response'].replace(0, -1)

# Specify the model
model = hssm.HSSM(
    model="ddm_sdv",
    loglik_kind="analytical",
    hierarchical=True,
    prior_settings="safe",
    data=data,
    p_outlier={"name": "Uniform", "lower": 0.01, "upper": 0.05},
    lapse=bmb.Prior("Uniform", lower=0.0, upper=5.0),
)

modelObject = model.sample(sampler="nuts_numpyro", 
                                cores=4,
                                chains=4,
                                draws=100,
                                tune=100,)

Including the prior on sv fixes the error, but it would be nice if there were defaults. Especially because sv was not hierarchical by default in HDDM I think.

Fix:

        {
            "name": "sv",
            "prior": {"name": "HalfNormal", "sigma": 2.0},
        },
digicosmos86 commented 4 months ago

Yep! This is a bug on our end. Very easy to fix. Thanks for spotting this, @igrahek!