I am trying to approximate a set of quantiles from the estimated mean, variance, skewness and kurtosis of a random variable with unknown distribution. I tried to apply the Cornish-Fisher expansion of level 3, however, I run over the problem of non-monotonic patterns of estimated quantiles. According to Chernozhukov, I. Fernandez-Val and A. Galichon (2010) (https://arxiv.org/abs/0708.1627), I should rearrange the expansion to correct for the approximation error and impose monotonic pattern in estimated quantiles. However, I failed to conduct the code to correct the issue. I am just wondering is there any code (MatLab or R) that could help me ease this problem?