<jupyter_start><jupyter_text>Compare with R nptest<jupyter_code>import sys
import pandas as pd
import numpy as np
from scipy import stats, io
import seaborn as sns
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pingouin as pg
sys.path.append('../../scripts')
import fl_permute as fl
import utils
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
sns.set_style('ticks')
sns.set_context('notebook')
sns.set_palette("colorblind")<jupyter_output><empty_output><jupyter_text>Load group average connectivity and dynamics metrics (and ROI volumes).<jupyter_code>roi_vols = np.genfromtxt('../../../data/resources/BNA_ROI_volumes.txt')
sc_degree_df = pd.read_csv('../../../results/Yeh_BNA_EIR_qa_nothresh_centralities.tsv', delimiter='\t', index_col=0)
fc_degree_df = pd.read_csv('../../../results/NKI-1400_CompCorGSR_BNA_centralities.tsv', delimiter='\t', index_col=0)
ts_df = pd.read_csv('../../../results/NKI-1400_CompCorGSR_BNA_timescales_median.csv')
fc_pc = np.genfromtxt('../../../results/NKI_1400_CompCorGSR_BNA_zmat_mean_po_Louvain/MegaPart_gamma2p2_PC.txt')
fc_wmd = np.genfromtxt('../../../results/NKI_1400_CompCorGSR_BNA_zmat_mean_po_Louvain/MegaPart_gamma2p2_WMDz.txt')
sc_pc = np.genfromtxt('../../../results/Yeh_BNA_EIR_qa_nothresh_Louvain/gamma1p2_PC.txt')
sc_wmd = np.genfromtxt('../../../results/Yeh_BNA_EIR_qa_nothresh_Louvain/gamma1p2_WMDz.txt')
dat = pd.DataFrame(np.array([sc_degree_df.strength.values, fc_degree_df.strength_zmean_po.values,
                             ts_df.decay10_median.values, ts_df.decay20_median.values, ts_df.lag1_median.values, 
                             sc_wmd, fc_wmd, fc_pc, sc_pc, roi_vols]).T,
                   columns = ['sc_strength', "fc_strength", 'decay10', 'decay20', 'lag1', 'sc_wmd',
                              'fc_wmd', 'fc_pc', 'sc_pc', 'roi_vols'])<jupyter_output><empty_output><jupyter_text>Single X, Single Z<jupyter_code>x1z1_fval, x1z1_pvals, x1z1_model, x1z1_fnull = fl.mlr_perm(dat, 'fc_strength', ['sc_wmd'], ['roi_vols'], stat='fstat',
                                                            n_perms=100000, return_null=True, return_surrogates=False)
x1z1_fval
x1z1_pvals<jupyter_output><empty_output><jupyter_text>Single X, Multiple Z<jupyter_code>x1z2_fval, x1z2_pvals, x1z2_model, x1z2_fnull = fl.mlr_perm(dat, 'fc_strength', ['sc_wmd'], ['roi_vols', 'fc_pc'], stat='fstat',
                                                            n_perms=100000, return_null=True, return_surrogates=False)
x1z2_fval
x1z2_pvals<jupyter_output><empty_output><jupyter_text>Multiple X, Multiple Z<jupyter_code>x2z2_fval, x2z2_pvals, x2z2_model, x2z2_fnull = fl.mlr_perm(dat, 'fc_strength', ['sc_wmd', 'sc_pc'], ['roi_vols','fc_pc'], stat='fstat',
                                                            n_perms=100000, return_null=True, return_surrogates=False)
x2z2_fval
x2z2_pvals<jupyter_output><empty_output><jupyter_text>Multiple X, Single Z<jupyter_code>x2z1_fval, x2z1_pvals, x2z1_model, x2z1_fnull = fl.mlr_perm(dat, 'fc_strength', ['sc_wmd', 'sc_pc'], ['roi_vols'], stat='fstat',
                                                            n_perms=100000, return_null=True, return_surrogates=False)
x2z1_fval
x2z1_pvals<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13515151515151516, 'fraction_numerical': 0.03272727272727273, 'mean_word_length': 3.912202380952381, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '660416', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1304, 'n_words': 170, 'path': 'test/Compare to nptest.ipynb', 'repo_name': 'danlurie/PyPALM', 'size': '3300'}