How to compute WAIC for individual subjects?

I want to use az.waic to estimate WAIC for each subject, but I can only get the results that computed from 1000 by 12906 log-likelihood matrix.
The sizes of my traces are (1000, 703), (1000,91378), (1000, 91495), (for 117 subjects with multiple parameters), the code shows as below:
hmm_waic = az.waic(hmm_trace, pointwise=True)
but all of the results shows:
“Computed from 1000 by 12906 log-likelihood matrix”

I don’t know what the 12906 represents, it seems not to relate to my datasizes or subjects. Besides, I want to compute WAIC for individual subjects, but I didn’t know whether this method is correct.

1 Like


I’d recommend to read ArviZ educational resorces. The repo is still a work in progress but in an advanced enough state regarding this topic.

Begin with the (finished) notebook on model comparison and information criteria. It should help understand the 12906 and the use cases of WAIC:

Then go to the (still in progress) notebook about information criteria with multiple likelihood or with hierarchical models. It should help in calculating the WAIC in the way that is relevant and correct to your specific question:

1 Like

Thank you very much! I will learn how did the tracedata convert to the inference data.

1 Like