I have a question concerning loo for hierarchical models. I want to do a trial-level loo, but the number of trials differ across subjects. Therefore, the array of log_lok contains missing or default values. How will loo take care of these?
The loo package will throw an error if the log_lik object contains NA values, but I don’t think you need to have missing/NA values here. It sounds like you’re creating a log_lik object where each subject has the same number of entries (the maximum number of trials). Instead, if you want to do leave-one-trial-out CV (that’s what it sounds like you want to do, but correct me if I’m wrong) you can just have one entry per observed trial. For example, if subject A has 3 trials and subject B has two trials, you would just put those five trials next to each other in the log_lik object. You don’t need a placeholder/missing value for a third trial for subject B just because subject A has three trials.