<jupyter_start><jupyter_text>複数均衡が生まれる時には真ん中の均衡はstableじゃない。（単一の時はstable）なので端っこの二つのどちらかが現実では実現する。<jupyter_code># import modules
import numpy as np
import matplotlib.pyplot as plt
% matplotlib inline

# define best response functions
def br1(sigma2, pop, dist, alpha, beta, delta):
    return np.exp(alpha*pop + beta*dist[0] + delta*sigma2)/(1 + np.exp(alpha*pop + beta*dist[0] + delta*sigma2))
def br2(sigma1, pop, dist, alpha, beta, delta):
    return np.exp(alpha*pop + beta*dist[1] + delta*sigma1)/(1 +np.exp(alpha*pop + beta*dist[1] + delta*sigma1))

# plot function
def BR_plot(pop, dist, alpha, beta, delta):
    grid_num = 200
    grid = np.linspace(0,1,grid_num)
    BRs = np.zeros((grid_num, 2))
    for i in range(grid_num):
        BRs[i, :] = [br1(grid[i], pop, dist, alpha, beta, delta), br2(grid[i], pop, dist, alpha, beta, delta)]
    plt.plot(grid, BRs[:, 1], label = "player 2's BR function")
    plt.plot(BRs[:, 0], grid, label = "player 1's BR function")
    plt.legend()
    plt.xlabel("player 1's entry probability")
    plt.ylabel("player 2's entry probability")<jupyter_output><empty_output><jupyter_text>パラメータを弄って均衡の数を見ていく。$pop = 1, dist = [1, 1]$として、$\beta$, $\delta$, $\alpha$のみを変化させていく。 設定1　strategic substitute, small delta<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = 0
delta = 0.3

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定2　strategic complemental, small delta<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = 0
delta = -0.3

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定3　strategic substitude, big delta<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = 3
delta = -15

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定4　strategic complemetal, big delta<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = -3
delta = 15

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定5　strategic complementary, big delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = 0
delta = 10

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定5　strategic substitute, big delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = 0
beta = 0
delta = -10

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定6　preference over entry, substitute small delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = 3
beta = 0
delta = -3

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定7　preference over entry, substitute big delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = 3
beta = 0
delta = -6

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定8　preference over entry, complement big delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = 3
beta = 0
delta = 6

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>設定9　preference over exit, complement big delta, beta = 0<jupyter_code>pop = 1
dist = [2, 1]
alpha = -3
beta = 0
delta = 6

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output><jupyter_text>データを発生させるためにうまくパラメータを選ぶ<jupyter_code># strategic substitue
# betaがある程度小さくないと複数均衡にならない
pop = 1
dist = [1.2, 0.8]
alpha = 1.7
beta = -0.5
delta = -6

BR_plot(pop, dist, alpha, beta, delta)
# strategic complement
# betaがある程度大きくないと複数均衡にならない
pop = 1
dist = [1.2, 0.8]
alpha = 1.7
beta = -4.5
delta = 6

BR_plot(pop, dist, alpha, beta, delta)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14055884843353092, 'fraction_numerical': 0.0375388089189952, 'mean_word_length': 5.443636363636363, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '332624', 'license': 'MIT', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1518, 'n_words': 357, 'path': 'best_response_function.ipynb', 'repo_name': 'keiikegami/multiplicity', 'size': '3543'}