# What is the best approach? Dependent binary variable, independent nominal categorical variables

I am relatively new in statistics and I would like to prove the value of the method to my superiors, instead of relying on heuristics.

I would like to know what would be the best approach for the following case I have:

-A single dependent binary variable,

-Many independent nominal unordered categorical variables (with two discrete variables (number of previous events) and another discrete (or continuous) variables (age, that I can turn into a ordered categorical variable by creating bins of age groups)

I would like to find out which independent variables are important and how important are they, so I'm thinking "variance explained". I'm dealing with the population (every single event) and descriptive statistics, not inference.

I was thinking of treating everything as nominal categorical variables (even if there a two variables that are numerical), because from my understanding using the "lowest-common denominator" (like using a Chi-Square on a continuous variable) is doable (while sacrificing some statistical power, but without sacrificing significance which I don't want to do, I prefer to not reject the null hypothesis if I'm not 95% sure or more, way more if necessary).

I have read that Principal-component analysis (PCA) could be "problematic" with nominal variables so I would prefer to stay on the safe side and keep anyway from it.

Multiple correspondence analysis (MCA) seems more what I need, but my comprehension is limited (it talks of inertia more than variance explained) and I would prefer confidence intervals (to give a range of the variance explained) and p-values (to give a measure of how likely the variance explained falls in that interval) which I have trouble understanding with MCA or if that is even possible.

Cramér's V sounds interesting, but it looks like it's more a "one on one thing."

Is there a tool or approach that could give me what I'm looking for?

Also, I'd prefer a means that is relatively easy to understand as Excel and SQL are the only tool I can use, so I will have to do most of the calculations in code and loops.

• Why not use logistic regression? It doesn't matter that your data is descriptive. You will then find out what variables are important and what variables are not. And you can always run R software because it's free, and though there is a learning curve, it's relatively easy to import your data and run a logistic regression model. – JonB Oct 13 '15 at 7:49
• If I use logistic regression, will I have to binarize every variable (ex: Age-15-20: 1/0, Age-21-25: 1/0, etc...) to find out which value of the categorical variable as the biggest impact (ex: Age-15-20 could have a BIG impact, but Age-21-25 not at all)? Because, one categorical variable has about 100 possible values. I'm afraid that would be a lot of variables to fit. – user2088176 Oct 19 '15 at 15:40
• No, not at all. You can have continuous independent variables, as long as the dependent variable is binary. I'll try to write an answer later. – JonB Oct 19 '15 at 16:15

To my understanding you have a binary dependent variable and several independent variables, some categorical and some continuous. Logistic regression is the standard choice unless there are specific reasons to chose another modeling strategy, and I can't see that here. However, logistic regression in its basic form assumes that all observations (rows) are independent. That is, every row should come from a different individual. If not, you have to apply a more complex design. But let's assume that the observations are independent unless you say otherwise.

I'm not very good at excel except for really basic stuff, so I don't know how to do a logistic regression. I'm sure there are tutorials online. I don't know SQL either, so I can't help you there. But I would recommend using R. Yes, there is a bit of a learning curve, but setting it up and run a logistic regression isn't that difficult and I'll give you the basics.

You can start by downloading RStudio which is a programming environment for R I'm not sure, but I think that R itself is included when you install R. Else, you'll just have to google and find out how to download it and install it. Once you have started it, you should watch some R tutorials on youtube or do some tutorials online, that's how I did.

Ok, so now you're ready to run some logistic regression models. In R, you can first install a package that lets you run .xlsx files to import your data:

install.packages("xlsx")
library(xlsx)


Now you load your data and create a data frame that we'll call data1:

data1 <- read.xlsx("C:\whereeveryourfileis\file.xslx", sheetName="Sheet1")


Input path, file name and sheet name as appropriate. You can now take a look at your data:

View(data1)


Ok, ready for the logistic regression. We'll use the glm() function and we store it to an object called m1. y is your dependent variable and x1-x3 are independent variables (the variable names should correspond with the names in data1).

m1 <- glm(y ~ x1 + x2 + x3, data=data1, family=binomial)
summary(m1)


So, we now have a logistic regression model with three independent variables. The summary command gives you some info, perhaps most interesting to you right now are the Estimate (log odds ratios) and Pr(>|z|) columns (p-value). To get the odds ratio you can just type

exp(value_of_estimate_of_interest)


Or to get all odds ratios you can type:

exp(summary(m1)\$coef[,1])


To get the 95% confidence intervals you can type:

confint(m1)


And if you want them as odds ratios:

exp(confint(m1))


Now you can try different models as you like:

m2 <- glm(y ~ x1 + x2, data=data1, family=binomial)
m3 <- glm(y ~ x1 * x2 + x3, data=data1, family=binomial)


Etc. The * means that you also create an interaction term between x1 and x2.

I hope this helps. Good luck!

• Thank you. But isn't this method not subject to "multicollinearity"? – user2088176 Oct 21 '15 at 16:07
• Yes, you will have to check for that. – JonB Oct 21 '15 at 17:28
• Any suggestion on how to test for multicollinearity in this context? I was looking at PCA and MCA, to identify the variables that are important, and to eliminate variables that I taught were independent, but that can be explained by other independent variables. – user2088176 Oct 22 '15 at 14:53
• I'm not sure. Here's an answer to a previous question on CV, though it's perhaps not so helpful: stats.stackexchange.com/questions/18084/… . If you have reasons to believe that some variables have a high degree of multicollinearity, you can run PCA/MCA among those variables and then use the components instead. In any case, the main problem with multicollinearity seems to be that it decreases power to detect effects, so you can always run a model anyway and see what the results are. – JonB Oct 23 '15 at 5:58
• First of all, thank you. Second, should I use as input each individual case (result and factors) or the proportion (nb of positive case for criterias / nb of cases for criteria)? I’m assuming proportions. – user2088176 Nov 4 '15 at 2:11