-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When performing optimisation with input argument prior=True, the results key "fun" will represent the participant-wise negative summed log posterior density at the optimised parameter values.
It might be useful to additionally save the summed log likelihood and summed log prior density at the optimised parameter values. For example, these separate quantities could be used for post-hoc model selection procedures / computing goodness-of-fit indices.
One approach to do this would be to calculate the log prior density as follows (solution by @lenarddome ):
## Fit.parameters are the parameters attribute of the cpm.optimisation object
## parameters is the Parameters object
prior_density = np.zeros(len(Fit.parameters))
for m, p in enumerate(Fit.parameters):
parameters.update(p)
prior_density[m] = parameters.PDF(log=True)Then, the log likelihood is simply the log posterior density (i.e., "fun" * -1) minus the log prior density.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request