vastorbit.VastFrame.corr_pvalue¶
- VastFrame.corr_pvalue(column1: str, column2: str, method: Literal['pearson', 'kendall', 'kendalla', 'kendallb', 'kendallc', 'spearman', 'spearmand', 'biserial', 'cramer'] = 'pearson') tuple[float, float]¶
Computes the Correlation Coefficient between two input VastColumns, along with its associated p-value. This calculation helps assess the strength and direction of the relationship between the two columns and provides statistical significance through the p-value.
- Parameters:
column1 (str) – Input VastColumn.
column2 (str) – Input VastColumn.
method (str, optional) –
Method to use to compute the correlation.
- pearson:
Pearson’s correlation coefficient (linear).
- spearman:
Spearman’s correlation coefficient (monotonic - rank based).
- spearmanD:
Spearman’s correlation coefficient using the DENSE RANK function instead of the RANK function.
- kendall:
Kendall’s correlation coefficient (similar trends). The method computes the Tau-B coefficient.
Warning
This method uses a CROSS JOIN during computation and is therefore computationally expensive at O(n * n), where n is the total count of the
VastFrame.
- cramer:
Cramer’s V (correlation between categories).
- biserial:
Biserial Point (correlation between binaries and a numericals).
- Returns:
(Correlation Coefficient, pvalue)
- Return type:
tuple
Examples
For this example, let’s generate a dataset and compute the Pearson correlation coefficient and its p-value between the two features: ‘x’ and ‘y’.
import vastorbit as vo data = vo.VastFrame( { "x": [1, 2, 4, 9, 10, 15, 20, 22], "y": [1, 2, 1, 2, 1, 1, 2, 1], "z": [10, 12, 2, 1, 9, 8, 1, 3], } ) data.corr_pvalue( column1 = "x", column2 = "y", method = "pearson", )
See also
VastFrame.corr(): Computes the correlation matrix.