How to use Chi-square test to find multicollinearity?

multi_collinearity
chi-square-test

#21

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


#22

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.


#23

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)){

chisq.test(mydata2[,1],mydata2[,x])
}
}

chi_tab<-data.frame(apply(mydata2,2,FUN=chisq_fun))


#24

@AishwaryaSingh please help me in this problem


#25

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.