multinma
multinma copied to clipboard
Enhance add_integration function to detect and report multicollinearity issues
The existing implementation returned a generic error message when multicollinearity caused issues with the correlation matrix. This PR enhances the add_integration function by adding functionality to detect and report multicollinearity in covariates by looking at the eigenvalues of the correlation matrix. When multicollinearity is present, the function now returns a clear and informative error message to help users identify the problematic covariates.
Key Changes:
- Added a check for multicollinearity in covariates based on the correlation matrix eigenvalues.
- Provided a specific error message when multicollinearity is detected, including the names of the collinear covariates, based on near-zero eigenvalues and their corresponding variable relationships.
- Introduced a new test case in test-add_integration.R to verify the behavior of the function when multicollinearity exists.