Loo plot label only Pareto k > 0.7?

Is there any way to adjust the threshold for label_points ? It seems to be at 0.5, but I would like to use 0.7.

Thank you !!

> packageVersion("loo")
[1] ‘2.3.1’
> packageVersion("rstan")
[1] ‘2.19.2’
> loo1 <- loo(stan_fit)
Warning message:
Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
> plot(loo1, label_points = TRUE)

I don’t think it’s adjustable currently, but we should add a threshold argument. In the meantime here’s some ggplot2 code that should do it:

khat <- pareto_k_values(loo1)
kdata <- data.frame(Index = seq_along(khat), khat = khat, bad = khat > 0.7)
ggplot(kdata, aes(x = Index, y = khat, label = Index)) + 
  geom_hline(yintercept = 0.7, size = 0.25, linetype = 2, color = "gray") +
  geom_point(data = subset(kdata, !bad), size = 0.5) + 
  geom_text(data = subset(kdata, bad), color = "red")
2 Likes

perfect, thank you !!