0
$\begingroup$

I am running a logistic regression with about 60 variables. And some of my variables have NAs in their coefficients. There are no NAs in data though.

I read this question and it makes sense for me, but I am not sure how to apply it for multiple NAs in my case. I understand that I have too many variables and I need to remove many of them, but I am curious how to deal in such situations. Thanks!

Code:

library(tidymodels)

# Fit the model
lr_fit <- lr_spec %>% fit(Target ~ ., data = bank_train)

# Print a clean summary
lr_fit %>% pluck("fit") %>% summary()

Call:
stats::glm(formula = Target ~ ., family = stats::binomial, data = data)

Deviance Residuals: 
Min       1Q   Median       3Q      Max  
-1.3224  -0.4480  -0.3564  -0.2784   3.1600  

Coefficients: (12 not defined because of singularities)
                                                      Estimate Std. Error z value Pr(>|z|)    
(Intercept)                                         -1.041e+12  6.170e+11  -1.686  0.09172 .  
Cnt_children                                         8.667e-02  4.304e-02   2.014  0.04404 *  
Amt_income_total                                     5.349e-08  7.695e-08   0.695  0.48696    
Amt_credit                                          -1.508e-07  3.182e-08  -4.739 2.15e-06 ***
Amt_annuity                                          4.223e-06  8.863e-07   4.765 1.89e-06 ***
Region_population_relative                           1.678e-01  7.082e-01   0.237  0.81273    
Days_birth                                          -3.643e-05  2.643e-06 -13.781  < 2e-16 ***
Days_employed                                       -8.414e-05  4.843e-06 -17.374  < 2e-16 ***
Days_registration                                   -1.881e-05  2.439e-06  -7.710 1.26e-14 ***
Days_id_publish                                     -7.163e-05  5.309e-06 -13.492  < 2e-16 ***
Flag_mobil                                                  NA         NA      NA       NA    
Flag_emp_phone                                       2.245e+01  5.048e+04   0.000  0.99965    
Flag_work_phone                                      1.764e-01  1.983e-02   8.897  < 2e-16 ***
Flag_cont_mobile                                    -4.529e-01  1.718e-01  -2.637  0.00837 ** 
Flag_phone                                          -1.094e-01  1.874e-02  -5.837 5.33e-09 ***
Flag_email                                          -2.950e-02  3.335e-02  -0.885  0.37643    
Cnt_fam_members                                     -6.953e-02  4.122e-02  -1.687  0.09159 .  
Region_rating_client                                 2.618e-02  5.120e-02   0.511  0.60916    
Region_rating_client_w_city                          3.418e-01  5.145e-02   6.644 3.06e-11 ***
Hour_appr_process_start                             -1.042e-02  2.433e-03  -4.282 1.85e-05 ***
Reg_region_not_live_region                          -2.889e-01  1.067e-01  -2.707  0.00679 ** 
Reg_region_not_work_region                           1.638e-01  1.137e-01   1.441  0.14951    
Live_region_not_work_region                         -1.732e-01  1.128e-01  -1.536  0.12461    
Reg_city_not_live_city                               2.531e-01  3.828e-02   6.611 3.81e-11 ***
Reg_city_not_work_city                              -5.373e-02  4.246e-02  -1.265  0.20579    
Live_city_not_work_city                              1.300e-01  4.136e-02   3.142  0.00168 ** 
Obs_30_cnt_social_circle                             8.984e-02  5.420e-02   1.657  0.09745 .  
Def_30_cnt_social_circle                             1.429e-01  3.114e-02   4.589 4.44e-06 ***
Obs_60_cnt_social_circle                            -8.934e-02  5.476e-02  -1.632  0.10278    
Def_60_cnt_social_circle                             8.126e-02  3.678e-02   2.209  0.02715 *  
Days_last_phone_change                              -2.012e-04  1.026e-05 -19.617  < 2e-16 ***
Flag_document_2                                      2.266e+00  7.087e-01   3.198  0.00139 ** 
Flag_document_3                                      4.732e-01  6.411e-02   7.381 1.57e-13 ***
Flag_document_4                                     -2.291e+01  5.965e+04   0.000  0.99969    
Flag_document_5                                      4.602e-01  8.380e-02   5.492 3.98e-08 ***
Flag_document_6                                      4.364e-01  7.463e-02   5.847 5.00e-09 ***
Flag_document_7                                      8.508e-02  7.514e-01   0.113  0.90985    
Flag_document_8                                      2.261e-01  6.957e-02   3.249  0.00116 ** 
Flag_document_9                                      2.274e-01  1.493e-01   1.523  0.12772    
Flag_document_10                                    -2.433e+01  2.078e+05   0.000  0.99991    
Flag_document_11                                    -2.961e-01  1.469e-01  -2.015  0.04390 *  
Flag_document_12                                    -2.416e+01  5.332e+05   0.000  0.99996    
Flag_document_13                                    -1.258e+00  2.474e-01  -5.084 3.70e-07 ***
Flag_document_14                                    -8.512e-01  2.150e-01  -3.960 7.50e-05 ***
Flag_document_15                                    -8.609e-01  3.245e-01  -2.653  0.00799 ** 
Flag_document_16                                    -6.210e-01  9.946e-02  -6.243 4.28e-10 ***
Flag_document_17                                    -1.730e+00  1.012e+00  -1.709  0.08739 .  
Flag_document_18                                    -4.629e-01  9.919e-02  -4.666 3.07e-06 ***
Flag_document_19                                    -1.660e-01  3.190e-01  -0.520  0.60274    
Flag_document_20                                     5.308e-01  3.578e-01   1.484  0.13789    
Flag_document_21                                     2.266e-01  3.459e-01   0.655  0.51254    
`Name_contract_type_Cash loans`                      1.135e-01  6.556e-02   1.731  0.08346 .  
`Name_contract_type_Revolving loans`                        NA         NA      NA       NA    
Code_gender_F                                        1.041e+12  6.170e+11   1.686  0.09172 .  
Code_gender_M                                        1.041e+12  6.170e+11   1.686  0.09172 .  
Code_gender_XNA                                      1.041e+12  6.170e+11   1.686  0.09172 .  
Flag_own_car_N                                       2.931e-01  1.798e-02  16.301  < 2e-16 ***
Flag_own_car_Y                                              NA         NA      NA       NA    
Flag_own_realty_N                                   -1.697e-02  1.731e-02  -0.981  0.32682    
Flag_own_realty_Y                                           NA         NA      NA       NA    
Name_type_suite_Children                             3.843e-02  7.695e-02   0.499  0.61748    
Name_type_suite_Family                              -6.815e-02  2.339e-02  -2.914  0.00357 ** 
`Name_type_suite_Group of people`                    6.230e-02  2.468e-01   0.252  0.80067    
Name_type_suite_Other_A                             -3.401e-02  1.354e-01  -0.251  0.80161    
Name_type_suite_Other_B                              5.165e-02  9.280e-02   0.557  0.57784    
`Name_type_suite_Spouse, partner`                   -7.954e-02  4.028e-02  -1.975  0.04828 *  
Name_type_suite_Unaccompanied                               NA         NA      NA       NA    
Name_income_type_Businessman                        -2.194e+01  8.122e+04   0.000  0.99978    
`Name_income_type_Commercial associate`             -1.249e-01  1.951e-02  -6.401 1.55e-10 ***
`Name_income_type_Maternity leave`                   2.890e+00  9.620e-01   3.005  0.00266 ** 
 Name_income_type_Pensioner                          -2.509e+01  2.891e+05   0.000  0.99993    
