Spectral approach to equivalent statistical quadratization and cubicization methods for nonlinear oscillators