DBA108642
DBA108642

Reputation: 2112

Python generate random right skewed gaussian with constraints

I need to generate a unit curve that is going to look like a right skewed gaussian and I have the following constraints:

Example:

Example

Is there a way to do this programmatically in python?

Upvotes: 0

Views: 138

Answers (1)

Sam Mason
Sam Mason

Reputation: 16174

as noted by @Severin, a gamma looks to be a reasonable fit. e.g:

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sps

x = np.linspace(75)
plt.plot(x, sps.gamma.pdf(x, 4) '.-')
plt.show()

if they really need to sum to 1, rather than integrate, I'd use the cdf and then use np.diff on the result

Upvotes: 1

Related Questions