Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaussian & LogNormal distributions #775

Closed
dhardy opened this issue Apr 15, 2019 · 5 comments
Closed

Gaussian & LogNormal distributions #775

dhardy opened this issue Apr 15, 2019 · 5 comments
Labels
F-new-int Functionality: new, within Rand T-distributions Topic: distributions

Comments

@dhardy
Copy link
Member

dhardy commented Apr 15, 2019

Negative standard deviation

Currently Normal::new checks that std_dev is not negative. I see no need to keep this check (GSL lacks it), though it should be pointed out that effectively the standard deviation will be std_dev.abs().

The only drawback is that calculations erroneously producing a negative value would no longer be detected, though I doubt this often happens (and non-negative erroneous values would still not be detected).

@dhardy dhardy changed the title Gaussian distribution: support negative std.dev Gaussian & LogNormal distributions Apr 15, 2019
@dhardy
Copy link
Member Author

dhardy commented Apr 15, 2019

LogNormals by mean and CV

For another project, we decided the most convenient way to parameterise log-normals was by the (linear) mean and coefficient of variation. Code found here, written by myself.

We should add this functionality, and clarify the parameters to LogNormal::new in the doc.

@dhardy
Copy link
Member Author

dhardy commented Apr 15, 2019

Z-scores and correlated samples

Sometimes it can be useful to save a z-score (sample from a standard normal), and use it to sample from a parameterised Normal or LogNormal distribution, allowing correlated samples or a disconnect between the RNG machinery and parmeterisation.

Additionally, it is possible to generate partially-correlated z-scores (with correlation measured in linear space for Normal samples, or in log-space for LogNormal samples).

Example code for this here (also written by myself).

@vks
Copy link
Collaborator

vks commented Apr 15, 2019

We should add this functionality, and clarify the parameters to LogNormal::new in the doc.

I tried to clarify the parameter names in 466a0fc.

@dhardy dhardy added F-new-int Functionality: new, within Rand T-distributions Topic: distributions labels Jun 4, 2019
@vks
Copy link
Collaborator

vks commented May 7, 2021

@dhardy Can this be closed?

@dhardy
Copy link
Member Author

dhardy commented May 8, 2021

Yes, I think so.

@dhardy dhardy closed this as completed May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-new-int Functionality: new, within Rand T-distributions Topic: distributions
Projects
None yet
Development

No branches or pull requests

2 participants