Composition of stochastic processes governed by higher-order parabolic and hyperbolic equations