1

I am building a Logistic Regression (in R) as follows:

glm_hr1 = glm(attrition_value ~ BusinessTravel+Department+Gender,              
binomial(link="logit"), data=hr1)

The X-variables are defined as follows:

BusinessTravel 
--------------
[type=Factor]
[values="Frequently","None","Rarely"]
[Ref group = "Frequently"] 

Department
----------
[type=Factor]
[values="HR","RD","Sales"
[Ref group = "HR"]

Gender
------
[type=Factor]
[values="Male","Female"]
[Ref group = "Male"] 

summary(glm_hr1) returns the following:

Coefficients:
                     Estimate Std. Error z value Pr(>|z|)    
(Intercept)           -0.8168     0.2476  -3.298 0.000973 ***
BusinessTravelNone    -1.3738     0.2354  -5.836 5.35e-09 ***
BusinessTravelRarely  -0.6464     0.1166  -5.545 2.94e-08 ***
DepartmentRD          -0.3805     0.2387  -1.594 0.110906    
DepartmentSales        0.1187     0.2441   0.486 0.626912    
GenderFemale          -0.2086     0.1052  -1.982 0.047496 *

How do I get coefficients of : BusinessTravelFrequently DepartmentHR GenderMale

all in one summary ?

What i tried ?

I used the -1 to build my model as follows:

glm_hr2 = glm(attrition_value ~ BusinessTravel+Department+Gender -1,
                  binomial(link="logit"), data=hr1)

The output of this model was:

Coefficients:
                         Estimate Std. Error z value Pr(>|z|)    
BusinessTravelFrequently  -0.8168     0.2476  -3.298 0.000973 ***
BusinessTravelNone        -2.1905     0.3101  -7.063 1.63e-12 ***
BusinessTravelRarely      -1.4632     0.2333  -6.272 3.56e-10 ***
DepartmentRD              -0.3805     0.2387  -1.594 0.110906    
DepartmentSales            0.1187     0.2441   0.486 0.626912    
GenderFemale              -0.2086     0.1052  -1.982 0.047496 *  

The (intercept) term is gone and replaced by "BusinessTravelFrequently". I understand why this happens.

Changing the order of formula however game me coefficients for every level eg:

glm(attrition_value ~ Department+BusinessTravel+Gender -1, ....)

gave coefficients for all values for Department

glm(attrition_value ~ Gender+Department+BusinessTravel -1, ....)

gave coefficients for all values for Gender

Is there any way to get all coefficients for all factor variables in one summary ?

Is there any other way to do this ?

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Sri
  • 31
  • 4

0 Answers0