# Large Pareto K Values in Cognitive Models

**URL:** https://discourse.mc-stan.org/t/large-pareto-k-values-in-cognitive-models/35786
**Category:** Modeling
**Tags:** loo, specification, rstan, brms
**Created:** [July 7, 2024, 1:53pm UTC](https://discourse.mc-stan.org/t/large-pareto-k-values-in-cognitive-models/35786 "2024-07-07T13:53:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tooweisian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/tooweisian/32/17829_2.png) [@Tooweisian](https://discourse.mc-stan.org/u/Tooweisian)
#### Post date: [July 7, 2024, 1:53pm UTC](https://discourse.mc-stan.org/t/large-pareto-k-values-in-cognitive-models/35786/1 "2024-07-07T13:53:50Z")

</div>

Hello everyone,

I have a question about the reliability of pareto-K values in a hierarchical Wiener diffusion model I implemented in `brms`: is it permissible to allow, say \<1%, of data points to have a high pareto-K value given that cognitive modeling is used to outlier/influential RTs?

One idea I had to explain the large pareto-K values was that the Wiener diffusion model itself was not a good model of the data (and thus the model is misspecified). However, I would like to use the Wiener diffusion model because of the theoretical context behind it.

If this is not permissible, would it be more ideal to use heuristic arguments to justify my model design? K-fold CV is not an option, since one run of the DDM took nearly 7 hours to run. Finally, I am confused on calculating the number of nominal parameters (to compare to p\_loo) for a hierarchical Wiener diffusion model. Below are the results of my loo-cv as well as model specification.

```no-highlight
Computed from 8000 by 9376 log-likelihood matrix.

         Estimate SE
elpd_loo -4522.9 130.0
p_loo 649.3 21.0
looic 9045.9 260.1
------
MCSE of elpd_loo is NA.
MCSE and ESS estimates assume MCMC draws (r_eff in [0.7, 1.6]).

Pareto k diagnostic values:
                         Count Pct. Min. ESS
(-Inf, 0.7] (good) 9332 99.5% 286     
   (0.7, 1] (bad) 35 0.4% <NA>    
   (1, Inf) (very bad) 9 0.1% <NA>    
See help('pareto-k-diagnostic') for details.

```

```no-highlight
rt | dec(resp) ~ population * trial_type * block_type + (1 + trial_type + block_type | participant_id) 
bs ~ population * trial_type * block_type + (1 + trial_type + block_type | participant_id)
ndt ~ population + (1 | participant_id)
bias ~ population * trial_type + (1 + trial_type | participant_id)

```

Thank you in advance.

---

<div class="post-metadata">

### Author: ![edm](https://avatars.discourse-cdn.com/v4/letter/e/f08c70/32.png) [@edm](https://discourse.mc-stan.org/u/edm)
#### Post date: [July 12, 2024, 3:27pm UTC](https://discourse.mc-stan.org/t/large-pareto-k-values-in-cognitive-models/35786/2 "2024-07-12T15:27:22Z")

</div>

I think that posterior predictive checks would be more helpful for deciding whether the Wiener model is a good model of the data. In my experience, the large Pareto k can be related to the log-likelihood that is being used: I believe (but am not sure) that the brms log-likelihood is conditioning on all the random effects in the model, i.e., each person has 8 random effects (if I am counting correctly), which are all being treated as parameters. I think this leads to the p\_loo of 649, while your parameter count would probably be much less because you wouldn’t count the random effects as parameters.

An alternative loo computation would involve a likelihood that marginalizes out the random effects. But this will probably involve some tricky integral approximations for this model. I worked on this problem for simpler, multivariate normal models in the paper below, which provides some more background on the issue (where “latent variables” are similar to “random effects”):

> **[Bayesian comparison of latent variable models: Conditional vs marginal...](https://arxiv.org/abs/1802.04452)**
>
> Typical Bayesian methods for models with latent variables (or random effects) involve directly sampling the latent variables along with the model parameters. In high-level software code for model definitions (using, e.g., BUGS, JAGS, Stan), the...

---

<div class="post-metadata">

### Author: ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)
#### Post date: [July 18, 2024, 9:05am UTC](https://discourse.mc-stan.org/t/large-pareto-k-values-in-cognitive-models/35786/3 "2024-07-18T09:05:57Z")

</div>

Based on the information provided, it is possible that the high Pareto-k values are due to a flexible model, so that for some observations when they are removed the posterior changes a lot even if the model would be well specified. You should look at the specific observations with the high Pareto-k values, and use your domain expertise to assess whether these observations are possible “outliers” and thus not well explained by the model.

You can try improving the LOO computation with moment matching LOO which is supported by brms, but given some very high Pareto-k values it is possible that it’s not able to fix the issue.

Marginalizing the varying intercepts (aka “random effects”) would help, but brms does not yet support it automatically, and you would need to implement the integration yourself. [Roaches case study](https://users.aalto.fi/~ave/modelselection/roaches.html#5_Poisson_model_with_varying_intercept_and_integrated_LOO) shows an example how to do it in Stan code (but you could do it also in R, like brms is usually doing).
