はじめに
両親の身長が子供の身長に影響を与えることは既知の事実ですが、ではある集団について身長が与えられたとき、次の世代、そのまた次の世代の身長はどう変遷していくかをシミュレートしてみました。
シミュレーション
式
男子= (両親の身長の合計+13)/ 2+2
女子= (両親の身長の合計-13)/ 2+2
https://keisan.casio.jp/exec/system/1372142265
男子・女子の平均身長
26-29歳 男子 平均171.8cm 標準偏差6.7cm
26-29歳 男子 平均157.9cm 標準偏差5.8cm
https://www.e-stat.go.jp/dbview?sid=0003224177
コード
# male height
def mheight(x,y):
mu = (x + y + 13) / 2 + 2
return np.random.normal(mu, 6.7, 1)[0]
# female height
def fheight(x,y):
mu = (x + y - 13) / 2 + 2
return np.random.normal(mu, 5.8, 1)[0]
def simulate():
# number of men of women
n = 100
# number of generation
niter = 100
# men's height
m = np.random.normal(171.8, 6.7, n)
# women's height
f = np.random.normal(157.9, 5.8, n)
mmean = [np.mean(m)]
mstd = [np.std(m)]
fmean = [np.mean(f)]
fstd = [np.std(f)]
for i in range(niter):
m = np.random.permutation(m)
mf = [[mheight(x,y), fheight(x,y)] for x,y in zip(m,f)]
mf = list(zip(*mf))
m, f = mf
mmean.append(np.mean(m))
mstd.append(np.std(m))
fmean.append(np.mean(f))
fstd.append(np.std(f))
return mmean, mstd, fmean, fstd
mmean, mstd, fmean, fstd = simulate()
plt.plot(mmean)
plt.plot(fmean)
値が徐々に上がって爆発してしまいました。では、身長の計算式を微調整してもう一度試します。
# male height
def mheight(x,y):
# mu = (x + y + 13) / 2 + 2
mu = (x + y + 13) / 2 # <- it's changed here
return np.random.normal(mu, 6.7, 1)[0]
# female height
def fheight(x,y):
# mu = (x + y - 13) / 2 + 2
mu = (x + y - 13) / 2 # <- it's changed here
return np.random.normal(mu, 5.8, 1)[0]
値が安定しました。+2の項はもしかしたら、食の欧米化により世代間で平均身長が上がっていることを考慮しているのかもしれません。ですが、その影響はいつかは飽和するため上に上げたような異様な身長の上昇が現れると考えられます。
以上です。