N_comparisons = 100
# simplified ground truth:
# 1. symmetric: beta_A = beta_B
# 2. no interaction: beta_AB = 0
# 3. beta_0 = 1 = beta_{A/B}
beta_0, beta_A, beta_B, beta_AB = 1, 1, 1, 0
fact_A, fact_B = factorial_estimate(beta_0, beta_A, beta_B, beta_AB, N_comparisons)
ofat_A, ofat_B = ofat_estimate(beta_0, beta_A, beta_B, beta_AB, N_comparisons, fact_A, fact_B)
N_rep_range = range(1,len(ofat_A)+1)
intersect_A = interpolate(ofat_A, fact_A)
intersect_B = interpolate(ofat_B, fact_B)
#
plt.figure(figsize=(12,6))
fontsize = 15
axA = plt.subplot(1,2,1)
axA.set_title(r'$\Delta_A = \beta_\'A-\beta_A$', fontsize=fontsize)
axB = plt.subplot(1,2,2)
axB.set_title(r'$\Delta_B = \beta_\'B-\beta_B$', fontsize=fontsize)
axA.plot(N_rep_range, ofat_A, label='Equilibrium after $N_{{rep}}={:.1f}$'.format(intersect_A))
axB.plot(N_rep_range, ofat_B, label='Equilibrium after $N_{{rep}}={:.1f}$'.format(intersect_B))
axA.axhline(y=fact_A, color='k', linestyle='--')
axB.axhline(y=fact_B, color='k', linestyle='--')
axA.legend(loc='best', fontsize=fontsize)
axB.legend(loc='best', fontsize=fontsize)
axA.set_xlabel('$N_{rep}$', fontsize=fontsize)
axA.set_ylabel(r'Error estimating $\beta_A$', fontsize=fontsize)
axB.set_xlabel('$N_{rep}$', fontsize=fontsize)
axB.set_ylabel(r'Error estimating $\beta_B$', fontsize=fontsize)