`Name_income_type_State servant`                    -1.737e-01  3.865e-02  -4.496 6.93e-06 ***
 Name_income_type_Student                            -2.447e+01  1.172e+05   0.000  0.99983    
 Name_income_type_Unemployed                         -2.174e+01  2.891e+05   0.000  0.99994    
 Name_income_type_Working                                    NA         NA      NA       NA    
`Name_education_type_Academic degree`               -1.666e+00  7.152e-01  -2.329  0.01986 *  
`Name_education_type_Higher education`              -4.581e-01  2.144e-02 -21.368  < 2e-16 ***
`Name_education_type_Incomplete higher`             -2.696e-01  4.197e-02  -6.424 1.33e-10 ***
`Name_education_type_Lower secondary`                1.372e-01  6.088e-02   2.253  0.02424 *  
`Name_education_type_Secondary / secondary special`         NA         NA      NA       NA    
`Name_family_status_Civil marriage`                  1.613e-01  2.472e-02   6.525 6.80e-11 ***
 Name_family_status_Married                                  NA         NA      NA       NA    
 Name_family_status_Separated                         1.075e-01  4.910e-02   2.189  0.02859 *  
`Name_family_status_Single / not married`            6.321e-02  4.474e-02   1.413  0.15774    
 Name_family_status_Widow                                    NA         NA      NA       NA    
