SURGroup / UQpy

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

Definition of LHS for 31 dimensions (incl. Lognormal, Gumbel) #71

Closed Voulp closed 3 years ago

Voulp commented 3 years ago

Hi!

I did not expect having to ask this but I've been banging my head on the wall for some time trying to figure out the correct way to define Lognormal and Gumbel distributions. I want them to be part of a 31-dimension Latin Hypercube Sample.

For Lognormal, I either define it by the mean and stdv of the underlying normal distribution, or by its λ & ζ parameters. From the instructions for UQpy (https://uqpyproject.readthedocs.io/en/latest/distributions_doc.html#d-continuous-distributions) I can see that s corresponds to ζ, but I am totally confused as to what loc and scale are. I understand they are shifting and stretching the distribution, but every attempt I make to set them to the corresponding λ value I have have massively failed.

For Gumbel, I understand I need to use GenExtreme. But what then? How do I get the Gumbel from it? What value of c? And how do loc and scale correspond to the correct μ and β?

Probably a very easy answer to the above. Thanks in advance!

Konstantinos

mds2120 commented 3 years ago

Hi Konstantinos, We will get back to you shortly. Thanks. Michael

AudOlivier commented 3 years ago

Hi Konstantinos,

For consistency we are using the same parameter conventions as scipy.stats.

For a lognormal defined by parameters mu and sigma (the mean and std. dev. of the underlying Gaussian distribution), you need to do Lognormal(scale=np.exp(mu), s=sigma, loc=0) in UQpy.

For a Gumbel distribution with location parameter mu and scale parameter beta, you need to set GenExtreme(loc=mu, scale=beta, c=0) in UQpy.

Hope this helps, let me know if you have any other question. Audrey

mds2120 commented 3 years ago

If this addresses your concern, please let us know so we may close the issue. Thank you. Michael

Voulp commented 3 years ago

Thank you for the answer! My only issue now is that exp(10^9) is of course too large of a number to work. How would you model, say, the lognormal variable to represent the stiffness of a material? Do you just get rid of the 9 orders of magnitude and add them later?

AudOlivier commented 3 years ago

Hi Konstantinos,

Yeah I guess I would just use a scaling factor, define your lognormal random variable theta as theta = coef stiffness where coef=1e-9 or so, so that theta has a more manageable order of magnitude. Then you recover your stiffness as theta / coef = theta 1e9.

Audrey