# LOGISTIK MULTINOMIAL (PREDIKSI PEKERJAAN DARI DATA)
# Membaca dataset melalui penyimpanan 
library(readr)
adult_data_clean <- read_csv("C:/Users/hp/OneDrive/Documents/adult_data_clean.csv")
## Rows: 32561 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): marital.status, sex, occupation
## dbl (3): age, education.num, hours.per.week
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
adult_data <- adult_data_clean
View(adult_data_clean)
# Mengecek nama kolom
names(adult_data_clean)
## [1] "age"            "education.num"  "marital.status" "sex"           
## [5] "hours.per.week" "occupation"
# Ringkasan data
summary(adult_data_clean)
##       age        education.num   marital.status         sex           
##  Min.   :17.00   Min.   : 1.00   Length:32561       Length:32561      
##  1st Qu.:28.00   1st Qu.: 9.00   Class :character   Class :character  
##  Median :37.00   Median :10.00   Mode  :character   Mode  :character  
##  Mean   :38.58   Mean   :10.08                                        
##  3rd Qu.:48.00   3rd Qu.:12.00                                        
##  Max.   :90.00   Max.   :16.00                                        
##  hours.per.week   occupation       
##  Min.   : 1.00   Length:32561      
##  1st Qu.:40.00   Class :character  
##  Median :40.00   Mode  :character  
##  Mean   :40.44                     
##  3rd Qu.:45.00                     
##  Max.   :99.00
# Distribusi target variabel plot
adult_data_clean %>%
  count(occupation) %>%
  ggplot(aes(x = reorder(occupation, n), y = n)) +
  geom_col(fill = "steelblue") +
  coord_flip() +
  labs(title = "Distribusi Occupation", x = "Occupation", y = "Jumlah")

# Split data
set.seed(123)
train_index <- createDataPartition(adult_data$occupation, p = 0.7, list = FALSE)
train_data <- adult_data_clean[train_index, ]
test_data <- adult_data_clean[-train_index, ]
# Model
model_multinom <- multinom(occupation ~ age + education.num + marital.status + sex + hours.per.week,
                           data = train_data)
