CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
multi_comp.cpython-310.pyc64 linesDownload Raw Back to __pycache__
1o

2'�YiX�@s(ddlZdd�Zd3dd�Zddd	�ZdS)�NcCs t|�}t�d|d�t|�S)z.No frills empirical cdf used in fdrcorrection.�)�len�np�arange�float)�xZnobs�r�~E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\mne/stats/multi_comp.py�_ecdfsr4皙�����?�indepc
Cst�|�}|j}|��}t�|�}||}|��}|dvr"t|�}n|dvr<t�dt�dt|�d��}t|�|}nt	d��|||k}	|	�5�rTtt�|	�d�}6nd}7d|	d|8�<||}tj
�|ddd	��ddd	�}d||dk<||�|�}|	|�|�}	|	|fS)9aTP-value correction with False Discovery Rate (FDR).10 11    Correction for multiple comparison using FDR :footcite:`GenoveseEtAl2002`.12 13    This covers Benjamini/Hochberg for independent or positively correlated and14    Benjamini/Yekutieli for general or negatively correlated tests.15 16    Parameters17    ----------18    pvals : array_like19        Set of p-values of the individual tests.20    alpha : float21        Error rate.22    method : 'indep' | 'negcorr'23        If 'indep' it implements Benjamini/Hochberg for independent or if24        'negcorr' it corresponds to Benjamini/Yekutieli.25 26    Returns27    -------28    reject : array, bool29        True if a hypothesis is rejected, False if not.30    pval_corrected : array31        P-values adjusted for multiple hypothesis testing to limit FDR.32 33    References34    ----------35    .. footbibliography::36    )�ir�pZposcorr)�nZnegcorr��?rz&Method should be 'indep' and 'negcorr'rTN�����)r�asarray�shapeZravelZargsortr37�sumrr�38ValueError�any�maxZnonzero�minimum�39accumulateZreshape)
Zpvals�alpha�methodZ40shape_initZ
pvals_sortindZpvals_sortedZ41sortrevindZ42ecdffactor�cm�rejectZ	rejectmaxZpvals_corrected_rawZpvals_correctedrrr	�fdr_corrections.434445 rcCs4t�|�}|t|j�}|jdd�}||k}||fS)a�P-value correction with Bonferroni method.46 47    Parameters48    ----------49    pval : array_like50        Set of p-values of the individual tests.51    alpha : float52        Error rate.53 54    Returns55    -------56    reject : array, bool57        True if a hypothesis is rejected, False if not.58    pval_corrected : array59        P-values adjusted for multiple hypothesis testing to limit FDR.60    r)r)rrr�sizeZclip)ZpvalrZpval_correctedrrrr	�bonferroni_correctionJs6162r )rr)r)�numpyrr63rr rrrr	�<module>s64<
Aluode/PerceptionLabPortable · CoolFace