# Effective sample size for quantile estimates

I’d like to estimate effective sample size for non-mean quantities. I don’t believe that this is currently implemented in e.g. rstan's summary function or similar (unless I missed it). I see it referred to in the writeup on rank-normalized split-Rhat here, but I’m not quite following what’s going on there well enought to get to an implementation. Is there a reasonably generic way to generate effective sample sizes for quantiles?

Thanks!

cc: @monnahc

I think you can do as.array, calculating whether a post-warmup draw is less than or equal to the threshold, and pass it back to monitor with warmup = 0.

There is no generic code for arbitrary quantities.

But for quantiles there is code available. The last sentence of Introduction in the page you link says

The code for the new split -\hat{R} and S_{\rm eff} versions and for the corresponding diagnostic plots can be found in monitornew.R and monitorplot.R, respectively.

Although it’s not explicitly mentioned the code includes also what you need. See, either function tail_ess or even better quantile_mcse as the latter computes also MCSE which is probably more useful than computing just effective sample sizes, unless you want to make local efficiency plots.