  Stochastic simulators are non-deterministic computer models which provide a
different response each time they are run, even when the input parameters are
held at fixed values. They arise when additional sources of uncertainty are
affecting the computer model, which are not explicitly modeled as input
parameters. The uncertainty analysis of stochastic simulators requires their
repeated evaluation for different values of the input variables, as well as for
different realizations of the underlying latent stochasticity. The
computational cost of such analyses can be considerable, which motivates the
construction of surrogate models that can approximate the original model and
its stochastic response, but can be evaluated at much lower cost.
  We propose a surrogate model for stochastic simulators based on spectral
expansions. Considering a certain class of stochastic simulators that can be
repeatedly evaluated for the same underlying random event, we view the
simulator as a random field indexed by the input parameter space. For a fixed
realization of the latent stochasticity, the response of the simulator is a
deterministic function, called trajectory. Based on samples from several such
trajectories, we approximate the latter by sparse polynomial chaos expansion
and compute analytically an extended Karhunen-Lo\`eve expansion (KLE) to reduce
its dimensionality. The uncorrelated but dependent random variables of the KLE
are modeled by advanced statistical techniques such as parametric inference,
vine copula modeling, and kernel density estimation. The resulting surrogate
model approximates the marginals and the covariance function, and allows to
obtain new realizations at low computational cost. We observe that in our
numerical examples, the first mode of the KLE is by far the most important, and
investigate this phenomenon and its implications.
