1
$\begingroup$

I am new to R and have been trying to solve this problem by myself for many hours without success.

I am conducting logistic regression and have used the glm() function for univariable analysis.

I have 15 categorical variables that I need to test for colinearity using a Cramer's V function I would like to select these variables from my data set and put them into a matrix so that I could then apply the Cramers V function to the matrix rather than performing each analysis individually.

For example, my data set is called qfdisease and it contains the variables: age, occupation, education, vetclinic, animals, state, years, gender, practice type (all these variables are categorical).

I have found age, occupation, state, education and vetclinic with a p<0.2 in my univariable analysis and would like to test them for colinearity using a Cramers V test prior to building a multivariable mode.

I am currently creating a 2x2 contingency table for each comparison then running that through the Cramers V function.

Is there any way that I can extract age, occupation, state, education and vetclinic form my qfdisease data set and create a matrix/dataframe of some description (not too sure if I have used the correct terminology) which I can then feed into the CramersV function to perform all these calculations at once?

$\endgroup$
1
  • 1
    $\begingroup$ Why don't you use directly a logistic regression with all your covariates and inspect potential multicollinearity issues (using, e.g., variance inflation factor). Also, oftentimes univariate selection of predictors is deceptive, and even not really justified from a statistical perspective, so you could directly perform a multivariate logistic regression that consider all your predictors of interest and include some form of regularization. See our model-selection tag. $\endgroup$ – chl Oct 31 '20 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.