StochasticProcess

The StochasticProcess module consists of classes and functions to generate samples of stochastic processes from prescribed properties of the process (e.g. power spectrum, bispectrum and/or autocorrelation function). The existing classes rely on stochastic expansions taking the following general form,

\[A(x) = \sum_{i=1}^N \theta(\omega) \phi(x),\]

such that the process can be expressed in terms of a set of uncorrelated random variables, \(\theta(\omega)\), and deterministic basis functions \(\phi(x)\).

The StochasticProcess module supports simulation of uni-variate, multi-variate, multi-dimensional, Gaussian and non-Gaussian stochastic processes. Gaussian stochasitc processes can be simulated using the widely-used Spectral Representation Method (1, 2, 3, 4) and the Karhunen-Loeve Expansion (5, 6, 7). Non-Gaussian stochastic processes can be generated through higher-order spectral representations (8, 9, 10) or through a nonlinear transformation from a Gaussian stochastic process to a prescribed marginal distribution using translation process theory 11. Modeling of arbitrarily distributed random processes with specified correlation and/or power spectrum can be performed using the Iterative Translation Approximation Method (ITAM) (12, 13) for inverse translation process modeling.

The module currently contains the following classes:

  • SRM: Class for simulation of Gaussian stochastic processes and random fields using the Spectral Representation Method.

  • BSRM: Class for simulation of third-order non-Gaussian stochastic processes and random fields using the Bispectral Representation Method.

  • KLE: Class for simulation of stochastic processes using the Karhunen-Loeve Expansion.

  • Translation: Class for transforming a Gaussian stochastic process to a non-Gaussian stochastic process with prescribed marginal probability distribution.

  • InverseTranslation: Call for identifying an underlying Gaussian stochastic process for a non-Gaussian process with prescribed marginal probability distribution and autocorrelation function / power spectrum.

As with other modules of UQpy, adding simulation methods requires the user to build a new class to support the desired functionality. It does not require modification of any existing classes or methods.

Spectral Representation Method

The Spectral Representation Method (SRM) expands the stochastic process in a Fourier-type expansion of cosines. The version of the SRM implemented in UQpy uses a summation of cosines with random phase angles as:

\[A(t) = \sqrt{2}\sum_{i=1}^N\sqrt{2S(\omega_i)\Delta\omega}\cos(\omega_i t+\phi_i)\]

where \(S(\omega_i)\) is the discretized power spectrum at frequency \(\omega_i\), \(\Delta\omega\) is the frequency discretization, and \(\phi_i\) are random phase angles uniformly distributed in \([0, 2\pi]\). For computational efficiency, the SRM is implemented using the Fast Fourier Transform (FFT).

SRM Class Descriptions

class UQpy.StochasticProcess.SRM(nsamples, power_spectrum, time_interval, frequency_interval, number_time_intervals, number_frequency_intervals, random_state=None, verbose=False)[source]

A class to simulate stochastic processes from a given power spectrum density using the Spectral Representation Method. This class can simulate uni-variate, multi-variate, and multi-dimensional stochastic processes. The class uses Singular Value Decomposition, as opposed to Cholesky Decomposition, to ensure robust, near-positive definite multi-dimensional power spectra.

