stefantkeller

doe-intro_fig_Nrep_ofat_vs_factorial

Dec 18th, 2022 (edited)
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | Source Code | 0 0
  1. N_comparisons = 100
  2. # simplified ground truth:
  3. # 1. symmetric: beta_A = beta_B
  4. # 2. no interaction: beta_AB = 0
  5. # 3. beta_0 = 1 = beta_{A/B}
  6. beta_0, beta_A, beta_B, beta_AB = 1, 1, 1, 0
  7.  
  8.  
  9. fact_A, fact_B = factorial_estimate(beta_0, beta_A, beta_B, beta_AB, N_comparisons)
  10. ofat_A, ofat_B = ofat_estimate(beta_0, beta_A, beta_B, beta_AB, N_comparisons, fact_A, fact_B)
  11.  
  12. N_rep_range = range(1,len(ofat_A)+1)
  13.  
  14. intersect_A = interpolate(ofat_A, fact_A)
  15. intersect_B = interpolate(ofat_B, fact_B)
  16.  
  17. #
  18. plt.figure(figsize=(12,6))
  19. fontsize = 15
  20.  
  21. axA = plt.subplot(1,2,1)
  22. axA.set_title(r'$\Delta_A = \beta_\'A-\beta_A$', fontsize=fontsize)
  23. axB = plt.subplot(1,2,2)
  24. axB.set_title(r'$\Delta_B = \beta_\'B-\beta_B$', fontsize=fontsize)
  25.  
  26. axA.plot(N_rep_range, ofat_A, label='Equilibrium after $N_{{rep}}={:.1f}$'.format(intersect_A))
  27. axB.plot(N_rep_range, ofat_B, label='Equilibrium after $N_{{rep}}={:.1f}$'.format(intersect_B))
  28.  
  29. axA.axhline(y=fact_A, color='k', linestyle='--')
  30. axB.axhline(y=fact_B, color='k', linestyle='--')
  31. axA.legend(loc='best', fontsize=fontsize)
  32. axB.legend(loc='best', fontsize=fontsize)
  33.  
  34. axA.set_xlabel('$N_{rep}$', fontsize=fontsize)
  35. axA.set_ylabel(r'Error estimating $\beta_A$', fontsize=fontsize)
  36. axB.set_xlabel('$N_{rep}$', fontsize=fontsize)
  37. axB.set_ylabel(r'Error estimating $\beta_B$', fontsize=fontsize)
  38.    
Advertisement
Add Comment
Please, Sign In to add comment