Skip to content

Calculating DIC for HSSM models #435

Closed Answered by kiante-fernandez
HugoSnyders asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure what @HugoSnyders tried but you could give this a go. Use comes with all the standard dissuading people from using DIC :).

Make sure you set idata_kwargs = {'log_likelihood': True}.

def dic(inference_data):
    """
    Calculate the Deviance Information Criterion (DIC) for a given model.

    Parameters:
    inference_data (arviz.InferenceData): An ArviZ InferenceData object containing the posterior samples

    Returns:
    float: The computed DIC value.
    """

    # Extract log likelihood from the inference data
    log_likelihood = inference_data.log_likelihood

    # Calculate the point-wise deviance
    D_bar = -2 * np.mean(log_likelihood)

    # Calculate the effective nu…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@digicosmos86
Comment options

@kiante-fernandez
Comment options

Answer selected by HugoSnyders
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants