<jupyter_start><jupyter_text>Numérica  A x B<jupyter_code>dfM = pd.read_csv(filesPath[0])[['PosA', 'PosB']]
dfS = pd.read_csv(filesPath[1])[['PosA', 'PosB']]
Z1 = dfM[['PosA', 'PosB']].to_numpy(dtype = int)
Z2 = dfM[['PosB', 'PosA']].to_numpy(dtype = int)
Z3 = dfS[['PosA', 'PosB']].to_numpy(dtype = int)
Z4 = dfS[['PosB', 'PosA']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 15):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger
dfM.corr()
dfS.corr()<jupyter_output><empty_output><jupyter_text>C x D<jupyter_code>dfM = pd.read_csv(filesPath[2])[['PosC', 'PosD']]
dfS = pd.read_csv(filesPath[3])[['PosC', 'PosD']]
Z1 = dfM[['PosC', 'PosD']].to_numpy(dtype = int)
Z2 = dfM[['PosD', 'PosC']].to_numpy(dtype = int)
Z3 = dfS[['PosC', 'PosD']].to_numpy(dtype = int)
Z4 = dfS[['PosD', 'PosC']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 15):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger
dfM.corr()
dfS.corr()<jupyter_output><empty_output><jupyter_text>E x F<jupyter_code>dfM = pd.read_csv(filesPath[4])[['PosE', 'PosF']]
dfS = pd.read_csv(filesPath[5])[['PosE', 'PosF']]
Z1 = dfM[['PosE', 'PosF']].to_numpy(dtype = int)
Z2 = dfM[['PosF', 'PosE']].to_numpy(dtype = int)
Z3 = dfS[['PosE', 'PosF']].to_numpy(dtype = int)
Z4 = dfS[['PosF', 'PosE']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 15):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger['p'] = Granger.p.round(3)
Granger
dfM.corr()
dfS.corr()<jupyter_output><empty_output><jupyter_text>Categórica  A x B<jupyter_code>dfM = pd.read_csv(filesPath[0])[['PosAUpDown', 'PosBUpDown']].rename(columns = {'PosAUpDown' : 'PosA', 'PosBUpDown' : 'PosB'})
dfS = pd.read_csv(filesPath[1])[['PosAUpDown', 'PosBUpDown']].rename(columns = {'PosAUpDown' : 'PosA', 'PosBUpDown' : 'PosB'})
dfM['PosA'] = dfM.PosA.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfM['PosB'] = dfM.PosB.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosB'] = dfS.PosB.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosA'] = dfS.PosA.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
Z1 = dfM[['PosA', 'PosB']].to_numpy(dtype = int)
Z2 = dfM[['PosB', 'PosA']].to_numpy(dtype = int)
Z3 = dfS[['PosA', 'PosB']].to_numpy(dtype = int)
Z4 = dfS[['PosB', 'PosA']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 14):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger['p'] = Granger.p.round(3)
Granger
corrAB_M = bootstrap(dfM['PosA'], dfM['PosB'], 10, 100)
corrAB_S = bootstrap(dfS['PosA'], dfS['PosB'], 10, 100)
print(f'p-value A x B (Multiplayer): {corrAB_M}')
print(f'p-value A x B (Singleplayer): {corrAB_S}')<jupyter_output>p-value A x B (Multiplayer): 0.48
p-value A x B (Singleplayer): 0.51<jupyter_text>C x D<jupyter_code>dfM = pd.read_csv(filesPath[2])[['PosCUpDown', 'PosDUpDown']].rename(columns = {'PosCUpDown' : 'PosC', 'PosDUpDown' : 'PosD'})
dfS = pd.read_csv(filesPath[3])[['PosCUpDown', 'PosDUpDown']].rename(columns = {'PosCUpDown' : 'PosC', 'PosDUpDown' : 'PosD'})
dfM['PosC'] = dfM.PosC.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfM['PosD'] = dfM.PosD.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosC'] = dfS.PosC.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosD'] = dfS.PosD.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
Z1 = dfM[['PosC', 'PosD']].to_numpy(dtype = int)
Z2 = dfM[['PosD', 'PosC']].to_numpy(dtype = int)
Z3 = dfS[['PosC', 'PosD']].to_numpy(dtype = int)
Z4 = dfS[['PosD', 'PosC']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 14):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger['p'] = Granger.p.round(3)
Granger
corrCD_M = bootstrap(dfM['PosC'], dfM['PosD'], 10, 100)
corrCD_S = bootstrap(dfS['PosC'], dfS['PosD'], 10, 100)
print(f'p-value C x D (Multiplayer): {corrCD_M}')
print(f'p-value C x D (Singleplayer): {corrCD_S}')<jupyter_output>p-value C x D (Multiplayer): 0.45
p-value C x D (Singleplayer): 0.69<jupyter_text>E x F<jupyter_code>dfM = pd.read_csv(filesPath[4])[['PosEUpDown', 'PosFUpDown']].rename(columns = {'PosEUpDown' : 'PosE', 'PosFUpDown' : 'PosF'})
dfS = pd.read_csv(filesPath[5])[['PosEUpDown', 'PosFUpDown']].rename(columns = {'PosEUpDown' : 'PosE', 'PosFUpDown' : 'PosF'})
dfM['PosE'] = dfM.PosE.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfM['PosF'] = dfM.PosF.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosE'] = dfS.PosE.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
dfS['PosF'] = dfS.PosF.map({'Stop' : 0, 'Up' : 1, 'Down' : 2})
Z1 = dfM[['PosE', 'PosF']].to_numpy(dtype = int)
Z2 = dfM[['PosF', 'PosE']].to_numpy(dtype = int)
Z3 = dfS[['PosE', 'PosF']].to_numpy(dtype = int)
Z4 = dfS[['PosF', 'PosE']].to_numpy(dtype = int)
Granger = pd.DataFrame(columns = ['Modo', 'Direction', 'Lag', 'Chi2', 'p'])
result1 = stats.grangercausalitytests(Z1, 15, addconst=True, verbose=True)
result2 = stats.grangercausalitytests(Z2, 15, addconst=True, verbose=True)
result3 = stats.grangercausalitytests(Z3, 15, addconst=True, verbose=True)
result4 = stats.grangercausalitytests(Z4, 15, addconst=True, verbose=True)
for i in range(1, 14):
    delaySon = i + 1
    ssr_ftest = result1[delaySon][0]['ssr_ftest']
    ssr_qtest = result1[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result3[delaySon][0]['ssr_ftest']
    ssr_qtest = result3[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'A->B', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result2[delaySon][0]['ssr_ftest']
    ssr_qtest = result2[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'M', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
    ssr_ftest = result4[delaySon][0]['ssr_ftest']
    ssr_qtest = result4[delaySon][0]['ssr_chi2test']
    p = ssr_qtest[1]
    q = ssr_qtest[0]
    Granger = Granger.append([{'Direction' : 'B->A', 'Modo': 'S', 'Lag' : delaySon, 'Chi2': q, 'p' : p}])
Granger['p'] = Granger.p.round(3)
Granger
corrEF_M = bootstrap(dfM['PosE'], dfM['PosF'], 10, 100)
corrEF_S = bootstrap(dfS['PosE'], dfS['PosF'], 10, 100)
print(f'p-value E x F (Multiplayer): {corrEF_M}')
print(f'p-value E x F (Singleplayer): {corrEF_S}')<jupyter_output>p-value E x F (Multiplayer): 0.53
p-value E x F (Singleplayer): 0.91
{'fraction_non_alphanumeric': 0.2231112478842899, 'fraction_numerical': 0.03400523157408832, 'mean_word_length': 5.213671128107075, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 46, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '623772', 'license': 'MIT', 'n_tokens_mistral': 6164, 'n_tokens_neox': 5864, 'n_words': 1034, 'path': 'code/Python/AnalysisGameData.ipynb', 'repo_name': 'LucGaspar/GrangerHRV', 'size': '12998'}