Input:

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    The run method is automatically called if nsamples is provided. If nsamples is not provided, then the SRM object is created but samples are not generated.

  • power_spectrum (list or numpy.ndarray):

    The discretized power spectrum.

    For uni-variate, one-dimensional processes power_spectrum will be list or ndarray of length number_frequency_intervals.

    For multi-variate, one-dimensional processes, power_spectrum will be a list or ndarray of size (number_of_variables, number_of_variables, number_frequency_intervals).

    For uni-variate, multi-dimensional processes, power_spectrum will be a list or ndarray of size (number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1])

    For multi-variate, multi-dimensional processes, power_spectrum will be a list or ndarray of size (number_of_variables, number_of_variables, number_frequency_intervals[0], … number_frequency_intervals[number_of_dimensions-1]`).

  • time_interval (list or numpy.ndarray):

    Length of time discretizations (\(\Delta t\)) for each dimension of size number_of_dimensions.

  • frequency_interval (list or numpy.ndarray):

    Length of frequency discretizations (\(\Delta \omega\)) for each dimension of size number_of_dimensions.

  • number_frequency_intervals (list or numpy.ndarray):

    Number of frequency discretizations for each dimension of size number_of_dimensions.

  • number_time_intervals (list or numpy.ndarray):

    Number of time discretizations for each dimensions of size number_of_dimensions.

  • random_state (None or int or numpy.random.RandomState object):

    Random seed used to initialize the pseudo-random number generator. Default is None.

    If an integer is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

  • verbose (Boolean):

    A boolean declaring whether to write text to the terminal.

Attributes:

  • samples (ndarray):

    Generated samples.

    The shape of the samples is (nsamples, number_of_variables, number_time_intervals[0], …, number_time_intervals[number_of_dimensions-1])

  • number_of_dimensions (int):

    The dimensionality of the stochastic process.

  • number_of_variables (int):

    Number of variables in the stochastic process.

  • phi (ndarray):

    The random phase angles used in the simulation of the stochastic process.

    The shape of the phase angles (nsamples, number_of_variables, number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1])

Methods

run(nsamples)[source]

Execute the random sampling in the SRM class.

The run method is the function that performs random sampling in the SRM class. If nsamples is provided when the SRM object is defined, the run method is automatically called. The user may also call the run method directly to generate samples. The run method of the SRM class can be invoked many times and each time the generated samples are appended to the existing samples.

Input:

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    If the run method is invoked multiple times, the newly generated samples will be appended to the existing samples.

Output/Returns:

The run method has no returns, although it creates and/or appends the samples attribute of the SRM class.

Third-order Spectral Representation Method

The third-order Spectral Representation Method (or Bispectral Representation Method) is a generalization of the SRM for processes posessing a known power spectrum and bispectrum. Implementation follows from references 8 and 9. The multi-variate formulation from reference 10 is not currently implemented.

BSRM Class Descriptions

class UQpy.StochasticProcess.BSRM(nsamples, power_spectrum, bispectrum, time_interval, frequency_interval, number_time_intervals, number_frequency_intervals, case='uni', random_state=None, verbose=False)[source]

A class to simulate non-Gaussian stochastic processes from a given power spectrum and bispectrum based on the 3-rd order Spectral Representation Method. This class can simulate uni-variate, one-dimensional and multi-dimensional stochastic processes.

Input:

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    The run method is automatically called if nsamples is provided. If nsamples is not provided, then the BSRM object is created but samples are not generated.

  • power_spectrum (list or numpy.ndarray):

    The discretized power spectrum.

    For uni-variate, one-dimensional processes power_spectrum will be list or ndarray of length number_frequency_intervals.

    For uni-variate, multi-dimensional processes, power_spectrum will be a list or ndarray of size (number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1])

  • bispectrum (list or numpy.ndarray):

    The prescribed bispectrum.

    For uni-variate, one-dimensional processes, bispectrum will be a list or ndarray of size (number_frequency_intervals, number_frequency_intervals)

    For uni-variate, multi-dimensional processes, bispectrum will be a list or ndarray of size (number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1], number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1])

  • time_interval (list or numpy.ndarray):

    Length of time discretizations (\(\Delta t\)) for each dimension of size number_of_dimensions.

  • frequency_interval (list or numpy.ndarray):

    Length of frequency discretizations (\(\Delta \omega\)) for each dimension of size number_of_dimensions.

  • number_frequency_intervals (list or numpy.ndarray):

    Number of frequency discretizations for each dimension of size number_of_dimensions.

  • number_time_intervals (list or numpy.ndarray):

    Number of time discretizations for each dimensions of size number_of_dimensions.

  • random_state (None or int or numpy.random.RandomState object):

    Random seed used to initialize the pseudo-random number generator. Default is None.

    If an integer is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

  • verbose (Boolean):

    A boolean declaring whether to write text to the terminal.

Attributes:

  • samples (ndarray):

    Generated samples.

    The shape of the samples is (nsamples, number_of_variables, number_time_intervals[0], …, number_time_intervals[number_of_dimensions-1])

  • number_of_dimensions (int):

    The dimensionality of the stochastic process.

  • number_of_variables (int):

    Number of variables in the stochastic process.

  • phi (ndarray):

    The random phase angles used in the simulation of the stochastic process.

    The shape of the phase angles (nsamples, number_of_variables, number_frequency_intervals[0], …, number_frequency_intervals[number_of_dimensions-1])

  • b_ampl (ndarray):

    The amplitude of the bispectrum.

  • b_real (ndarray):

    The real part of the bispectrum.

  • b_imag (ndarray):

    The imaginary part of the bispectrum.

  • biphase (ndarray):

    The biphase values of the bispectrum.

  • pure_power_spectrum (ndarray):

    The pure part of the power spectrum.

  • bc2 (ndarray):

    The bicoherence values of the power spectrum and bispectrum.

  • sum_bc2 (ndarray):

    The sum of the bicoherence values for single frequencies.

Methods

run(nsamples)[source]

Execute the random sampling in the BSRM class.

The run method is the function that performs random sampling in the BSRM class. If nsamples is provided, the run method is automatically called when the BSRM object is defined. The user may also call the run method directly to generate samples. The run method of the BSRM class can be invoked many times and each time the generated samples are appended to the existing samples.

** Input:**

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    If the run method is invoked multiple times, the newly generated samples will be appended to the existing samples.

Output/Returns:

The run method has no returns, although it creates and/or appends the samples attribute of the BSRM class.

Karhunen Loève Expansion

The Karhunen Loève Expansion expands the stochastic process as follows:

\[A(x) = \sum_{i=1}^N \sqrt{\lambda_i} \theta_i(\omega)f_i(x)\]

where \(\theta_i(\omega)\) are uncorrelated standardized random variables and \(\lambda_i\) and \(f_i(x)\) are the eigenvalues and eigenvectors repsectively of the covariance function \(C(x_1, x_2)\).

KLE Class Descriptions

class UQpy.StochasticProcess.KLE(nsamples, correlation_function, time_interval, threshold=None, random_state=None, verbose=False)[source]

A class to simulate stochastic processes from a given auto-correlation function based on the Karhunen-Loeve Expansion

Input:

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    The run method is automatically called if nsamples is provided. If nsamples is not provided, then the KLE object is created but samples are not generated.

  • correlation_function (list or numpy.ndarray):

    The correlation function of the stochastic process of size (number_time_intervals, number_time_intervals)

  • time_interval (float):

    The length of time discretization.

  • threshold (int):

    The threshold number of eigenvalues to be used in the expansion.

  • random_state (None or int or numpy.random.RandomState object):

    Random seed used to initialize the pseudo-random number generator. Default is None.

    If an integer is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

  • verbose (Boolean):

    A boolean declaring whether to write text to the terminal.

Attributes:

  • samples (ndarray):

    Array of generated samples.

  • xi (ndarray):

    The independent gaussian random variables used in the expansion.

Methods

run(nsamples)[source]

Execute the random sampling in the KLE class.

The run method is the function that performs random sampling in the KLE class. If nsamples is provided when the KLE object is defined, the run method is automatically called. The user may also call the run method directly to generate samples. The run method of the KLE class can be invoked many times and each time the generated samples are appended to the existing samples.

** Input:**

  • nsamples (int):

    Number of samples of the stochastic process to be simulated.

    If the run method is invoked multiple times, the newly generated samples will be appended to the existing samples.

Output/Returns:

The run method has no returns, although it creates and/or appends the samples attribute of the KLE class.

Non-Gaussian Translation Processes

A translation processes results from the nonlinear transformation of a Gaussian stochastic process. The standard translation process, introduced and extensively studied by Grigoriu 11 and implemented in UQpy arises from the pointwise transformation of a Gaussian process through the inverse cumulative distribution function of a specified marginal probability distribution as:

\[X(t) = F^{-1}(\Phi(Y(t)))\]

where \(Y(x)\) is a Gaussian random process with zero mean and unit standard deviation, \(\Phi(x)\) is the standard normal cumulative distribution function and \(F^{-1}(\cdot)\) is the inverse cumulative distribution function of the prescribed non-Gaussian probability distribution.

The nonlinear translation in the equation above has the effect of distorting the correlation of the stochastic process. That is, if the Gaussian process has correlation function \(\rho(\tau)\) where \(\tau=t_2-t_1\) is a time lag, then the non-Gaussian correlation function of the process \(X(t)\) can be compuated as:

\[\xi(\tau) = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} F^{-1}(\Phi(y_1)) F^{-1}(\Phi(y_2)) \phi(y_1, y_2; \rho(\tau)) dy_1 dy_2\]

where \(\phi(y_1, y_2; \rho(\tau))\) is the bivariate normal probability density function having correlation \(\rho(\tau)\). This operation is known as correlation distortion and is not, in general, invertible. That is, given the non-Gaussian correlation function \(\xi(\tau) \), it is not always possible to identify a correponding Gaussian process having correlation function \(\rho(\tau)\) that can be translated to this non-Gaussian process through the equations above 11.

This gives rise to the challenge of inverse translation process modeling, where the objective is to find the an underlying Gaussian process and its correlation function such that it maps as closely as possible to the desired non-Gaussian stochastic process with its arbitrarily prescribed distribution and correlation function. This problem is solved in UQpy using the Iterative Translation Approximation Method (ITAM) developed in 12 for processes described by their power spectrum (and using SRM for simulation) and in 13 for processes described through their correlation function (and using KLE for simulation). This is implemented in the InverseTranslation class.

Translation Class Descriptions

class UQpy.StochasticProcess.Translation(dist_object, time_interval, frequency_interval, number_time_intervals, number_frequency_intervals, power_spectrum_gaussian=None, correlation_function_gaussian=None, samples_gaussian=None)[source]

A class to translate Gaussian Stochastic Processes to non-Gaussian Stochastic Processes

Input:

  • dist_object (list or numpy.ndarray):

    An instance of the UQpy Distributions class defining the marginal distribution to which the Gaussian stochastic process should be translated to.

  • time_interval (float):

    The value of time discretization.

  • frequency_interval (float):

    The value of frequency discretization.

  • number_time_intervals (int):

    The number of time discretizations.

  • number_frequency_intervals (int):

    The number of frequency discretizations.

  • power_spectrum_gaussian (‘list or numpy.ndarray’):

    The power spectrum of the gaussian stochastic process to be translated.

    power_spectrum_gaussian must be of size (number_frequency_intervals).

  • correlation_function_gaussian (‘list or numpy.ndarray’):

    The auto correlation function of the Gaussian stochastic process to be translated.

    Either the power spectrum or the auto correlation function of the gaussian stochastic process needs to be defined.

    correlation_function_gaussian must be of size (number_time_intervals).

  • samples_gaussian (list or numpy.ndarray):

    Samples of Gaussian stochastic process to be translated.

    samples_gaussian is optional. If no samples are passed, the Translation class will compute the correlation distortion.

Attributes:

  • samples_non_gaussian (numpy.ndarray):

    Translated non-Gaussian stochastic process from Gaussian samples.

  • power_spectrum_non_gaussian (numpy.ndarray):

    The power spectrum of the translated non-Gaussian stochastic processes.

  • correlation_function_non_gaussian (numpy.ndarray):

    The correlation function of the translated non-Gaussian stochastic processes obtained by distorting the Gaussian correlation function.

  • scaled_correlation_function_non_gaussian (numpy.ndarray):

    This obtained by scaling the correlation function of the non-Gaussian stochastic processes to make the correlation at ‘0’ lag to be 1

class UQpy.StochasticProcess.InverseTranslation(dist_object, time_interval, frequency_interval, number_time_intervals, number_frequency_intervals, correlation_function_non_gaussian=None, power_spectrum_non_gaussian=None, samples_non_gaussian=None)[source]

A class to perform Iterative Translation Approximation Method to find the underlying Gaussian Stochastic Processes which upon translation would yield the necessary non-Gaussian Stochastic Processes.

Input:

  • dist_object (list or numpy.ndarray):

    An instance of the UQpy Distributions class defining the marginal distribution of the non-Gaussian stochastic process.

  • time_interval (float):

    The value of time discretization.

  • frequency_interval (float):

    The value of frequency discretization.

  • number_time_intervals (int):

    The number of time discretizations.

  • number_frequency_intervals (int):

    The number of frequency discretizations.

  • power_spectrum_non_gaussian (‘list or numpy.ndarray’):

    The power spectrum of the non-Gaussian stochastic processes.

  • correlation_function_non_gaussian (‘list or numpy.ndarray’):

    The auto correlation function of the non-Gaussian stochastic processes.

    Either the power spectrum or the auto correlation function of the Gaussian stochastic process needs to be defined.

  • samples_non_gaussian (list or numpy.ndarray):

    Samples of non-Gaussian stochastic processes.

    samples_non_gaussian is optional. If no samples are passed, the InverseTranslation class will compute the underlying Gaussian correlation using the ITAM.

Attributes:

  • samples_gaussian (numpy.ndarray):

    The inverse translated Gaussian samples from the non-Gaussian samples.

  • power_spectrum_gaussian (numpy.ndarray):

    The power spectrum of the inverse translated Gaussian stochastic processes.

  • correlation_function_gaussian (numpy.ndarray):

    The correlation function of the inverse translated Gaussian stochastic processes.

  • scaled_correlation_function_non_gaussian (numpy.ndarray):

    This obtained by scaling the correlation function of the Gaussian stochastic processes to make the correlation at ‘0’ distance to be 1

1

Shinozuka, M. and Jan, C. M. (1972). “Digital simulation of random processes and its applications,” Journal of Sound and Vibration. 25: 111–128.

2

Shinozuka, M. and Deodatis, G. (1991) “Simulation of Stochastic Processes by Spectral representation” Applied Mechanics Reviews. 44.

3

Shinozuka, M. and Deodatis, G. (1996) “Simulation of multi-dimensional Gaussian stochastic fields by spectral representation,” Applied Mechanics Reviews. 49: 29–53.

4

Deodatis, G. “Simulation of Ergodic Multivariate Stochastic Processes,” Journal of Engineering Mechanics. 122: 778–787.

5

Huang, S.P., Quek, S. T., and Phoon, K. K. (2001). “Convergence study of the truncated Karhunen-Loeve expansion for simulation of stochastic processes,” International Journal for Numerical Methods in Engineering. 52: 1029–1043.

6

Phoon K.K., Huang S.P., Quek S.T. (2002). “Simulation of second-order processes using Karhunen–Loève expansion.” Computers and Structures 80(12):1049–60.

7

Betz, W., Papaioannou, I., & Straub, D. (2014). “Numerical methods for the discretization of random fields by means of the Karhunen–Loève expansion.” Computer Methods in Applied Mechanics and Engineering, 271: 109-129.

8(1,2)

Shields, M.D. and Kim, H. (2017). “Simulation of higher-order stochastic processes by spectral representation,” Probabilistic Engineering Mechanics. 47: 1-15.

9(1,2)

Vandanapu, L. and Shields, M.D. (2020). “3rd-order Spectral Representation Methods: Multi-dimensional random fields with fast Fourier transform implementation.” arXiv:1910.06420

10(1,2)

Vandanapu, L. and Shields, M.D. (2020). “3rd-order Spectral Representation Methods: Ergodic multi-variate random processes with fast Fourier transform.” arXiv:1910.06420

11(1,2,3)

Grigoriu, M. (1995). “Applied Non-Gaussian Processes,” Pretice Hall.

12(1,2)

Shields, M.D., Deodatis, G., and Bocchini, P. (2011). “A simple and efficient methodology to approximate a general non-Gaussian stationary stochastic process by a translation process,” Probabilistic Engineering Mechanics. 26: 511-519.

13(1,2)

Kim, H. and Shields, M.D. (2105). “Modeling strongly non-Gaussian non-stationary stochastic processes using the Iterative Translation Approximation Method and Karhunen–Loève expansion,” Computers and Structures. 161: 31-42.