Trusted, Automoderated users
398
edits
|  (→Debugging Dating Tournaments:  new section) |  (→Modeling Hypergamy through programming:  new section) | ||
| Line 67: | Line 67: | ||
| [TBD] | [TBD] | ||
| == Modeling Hypergamy through programming == | |||
| 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> | |||
| from numpy import exp | |||
| def rhode(x,b): return x*(b-1)/(b-x) | |||
| def chotikapanich(x,b): return (exp(b*x)-1)/(exp(b)-1) | |||
| def pareto(x,b): return 1-(1-x)**(1-1/b) | |||
| import matplotlib.pyplot as plt | |||
| from scipy.optimize import curve_fit | |||
| from numpy import array | |||
| xdata = array([0,0.5,0.9,0.95,0.99,1]) | |||
| ydata = array([0,0.043,0.42,0.589,0.836,1]) | |||
| def demo(func): | |||
|   plt.plot(xdata, ydata, 'b-', label='data') | |||
|   popt, pcov = curve_fit(func, xdata, ydata, bounds=(0, 1000)) | |||
|   plt.plot(xdata, func(xdata, *popt), 'r-', | |||
|           label='fit: b=%5.3f' % tuple(popt)) | |||
|   plt.xlabel('x') | |||
|   plt.ylabel('y') | |||
|   plt.legend() | |||
|   plt.show() | |||
| </code> | |||
| demo(rhode) | |||
| demo(chotikapanich) | |||
| demo(pareto) | |||