Performs data validation, missing value imputation, and variance checks on input matrices to prepare them for factor analysis. Handles dimension compatibility, NA values, and zero-variance columns.
diagnose_data(X_matrix, Y_matrix, verbose = TRUE)List with components:
X_matrixCleaned and prepared X matrix.
Y_matrixCleaned and prepared Y matrix.
Numeric matrix or data frame of X variables (e.g., Marxist prices).
Numeric matrix or data frame of Y variables (e.g., market prices/CPI).
Logical; print diagnostic information. Default TRUE.
The function:
Converts to matrix format if needed
Validates dimensional compatibility
Imputes missing values via interpolation (using zoo if available)
Adds minimal noise to zero-variance columns
Reports diagnostic information