4 ms·
It's not true for any random sample of numbers. Spin up a Jupyter notebook and paste the following: %matplotlib inline import matplotlib.pyplot as plt
by jsweojtj 7y ago
It's not true for any random sample of numbers. Spin up a Jupyter notebook and paste the following:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_context('poster', font_scale=1.3)
n_values = 10000
lower_bound = 1
upper_bound = 100000
nums = np.array(
[int(str(x)[0]) for x in np.random.randint(lower_bound, upper_bound, size=n_values)]
)
fig, ax = plt.subplots(figsize=(12, 8))
sns.distplot(nums, kde=False, bins=list(range(1, 11)), ax=ax)
ax.set_xticks(list(range(1, 11)))
fig.tight_layout()
And you'll see it's essentially a uniform distribution of leading digits.
- doubleunplussed 7y agoReal world random data often doesn't have a hard maximum. Try plotting a histogram of digits of -log(rand()). (I think this gives an exponential distribution with mean 1)
- jsweojtj 7y agoI'm glad that you agree that the original post was incorrect in stating that: > Bedford's Law is apparently just a fancy name for the phenomenon where 1's appear much more frequently than 9's in any random sample of numbers. because, as my example shows, it's false for the case of random numbers sampled uniformly across five orders of magnitude. You're also right that it's possible to construct a distribution (such as taking -log(rand())) where this behavior is observed.