`Name_housing_type_Co-op apartment`                 -7.608e-02  1.301e-01  -0.585  0.55879    
`Name_housing_type_House / apartment`               -6.566e-02  3.198e-02  -2.053  0.04006 *  
`Name_housing_type_Municipal apartment`              1.281e-01  4.925e-02   2.601  0.00929 ** 
`Name_housing_type_Office apartment`                -2.770e-01  9.505e-02  -2.914  0.00356 ** 
`Name_housing_type_Rented apartment`                 8.441e-03  5.868e-02   0.144  0.88561    
`Name_housing_type_With parents`                            NA         NA      NA       NA    
 Weekday_appr_process_start_FRIDAY                   -1.008e-02  2.612e-02  -0.386  0.69959    
 Weekday_appr_process_start_MONDAY                   -4.532e-02  2.623e-02  -1.728  0.08403 .  
 Weekday_appr_process_start_SATURDAY                 -5.885e-02  2.945e-02  -1.998  0.04568 *  
 Weekday_appr_process_start_SUNDAY                   -1.188e-01  3.843e-02  -3.092  0.00199 ** 
 Weekday_appr_process_start_THURSDAY                 -4.748e-03  2.608e-02  -0.182  0.85553    
 Weekday_appr_process_start_TUESDAY                   2.704e-02  2.551e-02   1.060  0.28919    
 Weekday_appr_process_start_WEDNESDAY                        NA         NA      NA       NA    
 Organization_type_Advertising                       -7.777e+01  2.935e+05   0.000  0.99979    
 Organization_type_Agriculture                       -7.781e+01  2.935e+05   0.000  0.99979    
 Organization_type_Bank                              -7.830e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Business Entity Type 1`          -7.798e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Business Entity Type 2`          -7.790e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Business Entity Type 3`          -7.787e+01  2.935e+05   0.000  0.99979    
 Organization_type_Cleaning                          -7.778e+01  2.935e+05   0.000  0.99979    
 Organization_type_Construction                      -7.772e+01  2.935e+05   0.000  0.99979    
 Organization_type_Culture                           -7.811e+01  2.935e+05   0.000  0.99979    
 Organization_type_Electricity                       -7.808e+01  2.935e+05   0.000  0.99979    
 Organization_type_Emergency                         -7.814e+01  2.935e+05   0.000  0.99979    
 Organization_type_Government                        -7.799e+01  2.935e+05   0.000  0.99979    
 Organization_type_Hotel                             -7.824e+01  2.935e+05   0.000  0.99979    
 Organization_type_Housing                           -7.794e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 1`                -7.772e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 2`                -7.817e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 3`                -7.782e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 4`                -7.795e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 5`                -7.815e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 6`                -7.794e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 7`                -7.800e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 8`                -7.788e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 9`                -7.823e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 10`               -7.799e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 11`               -7.793e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 12`               -7.863e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Industry: type 13`               -7.824e+01  2.935e+05   0.000  0.99979    
  Organization_type_Insurance                         -7.814e+01  2.935e+05   0.000  0.99979    
  Organization_type_Kindergarten                      -7.801e+01  2.935e+05   0.000  0.99979    
 `Organization_type_Legal Services`                  -7.734e+01  2.935e+05   0.000  0.99979    
  Organization_type_Medicine                          -7.799e+01  2.935e+05   0.000  0.99979    
  Organization_type_Military                          -7.845e+01  2.935e+05   0.000  0.99979    
  Organization_type_Mobile                            -7.796e+01  2.935e+05   0.000  0.99979    
  Organization_type_Other                             -7.801e+01  2.935e+05   0.000  0.99979    
  Organization_type_Police                            -7.828e+01  2.935e+05   0.000  0.99979    
  Organization_type_Postal                            -7.783e+01  2.935e+05   0.000  0.99979    
  Organization_type_Realtor                           -7.731e+01  2.935e+05   0.000  0.99979    
  Organization_type_Religion                          -7.815e+01  2.935e+05   0.000  0.99979    
  Organization_type_Restaurant                        -7.776e+01  2.935e+05   0.000  0.99979    
  Organization_type_School                            -7.808e+01  2.935e+05   0.000  0.99979    
  Organization_type_Security                          -7.794e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Security Ministries`             -7.834e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Self-employed`                   -7.782e+01  2.935e+05   0.000  0.99979    
  Organization_type_Services                          -7.816e+01  2.935e+05   0.000  0.99979    
  Organization_type_Telecom                           -7.788e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 1`                   -7.794e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 2`                   -7.829e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 3`                   -7.771e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 4`                   -1.023e+02  2.980e+05   0.000  0.99973    
  `Organization_type_Trade: type 5`                   -7.863e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 6`                   -7.842e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Trade: type 7`                   -7.787e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Transport: type 1`               -7.860e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Transport: type 2`               -7.801e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Transport: type 3`               -7.737e+01  2.935e+05   0.000  0.99979    
  `Organization_type_Transport: type 4`               -7.791e+01  2.935e+05   0.000  0.99979    
   Organization_type_University                        -7.806e+01  2.935e+05   0.000  0.99979    
   Organization_type_XNA                                       NA         NA      NA       NA    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 137345  on 244147  degrees of freedom
Residual deviance: 129865  on 244004  degrees of freedom
AIC: 130153

Number of Fisher Scoring iterations: 25
$\endgroup$
1

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.