## # weights:  180 (154 variable)
## initial  value 61740.836535 
## iter  10 value 56314.295430
## iter  20 value 55284.067962
## iter  30 value 52681.802333
## iter  40 value 51313.048240
## iter  50 value 50597.879524
## iter  60 value 49151.138958
## iter  70 value 48248.950157
## iter  80 value 47957.785452
## iter  90 value 47739.298683
## iter 100 value 47641.157158
## final  value 47641.157158 
## stopped after 100 iterations
summary(model_multinom)
## Call:
## multinom(formula = occupation ~ age + education.num + marital.status + 
##     sex + hours.per.week, data = train_data)
## 
## Coefficients:
##                   (Intercept)          age education.num
## Adm-clerical       -0.8349347 -0.017874102     0.1848445
## Armed-Forces       -4.9645775 -0.006695451     0.1086584
## Craft-repair       -0.4800921 -0.029930309    -0.1049928
## Exec-managerial    -6.1346708 -0.005137259     0.4354249
## Farming-fishing    -4.3905996 -0.001497207    -0.1791137
## Handlers-cleaners   1.6413098 -0.054590713    -0.2380770
## Machine-op-inspct   1.2020655 -0.031997854    -0.2070204
## Other-service       2.6361991 -0.026407911    -0.1388879
## Priv-house-serv    -0.4158676 -0.004959691    -0.2156895
## Prof-specialty     -9.7124257 -0.016007118     0.8651203
## Protective-serv    -4.4625104 -0.026812980     0.1659482
## Sales              -2.3378696 -0.023833923     0.2007721
## Tech-support       -4.4185472 -0.032128021     0.3984103
## Transport-moving   -1.8770104 -0.021946767    -0.1738524
##                   marital.statusMarried-AF-spouse
## Adm-clerical                          0.986419834
## Armed-Forces                          0.369310243
## Craft-repair                          1.373153894
## Exec-managerial                       0.008139829
## Farming-fishing                       1.967659857
## Handlers-cleaners                    -1.330066048
## Machine-op-inspct                    -2.435297670
## Other-service                         1.735624309
## Priv-house-serv                      -0.106157561
## Prof-specialty                        1.249653321
## Protective-serv                      -0.981045291
## Sales                                 0.317751953
## Tech-support                         -1.599731050
## Transport-moving                      1.180239741
##                   marital.statusMarried-civ-spouse
## Adm-clerical                           -0.51496953
## Armed-Forces                           -0.25624017
## Craft-repair                           -0.37590953
## Exec-managerial                        -0.03190089
## Farming-fishing                         0.07189970
## Handlers-cleaners                      -0.83487267
## Machine-op-inspct                      -0.17725814
## Other-service                          -0.65063652
## Priv-house-serv                        -0.37774193
## Prof-specialty                         -0.03688218
## Protective-serv                        -0.41352407
## Sales                                   0.07450942
## Tech-support                           -0.42073187
## Transport-moving                       -0.25103132
##                   marital.statusMarried-spouse-absent
## Adm-clerical                               -0.7569686
## Armed-Forces                               -1.1147077
## Craft-repair                               -0.7904695
## Exec-managerial                            -1.0393555
## Farming-fishing                             0.5100789
## Handlers-cleaners                          -0.7370363
## Machine-op-inspct                          -0.7908065
## Other-service                              -0.4533636
## Priv-house-serv                            -0.3334036
## Prof-specialty                             -0.9456566
## Protective-serv                            -0.4969938
## Sales                                      -0.4407889
## Tech-support                               -1.1654629
## Transport-moving                           -0.7753468
##                   marital.statusNever-married marital.statusSeparated
## Adm-clerical                       -0.7216796             -0.37552764
## Armed-Forces                       -0.6805239              0.02930884
## Craft-repair                       -1.4967965             -0.17511251
## Exec-managerial                    -1.1413164             -0.50544265
## Farming-fishing                    -0.1194970             -0.04675080
## Handlers-cleaners                  -0.8852337             -0.20496641
## Machine-op-inspct                  -1.0464660             -0.18913386
## Other-service                      -0.5327498             -0.02622882
## Priv-house-serv                    -0.4807472             -0.01934634
## Prof-specialty                     -0.7244859              0.02593403
## Protective-serv                    -1.2991466             -0.46979780
## Sales                              -0.4409322             -0.23978223
## Tech-support                       -1.0086746             -0.68096577
## Transport-moving                   -1.1568607             -0.14761247
##                   marital.statusWidowed     sexMale hours.per.week
## Adm-clerical                -0.63038155 -0.98532526     0.04056410
## Armed-Forces                -0.18279037  0.46173250     0.04662125
## Craft-repair                -0.98568152  2.49069394     0.05819179
## Exec-managerial             -0.82746058  0.01523794     0.07910132
## Farming-fishing             -0.07800423  2.24709415     0.09339368
## Handlers-cleaners           -0.40650593  2.03611569     0.03842396
## Machine-op-inspct           -0.96787978  0.57431359     0.05813295
## Other-service               -0.33924029 -0.20759421     0.02336124
## Priv-house-serv             -0.15574796 -1.51446517     0.03527750
## Prof-specialty              -0.40851245 -0.36059304     0.05416004
## Protective-serv             -0.22181181  1.62552294     0.06219172
## Sales                       -0.21664225  0.15023941     0.05650554
## Tech-support                -0.92508826  0.09197010     0.04071757
## Transport-moving            -0.47275512  2.34047733     0.07505465
## 
## Std. Errors:
##                   (Intercept)         age education.num
## Adm-clerical        0.2540541 0.002927461    0.01715281
## Armed-Forces        0.8136448 0.009194666    0.05244171
## Craft-repair        0.2663537 0.002932346    0.01639413
## Exec-managerial     0.2673840 0.002965630    0.01726941
## Farming-fishing     0.3899972 0.004075902    0.02152441
## Handlers-cleaners   0.3271280 0.004180308    0.02013334
## Machine-op-inspct   0.2866722 0.003381106    0.01804653
## Other-service       0.2518073 0.002955983    0.01651688
## Priv-house-serv     0.6096550 0.007353732    0.03748696
## Prof-specialty      0.2908228 0.003171572    0.01934742
## Protective-serv     0.4283867 0.004987163    0.02684394
## Sales               0.2603910 0.002975345    0.01706372
## Tech-support        0.3683169 0.004601520    0.02467442
## Transport-moving    0.3288147 0.003597326    0.01919945
##                   marital.statusMarried-AF-spouse
## Adm-clerical                          0.632734174
## Armed-Forces                          0.009867798
## Craft-repair                          0.648087118
## Exec-managerial                       0.965090887
## Farming-fishing                       1.038961651
## Handlers-cleaners                     0.006665915
## Machine-op-inspct                     0.004844948
## Other-service                         0.610838707
## Priv-house-serv                       0.012631124
## Prof-specialty                        0.709055251
## Protective-serv                       0.006343466
## Sales                                 0.972186108
## Tech-support                          0.014781447
## Transport-moving                      1.007286245
##                   marital.statusMarried-civ-spouse
## Adm-clerical                             0.1243570
## Armed-Forces                             0.3560091
## Craft-repair                             0.1268251
## Exec-managerial                          0.1255286
## Farming-fishing                          0.1930398
## Handlers-cleaners                        0.1634851
## Machine-op-inspct                        0.1396753
## Other-service                            0.1295016
## Priv-house-serv                          0.3040537
## Prof-specialty                           0.1323833
## Protective-serv                          0.1853637
## Sales                                    0.1289400
## Tech-support                             0.1664766
## Transport-moving                         0.1516724
##                   marital.statusMarried-spouse-absent
## Adm-clerical                                0.2908616
## Armed-Forces                                1.2687472
## Craft-repair                                0.3144996
## Exec-managerial                             0.3241983
## Farming-fishing                             0.3901603
## Handlers-cleaners                           0.3942271
## Machine-op-inspct                           0.3481436
## Other-service                               0.2900886
## Priv-house-serv                             0.6266651
## Prof-specialty                              0.3351115
## Protective-serv                             0.4832369
## Sales                                       0.3090398
## Tech-support                                0.4969451
## Transport-moving                            0.4003460
##                   marital.statusNever-married marital.statusSeparated
## Adm-clerical                        0.1244880               0.2112016
## Armed-Forces                        0.3821768               0.6205694
## Craft-repair                        0.1354916               0.2303938
## Exec-managerial                     0.1319083               0.2347155
## Farming-fishing                     0.2052780               0.3882345
## Handlers-cleaners                   0.1687462               0.2887891
## Machine-op-inspct                   0.1474263               0.2424928
## Other-service                       0.1291436               0.2112408
## Priv-house-serv                     0.2852605               0.4143509
## Prof-specialty                      0.1364059               0.2409536
## Protective-serv                     0.2071152               0.3926454
## Sales                               0.1321362               0.2316492
## Tech-support                        0.1736051               0.3408656
## Transport-moving                    0.1661292               0.2875544
##                   marital.statusWidowed    sexMale hours.per.week
## Adm-clerical                  0.1777670 0.08038789    0.002964958
## Armed-Forces                  0.5970140 0.26470608    0.009784564
## Craft-repair                  0.2694432 0.10924602    0.003039935
## Exec-managerial               0.2091960 0.08437822    0.003018404
## Farming-fishing               0.3693034 0.18510254    0.003858403
## Handlers-cleaners             0.3516887 0.12682350    0.003893534
## Machine-op-inspct             0.2678836 0.09483903    0.003478143
## Other-service                 0.1808440 0.07933768    0.002954050
## Priv-house-serv               0.3542169 0.24058029    0.007867546
## Prof-specialty                0.2188306 0.08612323    0.003131445
## Protective-serv               0.3998359 0.17121209    0.004927429
## Sales                         0.2020239 0.08088936    0.003014380
## Tech-support                  0.3605436 0.11424632    0.004411298
## Transport-moving              0.3208624 0.15120280    0.003614069
## 
## Residual Deviance: 95282.31 
## AIC: 95590.31
# Prediksi pada data test
test_data$occupation <- factor(test_data$occupation)
prediksi <- predict(model_multinom, newdata = test_data)
# Lalu buat confusion matrix
library(caret)
conf_mat <- confusionMatrix(prediksi, test_data$occupation)
conf_mat
## Confusion Matrix and Statistics
## 
##                    Reference
## Prediction            ? Adm-clerical Armed-Forces Craft-repair Exec-managerial
##   ?                  46           14            0            7              11
##   Adm-clerical      124          599            0           31             168
##   Armed-Forces        0            0            0            0               0
##   Craft-repair      156          199            2          925             323
##   Exec-managerial    28           38            0           78             214
##   Farming-fishing     2            2            0            5               2
##   Handlers-cleaners  19            0            0           19               0
##   Machine-op-inspct   2            0            0            1               1
##   Other-service     103           87            0           33              11
##   Priv-house-serv     0            0            0            0               0
##   Prof-specialty     65          177            0           74             465
##   Protective-serv     0            0            0            0               0
##   Sales               7           15            0           56              24
##   Tech-support        0            0            0            0               0
##   Transport-moving    0            0            0            0               0
##                    Reference
## Prediction          Farming-fishing Handlers-cleaners Machine-op-inspct
##   ?                               4                 5                 3
##   Adm-clerical                   11                34               108
##   Armed-Forces                    0                 0                 0
##   Craft-repair                  187               255               375
##   Exec-managerial                40                11                10
##   Farming-fishing                 9                 1                 2
##   Handlers-cleaners              19                19                13
##   Machine-op-inspct               1                 0                 3
##   Other-service                  12                59                63
##   Priv-house-serv                 0                 0                 0
##   Prof-specialty                 13                16                15
##   Protective-serv                 0                 0                 0
##   Sales                           2                11                 8
##   Tech-support                    0                 0                 0
##   Transport-moving                0                 0                 0
##                    Reference
## Prediction          Other-service Priv-house-serv Prof-specialty
##   ?                            20               2             10
##   Adm-clerical                309              16            103
##   Armed-Forces                  0               0              0
##   Craft-repair                255               0            121
##   Exec-managerial              22               0            113
##   Farming-fishing               5               0              2
##   Handlers-cleaners            32               1              1
##   Machine-op-inspct             4               0              0
##   Other-service               253              24             19
##   Priv-house-serv               0               0              0
##   Prof-specialty               67               1            862
##   Protective-serv               0               0              0
##   Sales                        21               0             11
##   Tech-support                  0               0              0
##   Transport-moving              0               0              0
##                    Reference
## Prediction          Protective-serv Sales Tech-support Transport-moving
##   ?                               2    19            3                5
##   Adm-clerical                   16   233           73               19
##   Armed-Forces                    0     0            0                0
##   Craft-repair                  111   347           84              375
##   Exec-managerial                29   126           23               23
##   Farming-fishing                 1     2            0                9
##   Handlers-cleaners               1     3            0                7
##   Machine-op-inspct               1     1            0                0
##   Other-service                   5   131           13                8
##   Priv-house-serv                 0     0            0                0
##   Prof-specialty                 25   206           74               20
##   Protective-serv                 0     0            0                0
##   Sales                           3    27            8               13
##   Tech-support                    0     0            0                0
##   Transport-moving                0     0            0                0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.3029          
##                  95% CI : (0.2938, 0.3121)
##     No Information Rate : 0.1272          
##     P-Value [Acc > NIR] : < 2.2e-16       
##                                           
##                   Kappa : 0.2086          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: ? Class: Adm-clerical Class: Armed-Forces
## Sensitivity          0.083333             0.52962           0.0000000
## Specificity          0.988599             0.85575           1.0000000
## Pos Pred Value       0.304636             0.32484                 NaN
## Neg Pred Value       0.947352             0.93281           0.9997951
## Prevalence           0.056546             0.11586           0.0002049
## Detection Rate       0.004712             0.06136           0.0000000
## Detection Prevalence 0.015468             0.18890           0.0000000
## Balanced Accuracy    0.535966             0.69269           0.5000000
##                      Class: Craft-repair Class: Exec-managerial
## Sensitivity                      0.75264                0.17555
## Specificity                      0.67303                0.93667
## Pos Pred Value                   0.24899                0.28344
## Neg Pred Value                   0.94973                0.88842
## Prevalence                       0.12590                0.12487
## Detection Rate                   0.09476                0.02192
## Detection Prevalence             0.38056                0.07734
## Balanced Accuracy                0.71284                0.55611
##                      Class: Farming-fishing Class: Handlers-cleaners
## Sensitivity                       0.0302013                 0.046229
## Specificity                       0.9965131                 0.987702
## Pos Pred Value                    0.2142857                 0.141791
## Neg Pred Value                    0.9702675                 0.959285
## Prevalence                        0.0305265                 0.042102
## Detection Rate                    0.0009219                 0.001946
## Detection Prevalence              0.0043024                 0.013727
## Balanced Accuracy                 0.5133572                 0.516965
##                      Class: Machine-op-inspct Class: Other-service
## Sensitivity                         0.0050000              0.25607
## Specificity                         0.9987994              0.93526
## Pos Pred Value                      0.2142857              0.30816
## Neg Pred Value                      0.9387567              0.91779
## Prevalence                          0.0614628              0.10121
## Detection Rate                      0.0003073              0.02592
## Detection Prevalence                0.0014341              0.08410
## Balanced Accuracy                   0.5018997              0.59567
##                      Class: Priv-house-serv Class: Prof-specialty
## Sensitivity                        0.000000                0.6940
## Specificity                        1.000000                0.8570
## Pos Pred Value                          NaN                0.4144
## Neg Pred Value                     0.995493                0.9505
## Prevalence                         0.004507                0.1272
## Detection Rate                     0.000000                0.0883
## Detection Prevalence               0.000000                0.2131
## Balanced Accuracy                  0.500000                0.7755
##                      Class: Protective-serv Class: Sales Class: Tech-support
## Sensitivity                         0.00000     0.024658             0.00000
## Specificity                         1.00000     0.979347             1.00000
## Pos Pred Value                          NaN     0.131068                 NaN
## Neg Pred Value                      0.98013     0.888238             0.97152
## Prevalence                          0.01987     0.112170             0.02848
## Detection Rate                      0.00000     0.002766             0.00000
## Detection Prevalence                0.00000     0.021102             0.00000
## Balanced Accuracy                   0.50000     0.502002             0.50000
##                      Class: Transport-moving
## Sensitivity                          0.00000
## Specificity                          1.00000
## Pos Pred Value                           NaN
## Neg Pred Value                       0.95093
## Prevalence                           0.04907
## Detection Rate                       0.00000
## Detection Prevalence                 0.00000
## Balanced Accuracy                    0.50000
conf_mat$overall['Akurasi']
## <NA> 
##   NA
# Interpretasi, Ekstrak koefisien
coefs <- summary(model_multinom)$coefficients
coefs
##                   (Intercept)          age education.num
## Adm-clerical       -0.8349347 -0.017874102     0.1848445
## Armed-Forces       -4.9645775 -0.006695451     0.1086584
## Craft-repair       -0.4800921 -0.029930309    -0.1049928
## Exec-managerial    -6.1346708 -0.005137259     0.4354249
## Farming-fishing    -4.3905996 -0.001497207    -0.1791137
## Handlers-cleaners   1.6413098 -0.054590713    -0.2380770
## Machine-op-inspct   1.2020655 -0.031997854    -0.2070204
## Other-service       2.6361991 -0.026407911    -0.1388879
## Priv-house-serv    -0.4158676 -0.004959691    -0.2156895
## Prof-specialty     -9.7124257 -0.016007118     0.8651203
## Protective-serv    -4.4625104 -0.026812980     0.1659482
## Sales              -2.3378696 -0.023833923     0.2007721
## Tech-support       -4.4185472 -0.032128021     0.3984103
## Transport-moving   -1.8770104 -0.021946767    -0.1738524
##                   marital.statusMarried-AF-spouse
## Adm-clerical                          0.986419834
## Armed-Forces                          0.369310243
## Craft-repair                          1.373153894
## Exec-managerial                       0.008139829
## Farming-fishing                       1.967659857
## Handlers-cleaners                    -1.330066048
## Machine-op-inspct                    -2.435297670
## Other-service                         1.735624309
## Priv-house-serv                      -0.106157561
## Prof-specialty                        1.249653321
## Protective-serv                      -0.981045291
## Sales                                 0.317751953
## Tech-support                         -1.599731050
## Transport-moving                      1.180239741
##                   marital.statusMarried-civ-spouse
## Adm-clerical                           -0.51496953
## Armed-Forces                           -0.25624017
## Craft-repair                           -0.37590953
## Exec-managerial                        -0.03190089
## Farming-fishing                         0.07189970
## Handlers-cleaners                      -0.83487267
## Machine-op-inspct                      -0.17725814
## Other-service                          -0.65063652
## Priv-house-serv                        -0.37774193
## Prof-specialty                         -0.03688218
## Protective-serv                        -0.41352407
## Sales                                   0.07450942
## Tech-support                           -0.42073187
## Transport-moving                       -0.25103132
##                   marital.statusMarried-spouse-absent
## Adm-clerical                               -0.7569686
## Armed-Forces                               -1.1147077
## Craft-repair                               -0.7904695
## Exec-managerial                            -1.0393555
## Farming-fishing                             0.5100789
## Handlers-cleaners                          -0.7370363
## Machine-op-inspct                          -0.7908065
## Other-service                              -0.4533636
## Priv-house-serv                            -0.3334036
## Prof-specialty                             -0.9456566
## Protective-serv                            -0.4969938
## Sales                                      -0.4407889
## Tech-support                               -1.1654629
## Transport-moving                           -0.7753468
##                   marital.statusNever-married marital.statusSeparated
## Adm-clerical                       -0.7216796             -0.37552764
## Armed-Forces                       -0.6805239              0.02930884
## Craft-repair                       -1.4967965             -0.17511251
## Exec-managerial                    -1.1413164             -0.50544265
## Farming-fishing                    -0.1194970             -0.04675080
## Handlers-cleaners                  -0.8852337             -0.20496641
## Machine-op-inspct                  -1.0464660             -0.18913386
## Other-service                      -0.5327498             -0.02622882
## Priv-house-serv                    -0.4807472             -0.01934634
## Prof-specialty                     -0.7244859              0.02593403
## Protective-serv                    -1.2991466             -0.46979780
## Sales                              -0.4409322             -0.23978223
## Tech-support                       -1.0086746             -0.68096577
## Transport-moving                   -1.1568607             -0.14761247
##                   marital.statusWidowed     sexMale hours.per.week
## Adm-clerical                -0.63038155 -0.98532526     0.04056410
## Armed-Forces                -0.18279037  0.46173250     0.04662125
## Craft-repair                -0.98568152  2.49069394     0.05819179
## Exec-managerial             -0.82746058  0.01523794     0.07910132
## Farming-fishing             -0.07800423  2.24709415     0.09339368
## Handlers-cleaners           -0.40650593  2.03611569     0.03842396
## Machine-op-inspct           -0.96787978  0.57431359     0.05813295
## Other-service               -0.33924029 -0.20759421     0.02336124
## Priv-house-serv             -0.15574796 -1.51446517     0.03527750
## Prof-specialty              -0.40851245 -0.36059304     0.05416004
## Protective-serv             -0.22181181  1.62552294     0.06219172
## Sales                       -0.21664225  0.15023941     0.05650554
## Tech-support                -0.92508826  0.09197010     0.04071757
## Transport-moving            -0.47275512  2.34047733     0.07505465
exp(coefs)
##                    (Intercept)       age education.num
## Adm-clerical      4.339028e-01 0.9822847     1.2030314
## Armed-Forces      6.980900e-03 0.9933269     1.1147815
## Craft-repair      6.187264e-01 0.9705132     0.9003310
## Exec-managerial   2.166438e-03 0.9948759     1.5456196
## Farming-fishing   1.239330e-02 0.9985039     0.8360109
## Handlers-cleaners 5.161926e+00 0.9468726     0.7881420
## Machine-op-inspct 3.326982e+00 0.9685087     0.8130030
## Other-service     1.396004e+01 0.9739377     0.8703256
## Priv-house-serv   6.597676e-01 0.9950526     0.8059856
## Prof-specialty    6.052672e-05 0.9841203     2.3752919
## Protective-serv   1.153337e-02 0.9735433     1.1805120
## Sales             9.653307e-02 0.9764479     1.2223462
## Tech-support      1.205173e-02 0.9683826     1.4894550
## Transport-moving  1.530470e-01 0.9782923     0.8404210
##                   marital.statusMarried-AF-spouse
## Adm-clerical                           2.68161663
## Armed-Forces                           1.44673637
## Craft-repair                           3.94778197
## Exec-managerial                        1.00817305
## Farming-fishing                        7.15391570
## Handlers-cleaners                      0.26445979
## Machine-op-inspct                      0.08757168
## Other-service                          5.67246807
## Priv-house-serv                        0.89928294
## Prof-specialty                         3.48913314
## Protective-serv                        0.37491899
## Sales                                  1.37403539
## Tech-support                           0.20195083
## Transport-moving                       3.25515450
##                   marital.statusMarried-civ-spouse
## Adm-clerical                             0.5975188
## Armed-Forces                             0.7739561
## Craft-repair                             0.6866644
## Exec-managerial                          0.9686026
## Farming-fishing                          1.0745476
## Handlers-cleaners                        0.4339297
## Machine-op-inspct                        0.8375635
## Other-service                            0.5217136
## Priv-house-serv                          0.6854074
## Prof-specialty                           0.9637897
## Protective-serv                          0.6613156
## Sales                                    1.0773555
## Tech-support                             0.6565661
## Transport-moving                         0.7779980
##                   marital.statusMarried-spouse-absent
## Adm-clerical                                0.4690863
## Armed-Forces                                0.3280111
## Craft-repair                                0.4536317
## Exec-managerial                             0.3536826
## Farming-fishing                             1.6654225
## Handlers-cleaners                           0.4785300
## Machine-op-inspct                           0.4534789
## Other-service                               0.6354870
## Priv-house-serv                             0.7164810
## Prof-specialty                              0.3884245
## Protective-serv                             0.6083568
## Sales                                       0.6435285
## Tech-support                                0.3117783
## Transport-moving                            0.4605440
##                   marital.statusNever-married marital.statusSeparated
## Adm-clerical                        0.4859354               0.6869267
## Armed-Forces                        0.5063517               1.0297426
## Craft-repair                        0.2238461               0.8393626
## Exec-managerial                     0.3193983               0.6032385
## Farming-fishing                     0.8873667               0.9543252
## Handlers-cleaners                   0.4126177               0.8146747
## Machine-op-inspct                   0.3511766               0.8276757
## Other-service                       0.5869886               0.9741122
## Priv-house-serv                     0.6183212               0.9808396
## Prof-specialty                      0.4845736               1.0262732
## Protective-serv                     0.2727645               0.6251287
## Sales                               0.6434363               0.7867992
## Tech-support                        0.3647020               0.5061280
## Transport-moving                    0.3144719               0.8627654
##                   marital.statusWidowed    sexMale hours.per.week
## Adm-clerical                  0.5323886  0.3733178       1.041398
## Armed-Forces                  0.8329427  1.5868208       1.047725
## Craft-repair                  0.3731848 12.0696488       1.059918
## Exec-managerial               0.4371580  1.0153546       1.082314
## Farming-fishing               0.9249605  9.4602059       1.097894
## Handlers-cleaners             0.6659731  7.6607944       1.039172
## Machine-op-inspct             0.3798876  1.7759111       1.059856
## Other-service                 0.7123113  0.8125367       1.023636
## Priv-house-serv               0.8557749  0.2199258       1.035907
## Prof-specialty                0.6646382  0.6972627       1.055654
## Protective-serv               0.8010661  5.0810755       1.064166
## Sales                         0.8052180  1.1621124       1.058132
## Tech-support                  0.3964964  1.0963320       1.041558
## Transport-moving              0.6232827 10.3861930       1.077943