gemmr.sample_analysis.macros.calc_p_value¶
-
gemmr.sample_analysis.macros.
calc_p_value
(estr, X, Y, permutations=999, random_state=0)¶ Calculate permutation-based p-value.
The p-value is calculated based on the attribute “assocs_[0]” of the fitted estimator.
Parameters: - estr (sklearn-style estimator) – estimator used to analyze the data, needs to be compatible with analyzers in ccapwr.sample_analysis.analyzers
- X (np.ndarray (n_samples, n_X_features)) – dataset X
- Y (np.ndarray (n_samples, n_Y_features)) – dataset Y
- permutations (int > 1 or np.ndarray (n_permutations, n_samples)) – if
int
indicates the number of permutations to perform, and all possible permutations are allowed, ifnp.ndarray
each row gives one set of permutation indices (i.e. the set of values in each row must be a permutation of [0, n_samples) and the order of columns are assumed to correspond to the order of rows of X and Y) - random_state (None, int or rng-instance) – random seed
Returns: p_value – the permutation-based p-value
Return type: float between 0 and 1