  We propose a robust method for constructing conditionally valid prediction
intervals based on models for conditional distributions such as quantile and
distribution regression. Our approach can be applied to important prediction
problems including cross-sectional prediction, k-step-ahead forecasts,
synthetic controls and counterfactual prediction, and individual treatment
effects prediction. Our method exploits the probability integral transform and
relies on permuting estimated ranks. Unlike regression residuals, ranks are
independent of the predictors, allowing us to construct conditionally valid
prediction intervals under heteroskedasticity. We establish approximate
conditional validity under consistent estimation and provide approximate
unconditional validity under model misspecification, overfitting, and with time
series data. We also propose a simple "shape" adjustment of our baseline method
that yields optimal prediction intervals.
