In this work, an algorithm is introduced based on polynomial chaos expansions (PCEs) to tackle uncertainty quantification problems related to grating filters. Our approach adaptively constructs anisotropic PC models for the quantities of interest, accommodating varying polynomial orders. It exploits the sparsity of the PCE coefficients, which are computed using the least angles regression (LABS) sparse solver, leading to a highly efficient process. In addition, optimal experiments are designed that take advantage of the local variance of the samples, further improving the reliability of the computations. The method is applied to the uncertainty quantification of a typical resonant grating filter, demonstrating its superior efficiency, which is more than 2 orders of magnitude less usage of time demanding full-wave solvers, compared to reference techniques like Monte Carlo (MC). Specifically, the proposed method required approximately 25 calls to a full-wave solver, compared to the 20,000 calls needed by the MC approach. In addition, the constructed PCE model can very efficiently generate samples of the grating filter's quantities of interest, compared to generation by full-wave solvers, which can be used alongside a stochastic optimizer to optimize the grating filter's performance with respect to its design variables. Furthermore, improved optimization results are observed when the presented PCE algorithm is combined with Kriging interpolation. (c) 2025 Optica Publishing Group. All rights, including for text and data mining (TDM), Artificial Intelligence (AI) training, and similar technologies, are reserved.