How to use Chi-square test to find multicollinearity?



@AishwaryaSingh can u please send the code of the for-loop used here as i am getting error in it


Hi @parul,

can you share relevant links or attach a screenshot as to which for loop code gives error where? Iā€™m not sure which question are you referring to.


i just wanted the user defined function using for-loop for comparing two variable in a dataframe saved as mydata2.Here the first column of mydata2 is CHURN which is dependant variable and all other columns from index 2 to last column is independant variable which are to be compared.

chisq_fun <- function(x){
for(x in 2:ncol(mydata2)){




@AishwaryaSingh please help me in this problem


Hi @parul19, could you tell me what are these two variables? are these strings or integers etc. Also, you want to compare the 1st value in column A with the 1st value in column B and so on, or do you want to compare each value in column A with each value in column B.