Trusted, Automoderated users
398
edits
(→Modeling Hypergamy through programming: new section) |
|||
Line 71: | Line 71: | ||
Using Hinge data as a strating point, one can demonstrate the basic regression of hypergamy. Rhode's coefficient at 1.08 and C-coefficient at 9.607 are better curve-fit than pareto's index being 1.398. | Using Hinge data as a strating point, one can demonstrate the basic regression of hypergamy. Rhode's coefficient at 1.08 and C-coefficient at 9.607 are better curve-fit than pareto's index being 1.398. | ||
<code> | <code> | ||
from numpy import exp | from numpy import exp | ||
Line 76: | Line 77: | ||
def chotikapanich(x,b): return (exp(b*x)-1)/(exp(b)-1) | def chotikapanich(x,b): return (exp(b*x)-1)/(exp(b)-1) | ||
def pareto(x,b): return 1-(1-x)**(1-1/b) | def pareto(x,b): return 1-(1-x)**(1-1/b) | ||
import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
from scipy.optimize import curve_fit | from scipy.optimize import curve_fit | ||
from numpy import array | from numpy import array | ||
xdata = array([0,0.5,0.9,0.95,0.99,1]) | xdata = array([0,0.5,0.9,0.95,0.99,1]) | ||
ydata = array([0,0.043,0.42,0.589,0.836,1]) | ydata = array([0,0.043,0.42,0.589,0.836,1]) | ||
def demo(func): | def demo(func): | ||
plt.plot(xdata, ydata, 'b-', label='data') | plt.plot(xdata, ydata, 'b-', label='data') | ||
popt, pcov = curve_fit(func, xdata, ydata, bounds=(0, 1000)) | popt, pcov = curve_fit(func, xdata, ydata, bounds=(0, 1000)) | ||
plt.plot(xdata, func(xdata, *popt), 'r-', | plt.plot(xdata, func(xdata, *popt), 'r-', | ||
label='fit: b=%5.3f' % tuple(popt)) | label='fit: b=%5.3f' % tuple(popt)) | ||
plt.xlabel('x') | plt.xlabel('x') | ||
plt.ylabel('y') | plt.ylabel('y') | ||
plt.legend() | plt.legend() | ||
plt.show() | plt.show() | ||
demo(rhode) | demo(rhode) | ||
demo(chotikapanich) | demo(chotikapanich) | ||
demo(pareto) | demo(pareto) | ||
</code> | |||
Also extending this to the Tinder Distribution Study, 5.952 C-index works better than 1.119 as Rhode's coefficient, as Rhode's often underpredict the power of the top 20% of men. |