Importance of Categorical variables in regression I am performing regression analyses in R and want to test several categorical variables consisting of more than ten classes. For example, University of graduation, profession, city, etc. The goal is to define income per year. By doing regression analysis, I get that some coefficients that characterize the importance of these variables (for example, profession is more important than a city of living). 
In addition, I need to analyze which profession is more important and graduates of which university could get a bigger income. For example, lawyers from Stanford. How can I do this? How to define the most profitable professions?
I’m a newbie in Data Science and would be really grateful for any help!!
Thanks in advance!
 A: In regression analysis, the only was to use categorical variables as covariates is by splitting them up into binary categories (e.g., instead of one variable with universities as categories, multiple binary variables for each university). In R this can be very simply achieved by turning the categorical variable to a Factor:
data <- data.frame(salary = c(100,100,120,150,160,170,60,70,80),
                   university = c("a", "a", "a", "b", "b", "b", "c", "c", "c"))
data$university <- as.factor(data$university)
summary(lm(salary~university, data))


Call:
lm(formula = salary ~ university, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-10.000  -6.667   0.000  10.000  13.333 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  106.667      6.086  17.527 2.21e-06 ***
universityb   53.333      8.607   6.197 0.000814 ***
universityc  -36.667      8.607  -4.260 0.005320 ** 

Remember, with dummy variables, the coefficients represent the difference between said category and the reference category. In this example, university B graduates, on average, make 53K more than graduates of university A (the reference category).
Note that you can change the reference category using relevel function:
data$university <- relevel(data$university, ref = 2)

This will take care of the first step. However, with multiple categorical variables with many categories, this will quickly become cumbersome. You might be well served by trying to decide, empirically or theoretically, to clump categories together - Ivy League, STEM, Humanities etc.. This will become even more important in the final step.
What you wish to do is create interaction terms. Interactions are a way of looking at the combined effect of the intersection of two (or more) variables (such as Layers from Stanford). Note, however, that having many interactions between all categories might soon become unwieldy - if you interact 20 categories with 20 categories you will end up with 361 interactions. Here, too, you can look at different interactions and using some logic choose several that make the most sense. In theory, if you do not care at all about legibility, you can use all interactions, but this will be overfitting and will likely kill significance.
