Expand description
Statistical diagnostic tests for linear regression assumptions.
This module provides a comprehensive suite of diagnostic tests to validate the assumptions of ordinary least squares (OLS) regression. Each test is implemented in its own file for easier maintenance.
§Available Tests
§Linearity Tests
- Rainbow Test (
rainbow.rs) - Tests whether the relationship between predictors and response is linear - Harvey-Collier Test (
harvey_collier.rs) - Tests for functional form misspecification using recursive residuals
§Heteroscedasticity Tests
- Breusch-Pagan Test (
breusch_pagan.rs) - Tests for constant variance of residuals (studentized/Koenker variant) - White Test (
white.rs) - More general test for heteroscedasticity that does not assume a specific form
§Normality Tests
- Jarque-Bera Test (
jarque_bera.rs) - Tests normality using skewness and kurtosis - Shapiro-Wilk Test (
shapiro_wilk.rs) - Powerful normality test for small to moderate samples (n ≤ 5000) - Anderson-Darling Test (
anderson_darling.rs) - Tail-sensitive test for normality
§Autocorrelation Tests
- Durbin-Watson Test (
durbin_watson.rs) - Tests for first-order autocorrelation in residuals
§Influence Measures
- Cook’s Distance (
cooks_distance.rs) - Identifies influential observations that may affect regression results
Structs§
- Cooks
Distance Result - Result of Cook’s distance analysis.
- Diagnostic
Test Result - Result of a diagnostic test.
- Durbin
Watson Result - Result of the Durbin-Watson test
- Rainbow
Single Result - Result of the Rainbow test for a single method (R or Python).
- Rainbow
Test Output - Result of the Rainbow test supporting both R and Python variants.
- White
Single Result - Result of the White test for a single method (R or Python).
- White
Test Output - Result of the White test supporting both R and Python variants.
Enums§
- Rainbow
Method - Rainbow test implementation method.
- White
Method - White test implementation method.
Functions§
- anderson_
darling_ test - Performs the Anderson-Darling test for normality of residuals.
- anderson_
darling_ test_ raw - Applies the Anderson-Darling test directly to a sample of values.
- breusch_
pagan_ test - Performs the Breusch-Pagan test for heteroscedasticity.
- cooks_
distance_ test - Computes Cook’s distance for identifying influential observations.
- durbin_
watson_ test - Durbin-Watson test for first-order autocorrelation in residuals.
- f_
p_ value - Computes a p-value from an F-statistic.
- harvey_
collier_ test - Performs the Harvey-Collier test for linearity (functional form).
- jarque_
bera_ test - Performs the Jarque-Bera test for normality of residuals.
- python_
white_ method - Performs the White test for heteroscedasticity using Python’s method.
- r_
white_ method - Performs the White test for heteroscedasticity using R’s method.
- rainbow_
test - Rainbow test with method selection (R, Python, or Both).
- shapiro_
wilk_ test - Performs the Shapiro-Wilk test for normality of residuals.
- shapiro_
wilk_ test_ raw - Applies the Shapiro-Wilk test directly to a sample of values.
- two_
tailed_ p_ value - Computes a two-tailed p-value from a t-statistic.
- validate_
regression_ data - Validates regression input data for dimensions and finite values.
- white_
test - Performs the White test for heteroscedasticity.