# Statistical tests to discriminate most important variables in populations

I have a dataset that looks like this :

ID | group | feature1 | feature2 | ....

01 | 1 | 100 | cat | ....

02 | 1 | 104 | dog | ....

03 | 2 | 30 | horse | .... .....

I have around 10 variables (my features). I have 8 groups and 10 000 observations. My dependant variable is the variable "group". The variable group is an ordinal variable. All the other variables are independant. Some are "count of something", some are numerical some are categorical. (The example I gave is a fake representation).

I want to know which features are significantly different between each group and which ones are the most important to describe each group. I don't want to do a PCA because I want to keep the variables themselves to explain each group. I can't take components of variables.

I am trying to do an ordinal logistic regression. I get the results for the all population : I know if one variable has an impact on the variable "group" or not but I don't know between each group where the differences are significant.

Does someone have an idea ? or give me a tip on the interpretation of the ordinal logistic regression. I started in Python the analysis but switched to R. So I am open to both options if you have librairies to give me.

## migrated from stackoverflow.comMar 20 at 20:00

This question came from our site for professional and enthusiast programmers.

I would tackle this a couple of ways. First, I would convert your categorical variables to numerical variables by creating dummy variables. Your "feature 2" would turn into the following new variables:

ID | Feature2 | Cat | Dog | Hrs
01 | cat | 1 | 0 | 0
02 | Dog | 0 | 1 | 0
03 | Hrs | 0 | 0 | 1


Now you can run a all sorts of regression packages without handling categorical variables each time.

Prior to building regression models, you need to explore your data using whatever statistical method you would like. Create visuals like correlation matrix, ect.

At this point, you can run ordinal logistic regression on the whole data set or build individual stepwise regressions on each group by sub-setting your data. Variables would show significant on the population and for each group. This should get you started.

Here is a good resource for this type of analysis in R:

Ordinal Logistic Regression

• Great ! Thanks. So I should do 8 stepwise regressions. This is not a pb if my dependant variable "group" in each stepwise regression is always equal ? – Victoire Louis Mar 20 at 22:14
• I got this error when I do a stepwise : "Error in stepAIC(full.model, direction = "both", trace = FALSE) : "AIC equals -Inf for this model" Do you Have a solution for me ? – Victoire Louis Mar 20 at 22:16
• Make the group you want to target a 1 and all other groups a 0. Run all data and switch the group binary. You can make the these dummy variables too so you don’t have to alter your dataset more than once. Then compare results. – caszboy Mar 20 at 22:51