Created
January 2, 2023 19:58
-
-
Save catslovedata/e6aa16f9c050167d0a74d72050376edf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Normal distribution | |
data1 = norm.rvs(loc=MEAN, scale=ST_DEV, size=NUM_VALUES, random_state=RANDOM_SEED) | |
data_binned1 = np.histogram(data1, bins=NUM_BINS) | |
x_values1 = data_binned1[1][:-1] # Boundary values - omit the last so that we have just the left boundaries. | |
y_values1 = data_binned1[0] # Count of items in this bin. | |
data1_min, data1_q1, data1_median, data1_q3, data1_max, data1_mean = np.min(data1), np.quantile(data1, 0.25), np.quantile(data1, 0.5), np.quantile(data1, 0.75), np.max(data1), np.mean(data1) | |
# Positive skew (alpha = 5) | |
data2 = skewnorm.rvs(5, loc=MEAN, scale=ST_DEV, size=NUM_VALUES, random_state=RANDOM_SEED) | |
data_binned2 = np.histogram(data2, bins=NUM_BINS) | |
x_values2 = data_binned2[1][:-1] | |
y_values2 = data_binned2[0] | |
data2_min, data2_q1, data2_median, data2_q3, data2_max, data2_mean = np.min(data2), np.quantile(data2, 0.25), np.quantile(data2, 0.5), np.quantile(data2, 0.75), np.max(data2), np.mean(data2) | |
# Negative skew (alpha = -5) | |
data3 = skewnorm.rvs(-5, loc=MEAN, scale=ST_DEV, size=NUM_VALUES, random_state=RANDOM_SEED) | |
data_binned3 = np.histogram(data3, bins=NUM_BINS) | |
x_values3 = data_binned3[1][:-1] | |
y_values3 = data_binned3[0] | |
data3_min, data3_q1, data3_median, data3_q3, data3_max, data3_mean = np.min(data3), np.quantile(data3, 0.25), np.quantile(data3, 0.5), np.quantile(data3, 0.75), np.max(data3), np.mean(data3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment