Partial Correlation Test module
causalai.models.common.CI_tests.partial_correlation
- class causalai.models.common.CI_tests.partial_correlation.PartialCorrelation
Partial Correlation test for PC algorithm when causal links have linear dependency
- __init__()
- get_correlation() float
pearson's correlation between residuals
- get_pvalue(value: float) float
See these links for the concept: https://www.statology.org/p-value-correlation-excel/ https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Book%3A_Introductory_Statistics_(OpenStax)/12%3A_Linear_Regression_and_Correlation/12.05%3A_Testing_the_Significance_of_the_Correlation_Coefficient
Why we use t-distribution and t-score for statistical significance and not Gaussian and z-score? https://www.jmp.com/en_us/statistics-knowledge-portal/t-test/t-distribution.html Basically, the standard normal or z-distribution assumes that you know the population standard deviation. The t-distribution is based on the sample standard deviation. When computing Pearson's correlation, we only have access to a scalar, which is one sample (from which distribution?).
Returns analytic p-value from Student's t-test for the Pearson correlation coefficient.
Assumes two-sided correlation. If the degrees of freedom are less than 1, numpy.nan is returned.
The null hypothesis (large p-values) is that the correlation between x and y is not significantly different from 0. For a clear understanding, this means that when p-values are closer to 0, x and y are dependent, and independent otherwise.
- Parameters:
value (float) -- Test statistic value.
- Returns:
Returns the pvalue. Larger p-values here indicate a larger likelihood of independence.
- Return type:
float
- run_test(x: ndarray, y: ndarray, z: ndarray | None = None) Tuple[float, float]
compute the test statistics and pvalues
- Parameters:
data_x (ndarray) -- input data for x
data_y (ndarray) -- input data for y
data_z (ndarray) -- input data for z
- Returns:
Returns a tuple of 2 floats-- test statistic and the corresponding pvalue
- Return type:
tuple of floats