SURGroup / UQpy

UQpy (Uncertainty Quantification with python) is a general purpose Python toolbox for modeling uncertainty in physical and mathematical systems.
MIT License
266 stars 75 forks source link

Wrong usage of the Nataf transformation #70

Open regislebrun opened 3 years ago

regislebrun commented 3 years ago

I can see two issues in the way the Nataf transformation is defined In Transformation.py:

You could improve a lot your module by making the link between the isoprobabilistic transformations and the probabilistic model more oriented: the transformation is conditioned by the model, not the other way around. You can have a look at the OpenTURNS project (www.openturns.org) and more specifically the Uncertainty/Algorithm/Transformation folder of the sources to have a possible implementation of it. The only fully generic transformation you can rely upon is the Rosenblatt transformation, also available in OpenTURNS.

mds2120 commented 3 years ago

Hi Regis, We will look into your concerns in detail and respond soon. Michael

mds2120 commented 3 years ago

Hi Regis, I believe you may be somehow misunderstanding our implementation of the Nataf transformation as I am not able to see the inconsistency between your statements and the manner in which our code is implemented.

We do not present Nataf "as a means to induce correlation between random variables" as you suggest. As you can see in the documentation (https://uqpyproject.readthedocs.io/en/latest/transformations_doc.html), the Nataf transformation is defined as the CDF-based mapping from a vector of arbitrarily distributed random variables X (having known marginals F_i(X_i) and Gaussian copula) to a vector of standard normal random variables Z. If the variables in X are linearly correlated, the Nataf transformation will not produce independent Gaussian random variables, as I believe you suggest. Instead, the Nataf transformation will produce linearly correlated normal random variables. One cannot analytically compute this linear correlation of the Gaussian random vector although it can be determined using the ITAM. See the attached paper on the ITAM, which was written for stochastic translation processes (the stochastic process extension of Nataf) but is equally applicable to random vectors.

Of course, it may arise that the user prescribes a random vector with marginals and correlation matrix that are incompatible with the Nataf model. That is, there are certain well-defined combinations of marginal distributions and correlations for which it is impossible to find a correlated Gaussian random vector that maps to this particular pair of marginals and correlations. This is the well-known Nataf incompatibility to which you refer in your question. The ITAM method is built exactly for this case. It is meant to identify a normal random vector Z and the associated linear correlation matrix that will map as close as possible to the Nataf incompatible vector with incompatible marginals and (non-Gaussian) linear correlation. This leverages the so-called correlation distortion that can be computed directly from the marginal distributions and Gaussian correlation (see the equation for xi_ij in the documentation link provided above).

I hope this clarifies our implementation from a theory perspective. That said, I still have some questions regarding your suggestion about its implementation. The following statement is not clear to me: "You could improve a lot your module by making the link between the isoprobabilistic transformations and the probabilistic model more oriented: the transformation is conditioned by the model, not the other way around." On preliminary investigation, I see some differences in the structure of our code and OpenTurns. Specifically, OpenTurns has broken out various separate classes for Nataf and InverseNataf and it has additional capability related to the generalized Nataf for elliptical copulas. UQpy, on the other hand, includes both Nataf and its inverse in a single class that also deals with the case of linearly correlated random variables. OpenTurns does not seem to deal with this case of linearly correlated random variables and correlation distortion. Please correct me if I'm wrong on that point.

Thanks for your comments and please clarify if I have misunderstood you. Michael

Kim_Shields_CaS_2015.pdf

regislebrun commented 3 years ago

Hi Michael, I just read the documentation of the Nataf transformation. I am a little bit surprised by the following points:

To help you in your investigations (as you started to look at our code) here is the list of transformations available in OpenTURNS, all located into the Uncertainty/Algorithm/Transformation root directory:

Sorry for my bad english, I do my best but past midnight it becomes even worst!

Régis

mds2120 commented 3 years ago

Regis, thanks for your detailed response.

To your individual points:

And thanks for the pointers wrt OpenTURNS. No question we will study your code carefully when considering extensions to these parts of our code.

In the end, it seems we are of similar mind on many of these matters and I hope that my responses have helped to clarify.

Best, Michael.

P.S. No need to apologize. I had no trouble with your English.