Name: Shreyas Jadhav

Email: essjeyy0412@gmail.com

College:Dwarkadas J.Sanghvi College of Engineering

Initial Analysis

NOTE: The income levels are binned at below 50K and above 50K.

Variable: income_level

-50,000 -> income level below 50k

+50,000 -> income level above 50k

Reading the data set and visualizing the length and breadth of dataset.

setwd("C:/Users/Shreyas Jadhav/Downloads")  
usincome <- read.csv(paste("project.csv",sep="."))
View(usincome)
attach(usincome)
dim(usincome)
## [1] 10000    41
usincome$income_level[usincome$income_level == -50000] <- 'Below 50k'
usincome$income_level[usincome$income_level == 50000] <- 'Above 50k'

Descriptive statsistics

summary(usincome)
##       age                              class_of_worker industry_code  
##  Min.   : 0.00   Not in universe               :4881   Min.   : 0.00  
##  1st Qu.:15.00   Private                       :3731   1st Qu.: 0.00  
##  Median :33.00   Self-employed-not incorporated: 409   Median : 2.00  
##  Mean   :34.46   Local government              : 407   Mean   :15.82  
##  3rd Qu.:49.00   State government              : 245   3rd Qu.:33.00  
##  Max.   :90.00   Federal government            : 153   Max.   :51.00  
##                  (Other)                       : 174                  
##  occupation_code                      education    wage_per_hour    
##  Min.   : 0.00   High school graduate      :2454   Min.   :   0.00  
##  1st Qu.: 0.00   Children                  :2338   1st Qu.:   0.00  
##  Median : 2.00   Some college but no degree:1418   Median :   0.00  
##  Mean   :11.65   Bachelors degree(BA AB BS): 973   Mean   :  61.24  
##  3rd Qu.:26.00   7th and 8th grade         : 456   3rd Qu.:   0.00  
##  Max.   :46.00   10th grade                : 384   Max.   :9000.00  
##                  (Other)                   :1977                    
##         enrolled_in_edu_inst_lastwk                         marital_status
##  College or university: 286         Divorced                       : 653  
##  High school          : 358         Married-A F spouse present     :  28  
##  Not in universe      :9356         Married-civilian spouse present:4274  
##                                     Married-spouse absent          :  80  
##                                     Never married                  :4307  
##                                     Separated                      : 148  
##                                     Widowed                        : 510  
##                         major_industry_code
##  Not in universe or children      :4898    
##  Retail trade                     : 891    
##  Education                        : 451    
##  Manufacturing-durable goods      : 451    
##  Manufacturing-nondurable goods   : 385    
##  Finance insurance and real estate: 331    
##  (Other)                          :2593    
##                     major_occupation_code
##  Not in universe               :4898     
##  Adm support including clerical: 784     
##  Professional specialty        : 700     
##  Executive admin and managerial: 638     
##  Other service                 : 628     
##  Sales                         : 627     
##  (Other)                       :1725     
##                           race                       hispanic_origin
##  Amer Indian Aleut or Eskimo: 118   All other                :8672  
##  Asian or Pacific Islander  : 309   Mexican-American         : 401  
##  Black                      :1027   Mexican (Mexicano)       : 362  
##  Other                      : 183   Central or South American: 195  
##  White                      :8363   Puerto Rican             : 144  
##                                     (Other)                  : 195  
##                                     NA's                     :  31  
##      sex           member_of_labor_union          reason_for_unemployment
##  Female:5312   No             : 857      Job leaver           :  30      
##  Male  :4688   Not in universe:8996      Job loser - on layoff:  42      
##                Yes            : 147      New entrant          :  17      
##                                          Not in universe      :9728      
##                                          Other job loser      :  97      
##                                          Re-entrant           :  86      
##                                                                          
##                     full_parttime_employment_stat capital_gains    
##  Children or Armed Forces          :6156          Min.   :    0.0  
##  Full-time schedules               :2097          1st Qu.:    0.0  
##  Not in labor force                :1314          Median :    0.0  
##  PT for non-econ reasons usually FT: 184          Mean   :  395.4  
##  Unemployed full-time              : 119          3rd Qu.:    0.0  
##  PT for econ reasons usually PT    :  72          Max.   :99999.0  
##  (Other)                           :  58                           
##  capital_losses    dividend_from_Stocks
##  Min.   :   0.00   Min.   :    0.0     
##  1st Qu.:   0.00   1st Qu.:    0.0     
##  Median :   0.00   Median :    0.0     
##  Mean   :  39.81   Mean   :  164.5     
##  3rd Qu.:   0.00   3rd Qu.:    0.0     
##  Max.   :4608.00   Max.   :99999.0     
##                                        
##                      tax_filer_status  region_of_previous_residence
##  Head of household           : 388    Abroad         :  23         
##  Joint both 65+              : 397    Midwest        : 200         
##  Joint both under 65         :3478    Northeast      : 147         
##  Joint one under 65 & one 65+: 173    Not in universe:9218         
##  Nonfiler                    :3676    South          : 225         
##  Single                      :1888    West           : 187         
##                                                                    
##   state_of_previous_residence
##  Not in universe:9218        
##  California     :  68        
##  Utah           :  62        
##  North Carolina :  46        
##  Minnesota      :  36        
##  (Other)        : 524        
##  NA's           :  46        
##                             d_household_family_stat
##  Householder                            :2689      
##  Child <18 never marr not in subfamily  :2511      
##  Spouse of householder                  :2107      
##  Nonfamily householder                  :1104      
##  Child 18+ never marr Not in a subfamily: 575      
##  Secondary individual                   : 317      
##  (Other)                                : 697      
##                     d_household_summary          migration_msa 
##  Householder                  :3795     Nonmover        :4088  
##  Child under 18 never married :2518     MSA to MSA      : 534  
##  Spouse of householder        :2107     NonMSA to nonMSA: 143  
##  Child 18 or older            : 708     Not in universe :  87  
##  Other relative of householder: 472     MSA to nonMSA   :  39  
##  Nonrelative of householder   : 393     (Other)         :  66  
##  (Other)                      :   7     NA's            :5043  
##                      migration_reg                   migration_within_reg
##  Nonmover                   :4088   Nonmover                   :4088     
##  Same county                : 506   Same county                : 506     
##  Different county same state: 133   Different county same state: 133     
##  Not in universe            :  87   Not in universe            :  87     
##  Different region           :  61   Different state in South   :  45     
##  (Other)                    :  82   (Other)                    :  98     
##  NA's                       :5043   NA's                       :5043     
##                          live_1_year_ago       migration_sunbelt
##  No                              : 782   No             : 519   
##  Not in universe under 1 year old:5130   Not in universe:4175   
##  Yes                             :4088   Yes            : 263   
##                                          NA's           :5043   
##                                                                 
##                                                                 
##                                                                 
##  num_person_Worked_employer           family_members_under_18
##  Min.   :0.000              Both parents present  :1921      
##  1st Qu.:0.000              Father only present   :  82      
##  Median :1.000              Mother only present   : 676      
##  Mean   :2.027              Neither parent present:  83      
##  3rd Qu.:4.000              Not in universe       :7238      
##  Max.   :6.000                                               
##                                                              
##        country_father       country_mother        country_self 
##  United-States:8011   United-States:8065   United-States:8873  
##  Mexico       : 484   Mexico       : 488   Mexico       : 278  
##  Puerto-Rico  : 122   Puerto-Rico  : 117   Puerto-Rico  :  62  
##  Italy        : 103   Italy        :  87   Germany      :  51  
##  Germany      :  77   Germany      :  74   Cuba         :  46  
##  (Other)      : 904   (Other)      : 886   (Other)      : 537  
##  NA's         : 299   NA's         : 283   NA's         : 153  
##                                       citizenship  
##  Foreign born- Not a citizen of U S         : 675  
##  Foreign born- U S citizen by naturalization: 298  
##  Native- Born abroad of American Parent(s)  :  88  
##  Native- Born in Puerto Rico or U S Outlying:  66  
##  Native- Born in the United States          :8873  
##                                                    
##                                                    
##  business_or_self_employed fill_questionnaire_veteran_admin
##  Min.   :0.0000            No             :  84            
##  1st Qu.:0.0000            Not in universe:9895            
##  Median :0.0000            Yes            :  21            
##  Mean   :0.1724                                            
##  3rd Qu.:0.0000                                            
##  Max.   :2.0000                                            
##                                                            
##  veterans_benefits weeks_worked_in_year      year      income_level      
##  Min.   :0.000     Min.   : 0.00        Min.   :94.0   Length:10000      
##  1st Qu.:2.000     1st Qu.: 0.00        1st Qu.:94.0   Class :character  
##  Median :2.000     Median :12.00        Median :95.0   Mode  :character  
##  Mean   :1.522     Mean   :23.78        Mean   :94.5                     
##  3rd Qu.:2.000     3rd Qu.:52.00        3rd Qu.:95.0                     
##  Max.   :2.000     Max.   :52.00        Max.   :95.0                     
## 
library(psych)
describe(usincome)[,0:9]
## Warning in describe(usincome): NAs introduced by coercion
## Warning in FUN(newX[, i], ...): no non-missing arguments to min; returning
## Inf
## Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning
## -Inf
##                                   vars     n   mean      sd median trimmed
## age                                  1 10000  34.46   22.07     33   33.27
## class_of_worker*                     2 10000   4.50    1.13      4    4.44
## industry_code                        3 10000  15.82   18.11      2   14.16
## occupation_code                      4 10000  11.65   14.52      2    9.70
## education*                           5 10000  11.09    4.11     11   11.45
## wage_per_hour                        6 10000  61.25  299.35      0    0.00
## enrolled_in_edu_inst_lastwk*         7 10000   2.91    0.38      3    3.00
## marital_status*                      8 10000   3.98    1.41      4    4.00
## major_industry_code*                 9 10000  13.99    4.83     15   14.30
## major_occupation_code*              10 10000   7.30    3.16      7    7.25
## race*                               11 10000   4.64    0.87      5    4.86
## hispanic_origin*                    12  9969   1.66    1.85      1    1.07
## sex*                                13 10000   1.47    0.50      1    1.46
## member_of_labor_union*              14 10000   1.93    0.31      2    2.00
## reason_for_unemployment*            15 10000   4.01    0.30      4    4.00
## full_parttime_employment_stat*      16 10000   1.70    1.20      1    1.45
## capital_gains                       17 10000 395.41 4271.33      0    0.00
## capital_losses                      18 10000  39.81  281.44      0    0.00
## dividend_from_Stocks                19 10000 164.53 1860.00      0    0.04
## tax_filer_status*                   20 10000   4.20    1.39      5    4.27
## region_of_previous_residence*       21 10000   4.00    0.46      4    4.00
## state_of_previous_residence*        22  9954  35.15    5.04     36   36.00
## d_household_family_stat*            23 10000  13.90    9.15     14   13.75
## d_household_summary*                24 10000   4.98    2.07      5    5.02
## migration_msa*                      25  4957   4.90    0.97      5    4.96
## migration_reg*                      26  4957   6.05    1.03      6    6.03
## migration_within_reg*               27  4957   7.00    1.19      7    7.03
## live_1_year_ago*                    28 10000   2.33    0.61      2    2.39
## migration_sunbelt*                  29  4957   1.95    0.39      2    1.99
## num_person_Worked_employer          30 10000   2.03    2.39      1    1.78
## family_members_under_18*            31 10000   4.06    1.60      5    4.33
## country_father*                     32  9701  36.67    8.55     40   39.09
## country_mother*                     33  9717  36.79    8.34     40   39.15
## country_self*                       34  9847  38.12    6.65     40   40.00
## citizenship*                        35 10000   4.62    1.11      5    4.98
## business_or_self_employed           36 10000   0.17    0.55      0    0.00
## fill_questionnaire_veteran_admin*   37 10000   1.99    0.10      2    2.00
## veterans_benefits                   38 10000   1.52    0.85      2    1.65
## weeks_worked_in_year                39 10000  23.78   24.39     12   23.22
## year                                40 10000  94.50    0.50     95   94.51
## income_level*                       41 10000    NaN      NA     NA     NaN
##                                     mad min   max
## age                               25.20   0    90
## class_of_worker*                   1.48   1     9
## industry_code                      2.97   0    51
## occupation_code                    2.97   0    46
## education*                         2.97   1    17
## wage_per_hour                      0.00   0  9000
## enrolled_in_edu_inst_lastwk*       0.00   1     3
## marital_status*                    1.48   1     7
## major_industry_code*               1.48   1    24
## major_occupation_code*             1.48   1    15
## race*                              0.00   1     5
## hispanic_origin*                   0.00   1     9
## sex*                               0.00   1     2
## member_of_labor_union*             0.00   1     3
## reason_for_unemployment*           0.00   1     6
## full_parttime_employment_stat*     0.00   1     8
## capital_gains                      0.00   0 99999
## capital_losses                     0.00   0  4608
## dividend_from_Stocks               0.00   0 99999
## tax_filer_status*                  1.48   1     6
## region_of_previous_residence*      0.00   1     6
## state_of_previous_residence*       0.00   1    50
## d_household_family_stat*          14.83   1    27
## d_household_summary*               2.97   1     8
## migration_msa*                     0.00   1     9
## migration_reg*                     0.00   1     8
## migration_within_reg*              0.00   1     9
## live_1_year_ago*                   0.00   1     3
## migration_sunbelt*                 0.00   1     3
## num_person_Worked_employer         1.48   0     6
## family_members_under_18*           0.00   1     5
## country_father*                    0.00   1    42
## country_mother*                    0.00   1    42
## country_self*                      0.00   1    42
## citizenship*                       0.00   1     5
## business_or_self_employed          0.00   0     2
## fill_questionnaire_veteran_admin*  0.00   1     3
## veterans_benefits                  0.00   0     2
## weeks_worked_in_year              17.79   0    52
## year                               0.00  94    95
## income_level*                        NA Inf  -Inf

One-way contingency tables for the categorical variables.

table(age)
## age
##   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17 
## 147 161 149 160 150 149 146 144 146 171 184 170 166 138 157 176 160 125 
##  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35 
## 110 139 126 102 121 120 152 146 132 144 145 160 155 161 149 181 161 168 
##  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53 
## 169 191 170 154 153 176 159 155 143 153 158 146 111 105 114 108 117 105 
##  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71 
##  88  91  75  94  70  75  71  83  85  93  77  76  70  81  51  56  56  60 
##  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89 
##  50  70  66  48  47  41  59  40  42  28  35  27  27  21  19  16  12   9 
##  90 
##  33
table(age!=0)
## 
## FALSE  TRUE 
##   147  9853
prop.table(table(age!=0 & wage_per_hour!=0))*100
## 
## FALSE  TRUE 
## 93.85  6.15
table(class_of_worker)
## class_of_worker
##             Federal government               Local government 
##                            153                            407 
##                   Never worked                Not in universe 
##                             17                           4881 
##                        Private     Self-employed-incorporated 
##                           3731                            148 
## Self-employed-not incorporated               State government 
##                            409                            245 
##                    Without pay 
##                              9
table(class_of_worker!="Not in universe")
## 
## FALSE  TRUE 
##  4881  5119
table(education)
## education
##                             10th grade 
##                                    384 
##                             11th grade 
##                                    318 
##                  12th grade no diploma 
##                                     84 
##               1st 2nd 3rd or 4th grade 
##                                     96 
##                       5th or 6th grade 
##                                    135 
##                      7th and 8th grade 
##                                    456 
##                              9th grade 
##                                    322 
##     Associates degree-academic program 
##                                    218 
##    Associates degree-occup /vocational 
##                                    261 
##             Bachelors degree(BA AB BS) 
##                                    973 
##                               Children 
##                                   2338 
##              Doctorate degree(PhD EdD) 
##                                     69 
##                   High school graduate 
##                                   2454 
##                    Less than 1st grade 
##                                     39 
## Masters degree(MA MS MEng MEd MSW MBA) 
##                                    347 
## Prof school degree (MD DDS DVM LLB JD) 
##                                     88 
##             Some college but no degree 
##                                   1418
prop.table(table(age!=0 & class_of_worker!="Not in universe"))*100
## 
## FALSE  TRUE 
## 48.81 51.19
table(industry_code)
## industry_code
##    0    1    2    3    4    5    6    7    8    9   11   12   13   14   15 
## 4898   39  115   25  308   27   25   19   23   59   97   56   50   16   19 
##   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30 
##   28    9   23   82    1   26   50   34   86   53   10   37    6  218   55 
##   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45 
##   56  192  891  153  178   59  207   61  147   90  187  246  451  125  218 
##   46   47   48   49   50   51 
##    8   69   36   38   92    2
prop.table(table(industry_code & wage_per_hour!=0))*100
## 
## FALSE  TRUE 
## 93.85  6.15
prop.table(table(citizenship))*100
## citizenship
##          Foreign born- Not a citizen of U S 
##                                        6.75 
## Foreign born- U S citizen by naturalization 
##                                        2.98 
##   Native- Born abroad of American Parent(s) 
##                                        0.88 
## Native- Born in Puerto Rico or U S Outlying 
##                                        0.66 
##           Native- Born in the United States 
##                                       88.73

Two-way contingency tables for the categorical variables in your dataset.

age_and_education<-as.data.frame(table(age,education))
c1<-cut(as.numeric(as.character(age_and_education$age)),breaks=seq(0,90,by=10))
table(age_and_education$education,c1)
##                                         c1
##                                          (0,10] (10,20] (20,30] (30,40]
##   10th grade                                 10      10      10      10
##   11th grade                                 10      10      10      10
##   12th grade no diploma                      10      10      10      10
##   1st 2nd 3rd or 4th grade                   10      10      10      10
##   5th or 6th grade                           10      10      10      10
##   7th and 8th grade                          10      10      10      10
##   9th grade                                  10      10      10      10
##   Associates degree-academic program         10      10      10      10
##   Associates degree-occup /vocational        10      10      10      10
##   Bachelors degree(BA AB BS)                 10      10      10      10
##   Children                                   10      10      10      10
##   Doctorate degree(PhD EdD)                  10      10      10      10
##   High school graduate                       10      10      10      10
##   Less than 1st grade                        10      10      10      10
##   Masters degree(MA MS MEng MEd MSW MBA)     10      10      10      10
##   Prof school degree (MD DDS DVM LLB JD)     10      10      10      10
##   Some college but no degree                 10      10      10      10
##                                         c1
##                                          (40,50] (50,60] (60,70] (70,80]
##   10th grade                                  10      10      10      10
##   11th grade                                  10      10      10      10
##   12th grade no diploma                       10      10      10      10
##   1st 2nd 3rd or 4th grade                    10      10      10      10
##   5th or 6th grade                            10      10      10      10
##   7th and 8th grade                           10      10      10      10
##   9th grade                                   10      10      10      10
##   Associates degree-academic program          10      10      10      10
##   Associates degree-occup /vocational         10      10      10      10
##   Bachelors degree(BA AB BS)                  10      10      10      10
##   Children                                    10      10      10      10
##   Doctorate degree(PhD EdD)                   10      10      10      10
##   High school graduate                        10      10      10      10
##   Less than 1st grade                         10      10      10      10
##   Masters degree(MA MS MEng MEd MSW MBA)      10      10      10      10
##   Prof school degree (MD DDS DVM LLB JD)      10      10      10      10
##   Some college but no degree                  10      10      10      10
##                                         c1
##                                          (80,90]
##   10th grade                                  10
##   11th grade                                  10
##   12th grade no diploma                       10
##   1st 2nd 3rd or 4th grade                    10
##   5th or 6th grade                            10
##   7th and 8th grade                           10
##   9th grade                                   10
##   Associates degree-academic program          10
##   Associates degree-occup /vocational         10
##   Bachelors degree(BA AB BS)                  10
##   Children                                    10
##   Doctorate degree(PhD EdD)                   10
##   High school graduate                        10
##   Less than 1st grade                         10
##   Masters degree(MA MS MEng MEd MSW MBA)      10
##   Prof school degree (MD DDS DVM LLB JD)      10
##   Some college but no degree                  10
mytable<-xtabs(~race+age,data=usincome)
mytable
##                              age
## race                            0   1   2   3   4   5   6   7   8   9  10
##   Amer Indian Aleut or Eskimo   2   5   2   2   3   2   2   2   1   2   6
##   Asian or Pacific Islander     5   5   5   7   1   6   7   6  10   6   5
##   Black                        23  23  19  18  18  23  15  22  15  20  28
##   Other                         3   8   3   3   7   7   6   6   7   4   3
##   White                       114 120 120 130 121 111 116 108 113 139 142
##                              age
## race                           11  12  13  14  15  16  17  18  19  20  21
##   Amer Indian Aleut or Eskimo   8   2   1   2   4   3   1   1   0   1   0
##   Asian or Pacific Islander     3   7   7   2   6   3   2   4   5   3   6
##   Black                        23  19  16  16  36  21  16  15  17  19  13
##   Other                         1   6   3   2   3   5   4   3   1   1   0
##   White                       135 132 111 135 127 128 102  87 116 102  83
##                              age
## race                           22  23  24  25  26  27  28  29  30  31  32
##   Amer Indian Aleut or Eskimo   1   2   2   0   5   0   2   2   1   2   0
##   Asian or Pacific Islander     7   5   6   4   2   5   7   7   4   7   5
##   Black                        10  11  16  16   7  16  18  27  13  13  19
##   Other                         6   6   2   5   4   5   2   7   2   5   3
##   White                        97  96 126 121 114 118 116 117 135 134 122
##                              age
## race                           33  34  35  36  37  38  39  40  41  42  43
##   Amer Indian Aleut or Eskimo   2   0   2   3   1   7   1   1   2   2   2
##   Asian or Pacific Islander     7   5   8   6   6   3   5   7   6   4   4
##   Black                        21  18   8   9  13  18  18  12  13  18  12
##   Other                         1   1   2   1   1   3   3   3   2   1   4
##   White                       150 137 148 150 170 139 127 130 153 134 133
##                              age
## race                           44  45  46  47  48  49  50  51  52  53  54
##   Amer Indian Aleut or Eskimo   2   0   1   2   2   0   2   2   1   2   1
##   Asian or Pacific Islander     5   8   8   2   4   1   6   2   3   4   3
##   Black                        15  14  11  14   4  10  12   9  10   8   7
##   Other                         3   3   1   4   0   2   1   2   2   0   0
##   White                       118 128 137 124 101  92  93  93 101  91  77
##                              age
## race                           55  56  57  58  59  60  61  62  63  64  65
##   Amer Indian Aleut or Eskimo   1   1   0   0   1   0   2   1   1   0   1
##   Asian or Pacific Islander     5   3   1   1   1   2   2   0   2   1   1
##   Black                         8  13   6   8   6   3   8   8   7   4   8
##   Other                         1   0   0   0   1   1   0   0   2   0   0
##   White                        76  58  87  61  66  65  71  76  81  72  66
##                              age
## race                           66  67  68  69  70  71  72  73  74  75  76
##   Amer Indian Aleut or Eskimo   1   0   0   0   1   0   0   0   1   0   0
##   Asian or Pacific Islander     1   1   0   1   1   0   1   0   2   0   0
##   Black                         2   5   3   6   3   4   4   4   6   4   4
##   Other                         0   2   0   0   0   0   1   0   1   0   0
##   White                        66  73  48  49  51  56  44  66  56  44  43
##                              age
## race                           77  78  79  80  81  82  83  84  85  86  87
##   Amer Indian Aleut or Eskimo   0   0   0   0   0   0   0   0   0   0   0
##   Asian or Pacific Islander     1   1   1   0   0   1   1   0   0   0   1
##   Black                         1   5   1   2   4   3   2   5   1   0   0
##   Other                         0   0   0   0   1   0   0   0   0   0   0
##   White                        39  53  38  40  23  31  24  22  20  19  15
##                              age
## race                           88  89  90
##   Amer Indian Aleut or Eskimo   0   0   0
##   Asian or Pacific Islander     0   0   0
##   Black                         0   0   4
##   Other                         0   0   0
##   White                        12   9  29
mytable1<-xtabs(~class_of_worker+marital_status,data=usincome)
mytable1
##                                 marital_status
## class_of_worker                  Divorced Married-A F spouse present
##   Federal government                   22                          2
##   Local government                     42                          2
##   Never worked                          0                          0
##   Not in universe                     145                         11
##   Private                             371                         10
##   Self-employed-incorporated            8                          0
##   Self-employed-not incorporated       33                          2
##   State government                     32                          1
##   Without pay                           0                          0
##                                 marital_status
## class_of_worker                  Married-civilian spouse present
##   Federal government                                          93
##   Local government                                           279
##   Never worked                                                 2
##   Not in universe                                           1237
##   Private                                                   2085
##   Self-employed-incorporated                                 117
##   Self-employed-not incorporated                             311
##   State government                                           145
##   Without pay                                                  5
##                                 marital_status
## class_of_worker                  Married-spouse absent Never married
##   Federal government                                 3            25
##   Local government                                   3            61
##   Never worked                                       0            15
##   Not in universe                                   19          3017
##   Private                                           51          1061
##   Self-employed-incorporated                         0            21
##   Self-employed-not incorporated                     3            42
##   State government                                   1            61
##   Without pay                                        0             4
##                                 marital_status
## class_of_worker                  Separated Widowed
##   Federal government                     2       6
##   Local government                       7      13
##   Never worked                           0       0
##   Not in universe                       41     411
##   Private                               92      61
##   Self-employed-incorporated             1       1
##   Self-employed-not incorporated         4      14
##   State government                       1       4
##   Without pay                            0       0
mytable2<-xtabs(~major_industry_code+income_level,data=usincome)
mytable2
##                                      income_level
## major_industry_code                   Above 50k Below 50k
##   Agriculture                                11       143
##   Armed Forces                                0         2
##   Business and repair services               27       241
##   Communications                             10        45
##   Construction                               24       284
##   Education                                  53       398
##   Entertainment                               5        85
##   Finance insurance and real estate          54       277
##   Forestry and fisheries                      0         8
##   Hospital services                          26       161
##   Manufacturing-durable goods                79       372
##   Manufacturing-nondurable goods             44       341
##   Medical except hospital                    22       224
##   Mining                                      4        21
##   Not in universe or children                36      4862
##   Other professional services                48       170
##   Personal services except private HH         4       143
##   Private household services                  0        59
##   Public administration                      31       204
##   Retail trade                               38       853
##   Social services                             2       123
##   Transportation                             29       189
##   Utilities and sanitary services            20        36
##   Wholesale trade                            20       172
prop.table(table(major_industry_code,sex))*100
##                                      sex
## major_industry_code                   Female  Male
##   Agriculture                           0.39  1.15
##   Armed Forces                          0.00  0.02
##   Business and repair services          1.01  1.67
##   Communications                        0.24  0.31
##   Construction                          0.34  2.74
##   Education                             3.16  1.35
##   Entertainment                         0.46  0.44
##   Finance insurance and real estate     2.01  1.30
##   Forestry and fisheries                0.00  0.08
##   Hospital services                     1.43  0.44
##   Manufacturing-durable goods           1.25  3.26
##   Manufacturing-nondurable goods        1.71  2.14
##   Medical except hospital               2.03  0.43
##   Mining                                0.02  0.23
##   Not in universe or children          28.18 20.80
##   Other professional services           1.19  0.99
##   Personal services except private HH   0.98  0.49
##   Private household services            0.53  0.06
##   Public administration                 1.06  1.29
##   Retail trade                          4.61  4.30
##   Social services                       1.05  0.20
##   Transportation                        0.70  1.48
##   Utilities and sanitary services       0.08  0.48
##   Wholesale trade                       0.69  1.23
prop.table(table(major_industry_code,migration_msa))*100
##                                      migration_msa
## major_industry_code                   Abroad to MSA Abroad to nonMSA
##   Agriculture                            0.00000000       0.00000000
##   Armed Forces                           0.00000000       0.00000000
##   Business and repair services           0.00000000       0.00000000
##   Communications                         0.00000000       0.00000000
##   Construction                           0.04034698       0.00000000
##   Education                              0.00000000       0.00000000
##   Entertainment                          0.00000000       0.00000000
##   Finance insurance and real estate      0.00000000       0.00000000
##   Forestry and fisheries                 0.00000000       0.00000000
##   Hospital services                      0.00000000       0.00000000
##   Manufacturing-durable goods            0.04034698       0.00000000
##   Manufacturing-nondurable goods         0.02017349       0.00000000
##   Medical except hospital                0.00000000       0.00000000
##   Mining                                 0.00000000       0.00000000
##   Not in universe or children            0.20173492       0.04034698
##   Other professional services            0.02017349       0.00000000
##   Personal services except private HH    0.00000000       0.00000000
##   Private household services             0.02017349       0.00000000
##   Public administration                  0.00000000       0.00000000
##   Retail trade                           0.00000000       0.04034698
##   Social services                        0.00000000       0.00000000
##   Transportation                         0.02017349       0.00000000
##   Utilities and sanitary services        0.00000000       0.00000000
##   Wholesale trade                        0.02017349       0.00000000
##                                      migration_msa
## major_industry_code                    MSA to MSA MSA to nonMSA
##   Agriculture                          0.04034698    0.00000000
##   Armed Forces                         0.02017349    0.00000000
##   Business and repair services         0.30260238    0.12104095
##   Communications                       0.08069397    0.00000000
##   Construction                         0.48416381    0.04034698
##   Education                            0.58503127    0.00000000
##   Entertainment                        0.12104095    0.00000000
##   Finance insurance and real estate    0.36312286    0.00000000
##   Forestry and fisheries               0.04034698    0.00000000
##   Hospital services                    0.16138794    0.00000000
##   Manufacturing-durable goods          0.50433730    0.06052048
##   Manufacturing-nondurable goods       0.42364333    0.04034698
##   Medical except hospital              0.30260238    0.02017349
##   Mining                               0.02017349    0.00000000
##   Not in universe or children          4.47851523    0.40346984
##   Other professional services          0.22190841    0.00000000
##   Personal services except private HH  0.24208190    0.02017349
##   Private household services           0.06052048    0.02017349
##   Public administration                0.12104095    0.00000000
##   Retail trade                         1.45249143    0.06052048
##   Social services                      0.18156143    0.00000000
##   Transportation                       0.20173492    0.00000000
##   Utilities and sanitary services      0.06052048    0.00000000
##   Wholesale trade                      0.30260238    0.00000000
##                                      migration_msa
## major_industry_code                      Nonmover NonMSA to MSA
##   Agriculture                          1.41214444    0.02017349
##   Armed Forces                         0.02017349    0.00000000
##   Business and repair services         2.03752270    0.02017349
##   Communications                       0.38329635    0.00000000
##   Construction                         2.25943111    0.02017349
##   Education                            3.79261650    0.02017349
##   Entertainment                        0.72624571    0.00000000
##   Finance insurance and real estate    2.80411539    0.00000000
##   Forestry and fisheries               0.02017349    0.00000000
##   Hospital services                    1.63405285    0.00000000
##   Manufacturing-durable goods          4.11539237    0.00000000
##   Manufacturing-nondurable goods       2.96550333    0.00000000
##   Medical except hospital              1.93665524    0.02017349
##   Mining                               0.22190841    0.00000000
##   Not in universe or children         40.22594311    0.22190841
##   Other professional services          1.95682873    0.02017349
##   Personal services except private HH  1.00867460    0.00000000
##   Private household services           0.62537825    0.02017349
##   Public administration                2.13839016    0.02017349
##   Retail trade                         7.20193666    0.06052048
##   Social services                      1.08936857    0.00000000
##   Transportation                       1.85596127    0.00000000
##   Utilities and sanitary services      0.40346984    0.00000000
##   Wholesale trade                      1.63405285    0.02017349
##                                      migration_msa
## major_industry_code                   NonMSA to nonMSA Not identifiable
##   Agriculture                               0.10086746       0.00000000
##   Armed Forces                              0.00000000       0.00000000
##   Business and repair services              0.04034698       0.00000000
##   Communications                            0.00000000       0.00000000
##   Construction                              0.06052048       0.06052048
##   Education                                 0.20173492       0.00000000
##   Entertainment                             0.02017349       0.00000000
##   Finance insurance and real estate         0.14121444       0.00000000
##   Forestry and fisheries                    0.02017349       0.00000000
##   Hospital services                         0.06052048       0.02017349
##   Manufacturing-durable goods               0.12104095       0.04034698
##   Manufacturing-nondurable goods            0.22190841       0.00000000
##   Medical except hospital                   0.08069397       0.02017349
##   Mining                                    0.00000000       0.02017349
##   Not in universe or children               1.25075651       0.06052048
##   Other professional services               0.02017349       0.00000000
##   Personal services except private HH       0.02017349       0.06052048
##   Private household services                0.02017349       0.00000000
##   Public administration                     0.06052048       0.00000000
##   Retail trade                              0.40346984       0.12104095
##   Social services                           0.00000000       0.00000000
##   Transportation                            0.04034698       0.00000000
##   Utilities and sanitary services           0.00000000       0.00000000
##   Wholesale trade                           0.00000000       0.00000000
##                                      migration_msa
## major_industry_code                   Not in universe
##   Agriculture                              0.00000000
##   Armed Forces                             0.00000000
##   Business and repair services             0.00000000
##   Communications                           0.00000000
##   Construction                             0.00000000
##   Education                                0.00000000
##   Entertainment                            0.00000000
##   Finance insurance and real estate        0.00000000
##   Forestry and fisheries                   0.00000000
##   Hospital services                        0.00000000
##   Manufacturing-durable goods              0.00000000
##   Manufacturing-nondurable goods           0.00000000
##   Medical except hospital                  0.00000000
##   Mining                                   0.00000000
##   Not in universe or children              1.75509381
##   Other professional services              0.00000000
##   Personal services except private HH      0.00000000
##   Private household services               0.00000000
##   Public administration                    0.00000000
##   Retail trade                             0.00000000
##   Social services                          0.00000000
##   Transportation                           0.00000000
##   Utilities and sanitary services          0.00000000
##   Wholesale trade                          0.00000000
prop.table(table(major_industry_code,migration_reg))*100
##                                      migration_reg
## major_industry_code                        Abroad
##   Agriculture                          0.00000000
##   Armed Forces                         0.00000000
##   Business and repair services         0.00000000
##   Communications                       0.00000000
##   Construction                         0.04034698
##   Education                            0.00000000
##   Entertainment                        0.00000000
##   Finance insurance and real estate    0.00000000
##   Forestry and fisheries               0.00000000
##   Hospital services                    0.00000000
##   Manufacturing-durable goods          0.04034698
##   Manufacturing-nondurable goods       0.02017349
##   Medical except hospital              0.00000000
##   Mining                               0.00000000
##   Not in universe or children          0.24208190
##   Other professional services          0.02017349
##   Personal services except private HH  0.00000000
##   Private household services           0.02017349
##   Public administration                0.00000000
##   Retail trade                         0.04034698
##   Social services                      0.00000000
##   Transportation                       0.02017349
##   Utilities and sanitary services      0.00000000
##   Wholesale trade                      0.02017349
##                                      migration_reg
## major_industry_code                   Different county same state
##   Agriculture                                          0.02017349
##   Armed Forces                                         0.00000000
##   Business and repair services                         0.14121444
##   Communications                                       0.04034698
##   Construction                                         0.18156143
##   Education                                            0.18156143
##   Entertainment                                        0.06052048
##   Finance insurance and real estate                    0.08069397
##   Forestry and fisheries                               0.04034698
##   Hospital services                                    0.02017349
##   Manufacturing-durable goods                          0.18156143
##   Manufacturing-nondurable goods                       0.06052048
##   Medical except hospital                              0.10086746
##   Mining                                               0.00000000
##   Not in universe or children                          0.90780714
##   Other professional services                          0.02017349
##   Personal services except private HH                  0.06052048
##   Private household services                           0.02017349
##   Public administration                                0.02017349
##   Retail trade                                         0.44381682
##   Social services                                      0.02017349
##   Transportation                                       0.06052048
##   Utilities and sanitary services                      0.02017349
##   Wholesale trade                                      0.00000000
##                                      migration_reg
## major_industry_code                   Different division same region
##   Agriculture                                             0.02017349
##   Armed Forces                                            0.00000000
##   Business and repair services                            0.02017349
##   Communications                                          0.00000000
##   Construction                                            0.00000000
##   Education                                               0.04034698
##   Entertainment                                           0.00000000
##   Finance insurance and real estate                       0.02017349
##   Forestry and fisheries                                  0.00000000
##   Hospital services                                       0.00000000
##   Manufacturing-durable goods                             0.00000000
##   Manufacturing-nondurable goods                          0.04034698
##   Medical except hospital                                 0.02017349
##   Mining                                                  0.00000000
##   Not in universe or children                             0.26225540
##   Other professional services                             0.02017349
##   Personal services except private HH                     0.00000000
##   Private household services                              0.00000000
##   Public administration                                   0.00000000
##   Retail trade                                            0.00000000
##   Social services                                         0.00000000
##   Transportation                                          0.00000000
##   Utilities and sanitary services                         0.00000000
##   Wholesale trade                                         0.00000000
##                                      migration_reg
## major_industry_code                   Different region
##   Agriculture                               0.00000000
##   Armed Forces                              0.02017349
##   Business and repair services              0.04034698
##   Communications                            0.00000000
##   Construction                              0.04034698
##   Education                                 0.04034698
##   Entertainment                             0.00000000
##   Finance insurance and real estate         0.02017349
##   Forestry and fisheries                    0.00000000
##   Hospital services                         0.00000000
##   Manufacturing-durable goods               0.06052048
##   Manufacturing-nondurable goods            0.04034698
##   Medical except hospital                   0.00000000
##   Mining                                    0.00000000
##   Not in universe or children               0.58503127
##   Other professional services               0.04034698
##   Personal services except private HH       0.04034698
##   Private household services                0.00000000
##   Public administration                     0.04034698
##   Retail trade                              0.20173492
##   Social services                           0.00000000
##   Transportation                            0.02017349
##   Utilities and sanitary services           0.02017349
##   Wholesale trade                           0.02017349
##                                      migration_reg
## major_industry_code                   Different state same division
##   Agriculture                                            0.00000000
##   Armed Forces                                           0.00000000
##   Business and repair services                           0.04034698
##   Communications                                         0.00000000
##   Construction                                           0.04034698
##   Education                                              0.06052048
##   Entertainment                                          0.00000000
##   Finance insurance and real estate                      0.02017349
##   Forestry and fisheries                                 0.00000000
##   Hospital services                                      0.00000000
##   Manufacturing-durable goods                            0.04034698
##   Manufacturing-nondurable goods                         0.00000000
##   Medical except hospital                                0.02017349
##   Mining                                                 0.02017349
##   Not in universe or children                            0.34294936
##   Other professional services                            0.02017349
##   Personal services except private HH                    0.00000000
##   Private household services                             0.02017349
##   Public administration                                  0.00000000
##   Retail trade                                           0.10086746
##   Social services                                        0.00000000
##   Transportation                                         0.00000000
##   Utilities and sanitary services                        0.00000000
##   Wholesale trade                                        0.02017349
##                                      migration_reg
## major_industry_code                      Nonmover Not in universe
##   Agriculture                          1.41214444      0.00000000
##   Armed Forces                         0.02017349      0.00000000
##   Business and repair services         2.03752270      0.00000000
##   Communications                       0.38329635      0.00000000
##   Construction                         2.25943111      0.00000000
##   Education                            3.79261650      0.00000000
##   Entertainment                        0.72624571      0.00000000
##   Finance insurance and real estate    2.80411539      0.00000000
##   Forestry and fisheries               0.02017349      0.00000000
##   Hospital services                    1.63405285      0.00000000
##   Manufacturing-durable goods          4.11539237      0.00000000
##   Manufacturing-nondurable goods       2.96550333      0.00000000
##   Medical except hospital              1.93665524      0.00000000
##   Mining                               0.22190841      0.00000000
##   Not in universe or children         40.22594311      1.75509381
##   Other professional services          1.95682873      0.00000000
##   Personal services except private HH  1.00867460      0.00000000
##   Private household services           0.62537825      0.00000000
##   Public administration                2.13839016      0.00000000
##   Retail trade                         7.20193666      0.00000000
##   Social services                      1.08936857      0.00000000
##   Transportation                       1.85596127      0.00000000
##   Utilities and sanitary services      0.40346984      0.00000000
##   Wholesale trade                      1.63405285      0.00000000
##                                      migration_reg
## major_industry_code                   Same county
##   Agriculture                          0.12104095
##   Armed Forces                         0.00000000
##   Business and repair services         0.24208190
##   Communications                       0.04034698
##   Construction                         0.40346984
##   Education                            0.48416381
##   Entertainment                        0.08069397
##   Finance insurance and real estate    0.36312286
##   Forestry and fisheries               0.02017349
##   Hospital services                    0.22190841
##   Manufacturing-durable goods          0.44381682
##   Manufacturing-nondurable goods       0.54468428
##   Medical except hospital              0.30260238
##   Mining                               0.02017349
##   Not in universe or children          4.31712729
##   Other professional services          0.16138794
##   Personal services except private HH  0.24208190
##   Private household services           0.08069397
##   Public administration                0.14121444
##   Retail trade                         1.35162397
##   Social services                      0.16138794
##   Transportation                       0.16138794
##   Utilities and sanitary services      0.02017349
##   Wholesale trade                      0.28242889
prop.table(table(major_industry_code,weeks_worked_in_year))*100
##                                      weeks_worked_in_year
## major_industry_code                       0     1     2     3     4     5
##   Agriculture                          0.07  0.00  0.00  0.00  0.01  0.00
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.09  0.04  0.02  0.00  0.01  0.00
##   Communications                       0.00  0.00  0.00  0.00  0.00  0.00
##   Construction                         0.11  0.00  0.00  0.01  0.01  0.00
##   Education                            0.07  0.00  0.01  0.00  0.03  0.00
##   Entertainment                        0.04  0.02  0.00  0.00  0.00  0.00
##   Finance insurance and real estate    0.05  0.00  0.01  0.01  0.00  0.01
##   Forestry and fisheries               0.00  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.03  0.00  0.01  0.00  0.00  0.00
##   Manufacturing-durable goods          0.12  0.01  0.01  0.00  0.01  0.00
##   Manufacturing-nondurable goods       0.11  0.01  0.00  0.00  0.00  0.00
##   Medical except hospital              0.09  0.00  0.00  0.00  0.02  0.01
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children         44.96  0.22  0.13  0.10  0.26  0.08
##   Other professional services          0.05  0.01  0.00  0.01  0.02  0.00
##   Personal services except private HH  0.09  0.00  0.00  0.00  0.01  0.00
##   Private household services           0.04  0.01  0.00  0.01  0.01  0.00
##   Public administration                0.03  0.00  0.03  0.00  0.00  0.00
##   Retail trade                         0.45  0.00  0.02  0.03  0.09  0.01
##   Social services                      0.07  0.01  0.01  0.00  0.00  0.00
##   Transportation                       0.05  0.00  0.00  0.00  0.01  0.01
##   Utilities and sanitary services      0.00  0.00  0.00  0.00  0.00  0.00
##   Wholesale trade                      0.04  0.00  0.01  0.00  0.01  0.00
##                                      weeks_worked_in_year
## major_industry_code                       6     7     8     9    10    11
##   Agriculture                          0.02  0.02  0.03  0.00  0.02  0.00
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.00  0.00  0.01  0.00  0.02  0.00
##   Communications                       0.00  0.00  0.00  0.00  0.00  0.00
##   Construction                         0.00  0.01  0.03  0.01  0.01  0.00
##   Education                            0.00  0.00  0.02  0.01  0.02  0.01
##   Entertainment                        0.01  0.02  0.02  0.00  0.00  0.01
##   Finance insurance and real estate    0.00  0.00  0.00  0.01  0.01  0.00
##   Forestry and fisheries               0.01  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.00  0.00  0.02  0.00  0.00  0.00
##   Manufacturing-durable goods          0.02  0.00  0.02  0.02  0.01  0.00
##   Manufacturing-nondurable goods       0.01  0.00  0.06  0.00  0.00  0.01
##   Medical except hospital              0.00  0.00  0.02  0.00  0.01  0.00
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children          0.11  0.03  0.21  0.08  0.14  0.03
##   Other professional services          0.00  0.00  0.00  0.00  0.02  0.00
##   Personal services except private HH  0.00  0.00  0.02  0.00  0.00  0.00
##   Private household services           0.00  0.00  0.00  0.01  0.02  0.00
##   Public administration                0.02  0.00  0.01  0.00  0.00  0.00
##   Retail trade                         0.04  0.00  0.08  0.03  0.01  0.00
##   Social services                      0.00  0.00  0.00  0.00  0.01  0.00
##   Transportation                       0.01  0.00  0.00  0.00  0.00  0.00
##   Utilities and sanitary services      0.00  0.00  0.00  0.00  0.00  0.00
##   Wholesale trade                      0.00  0.00  0.02  0.00  0.00  0.00
##                                      weeks_worked_in_year
## major_industry_code                      12    13    14    15    16    17
##   Agriculture                          0.03  0.01  0.00  0.01  0.00  0.01
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.08  0.01  0.01  0.01  0.05  0.01
##   Communications                       0.00  0.00  0.00  0.00  0.00  0.00
##   Construction                         0.01  0.01  0.02  0.00  0.02  0.00
##   Education                            0.04  0.00  0.00  0.04  0.06  0.00
##   Entertainment                        0.00  0.01  0.00  0.00  0.01  0.01
##   Finance insurance and real estate    0.02  0.00  0.00  0.02  0.02  0.01
##   Forestry and fisheries               0.00  0.00  0.00  0.00  0.01  0.00
##   Hospital services                    0.00  0.01  0.00  0.00  0.00  0.01
##   Manufacturing-durable goods          0.05  0.00  0.01  0.00  0.01  0.00
##   Manufacturing-nondurable goods       0.01  0.02  0.00  0.01  0.03  0.00
##   Medical except hospital              0.00  0.01  0.01  0.00  0.02  0.01
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children          0.37  0.09  0.05  0.03  0.13  0.02
##   Other professional services          0.01  0.00  0.00  0.00  0.02  0.00
##   Personal services except private HH  0.02  0.01  0.00  0.00  0.02  0.00
##   Private household services           0.00  0.00  0.00  0.00  0.02  0.00
##   Public administration                0.00  0.01  0.00  0.00  0.00  0.01
##   Retail trade                         0.22  0.04  0.02  0.02  0.04  0.03
##   Social services                      0.02  0.01  0.00  0.00  0.04  0.00
##   Transportation                       0.00  0.00  0.00  0.00  0.00  0.01
##   Utilities and sanitary services      0.01  0.01  0.00  0.01  0.00  0.00
##   Wholesale trade                      0.03  0.00  0.00  0.00  0.02  0.01
##                                      weeks_worked_in_year
## major_industry_code                      18    19    20    21    22    23
##   Agriculture                          0.01  0.00  0.01  0.00  0.01  0.00
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.01  0.00  0.02  0.00  0.00  0.00
##   Communications                       0.00  0.00  0.01  0.00  0.00  0.01
##   Construction                         0.01  0.00  0.03  0.01  0.01  0.00
##   Education                            0.01  0.00  0.05  0.00  0.02  0.01
##   Entertainment                        0.01  0.00  0.01  0.00  0.00  0.00
##   Finance insurance and real estate    0.00  0.01  0.02  0.00  0.01  0.00
##   Forestry and fisheries               0.01  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.00  0.00  0.00  0.00  0.00  0.00
##   Manufacturing-durable goods          0.00  0.01  0.01  0.01  0.01  0.00
##   Manufacturing-nondurable goods       0.00  0.00  0.01  0.01  0.01  0.00
##   Medical except hospital              0.00  0.00  0.06  0.00  0.02  0.00
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children          0.04  0.00  0.16  0.03  0.06  0.01
##   Other professional services          0.00  0.00  0.01  0.00  0.00  0.00
##   Personal services except private HH  0.00  0.00  0.02  0.01  0.02  0.00
##   Private household services           0.00  0.00  0.00  0.00  0.00  0.00
##   Public administration                0.01  0.00  0.01  0.00  0.00  0.00
##   Retail trade                         0.04  0.01  0.24  0.03  0.02  0.01
##   Social services                      0.00  0.00  0.03  0.00  0.00  0.00
##   Transportation                       0.01  0.00  0.01  0.00  0.01  0.00
##   Utilities and sanitary services      0.00  0.00  0.00  0.00  0.00  0.00
##   Wholesale trade                      0.00  0.00  0.00  0.01  0.00  0.00
##                                      weeks_worked_in_year
## major_industry_code                      24    25    26    27    28    29
##   Agriculture                          0.00  0.00  0.02  0.00  0.02  0.00
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.02  0.00  0.05  0.00  0.04  0.00
##   Communications                       0.02  0.00  0.01  0.00  0.00  0.00
##   Construction                         0.02  0.01  0.15  0.00  0.02  0.00
##   Education                            0.00  0.06  0.03  0.02  0.03  0.01
##   Entertainment                        0.00  0.00  0.03  0.00  0.00  0.00
##   Finance insurance and real estate    0.02  0.00  0.03  0.00  0.01  0.01
##   Forestry and fisheries               0.00  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.02  0.00  0.03  0.00  0.00  0.00
##   Manufacturing-durable goods          0.04  0.00  0.09  0.00  0.03  0.00
##   Manufacturing-nondurable goods       0.03  0.01  0.10  0.00  0.02  0.00
##   Medical except hospital              0.00  0.01  0.01  0.00  0.01  0.00
##   Mining                               0.00  0.00  0.01  0.00  0.00  0.00
##   Not in universe or children          0.05  0.03  0.29  0.01  0.04  0.01
##   Other professional services          0.00  0.01  0.01  0.00  0.00  0.00
##   Personal services except private HH  0.01  0.02  0.03  0.00  0.01  0.00
##   Private household services           0.00  0.00  0.00  0.00  0.01  0.00
##   Public administration                0.00  0.01  0.03  0.00  0.00  0.00
##   Retail trade                         0.09  0.03  0.27  0.01  0.07  0.01
##   Social services                      0.00  0.00  0.03  0.00  0.03  0.00
##   Transportation                       0.00  0.00  0.03  0.00  0.00  0.00
##   Utilities and sanitary services      0.01  0.00  0.00  0.00  0.00  0.00
##   Wholesale trade                      0.02  0.00  0.01  0.00  0.02  0.00
##                                      weeks_worked_in_year
## major_industry_code                      30    32    33    34    35    36
##   Agriculture                          0.02  0.02  0.00  0.01  0.01  0.00
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.08  0.01  0.01  0.00  0.01  0.05
##   Communications                       0.00  0.01  0.00  0.00  0.00  0.00
##   Construction                         0.07  0.04  0.00  0.00  0.02  0.04
##   Education                            0.09  0.02  0.00  0.01  0.02  0.17
##   Entertainment                        0.01  0.01  0.00  0.00  0.01  0.03
##   Finance insurance and real estate    0.01  0.01  0.00  0.00  0.01  0.03
##   Forestry and fisheries               0.01  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.00  0.00  0.00  0.01  0.00  0.01
##   Manufacturing-durable goods          0.01  0.03  0.00  0.00  0.06  0.09
##   Manufacturing-nondurable goods       0.01  0.00  0.00  0.01  0.00  0.04
##   Medical except hospital              0.03  0.02  0.00  0.00  0.01  0.05
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children          0.07  0.06  0.00  0.04  0.03  0.08
##   Other professional services          0.01  0.01  0.01  0.00  0.01  0.01
##   Personal services except private HH  0.01  0.02  0.00  0.00  0.00  0.01
##   Private household services           0.03  0.04  0.00  0.00  0.01  0.01
##   Public administration                0.06  0.00  0.00  0.00  0.01  0.02
##   Retail trade                         0.16  0.08  0.00  0.02  0.06  0.11
##   Social services                      0.00  0.00  0.00  0.00  0.01  0.04
##   Transportation                       0.00  0.01  0.00  0.01  0.01  0.01
##   Utilities and sanitary services      0.00  0.00  0.00  0.00  0.00  0.00
##   Wholesale trade                      0.04  0.00  0.00  0.00  0.02  0.01
##                                      weeks_worked_in_year
## major_industry_code                      37    38    39    40    41    42
##   Agriculture                          0.00  0.02  0.00  0.02  0.00  0.00
##   Armed Forces                         0.00  0.00  0.00  0.01  0.00  0.00
##   Business and repair services         0.00  0.02  0.01  0.08  0.01  0.00
##   Communications                       0.00  0.00  0.00  0.00  0.00  0.00
##   Construction                         0.00  0.01  0.01  0.10  0.00  0.04
##   Education                            0.01  0.09  0.03  0.28  0.01  0.09
##   Entertainment                        0.00  0.00  0.00  0.04  0.00  0.02
##   Finance insurance and real estate    0.00  0.00  0.03  0.08  0.00  0.00
##   Forestry and fisheries               0.00  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.01  0.00  0.01  0.03  0.00  0.00
##   Manufacturing-durable goods          0.02  0.00  0.02  0.09  0.00  0.02
##   Manufacturing-nondurable goods       0.01  0.03  0.00  0.05  0.00  0.04
##   Medical except hospital              0.00  0.01  0.01  0.07  0.00  0.01
##   Mining                               0.00  0.00  0.00  0.01  0.00  0.00
##   Not in universe or children          0.01  0.02  0.02  0.11  0.00  0.00
##   Other professional services          0.00  0.01  0.00  0.08  0.00  0.00
##   Personal services except private HH  0.00  0.02  0.00  0.00  0.00  0.00
##   Private household services           0.00  0.00  0.00  0.06  0.00  0.00
##   Public administration                0.00  0.01  0.00  0.02  0.00  0.00
##   Retail trade                         0.01  0.05  0.06  0.34  0.00  0.05
##   Social services                      0.03  0.00  0.00  0.03  0.00  0.00
##   Transportation                       0.00  0.00  0.00  0.04  0.00  0.03
##   Utilities and sanitary services      0.01  0.00  0.00  0.01  0.00  0.00
##   Wholesale trade                      0.00  0.00  0.02  0.02  0.00  0.00
##                                      weeks_worked_in_year
## major_industry_code                      43    44    45    46    47    48
##   Agriculture                          0.02  0.05  0.00  0.01  0.00  0.02
##   Armed Forces                         0.00  0.00  0.00  0.00  0.00  0.00
##   Business and repair services         0.02  0.01  0.03  0.00  0.00  0.04
##   Communications                       0.00  0.00  0.01  0.00  0.00  0.01
##   Construction                         0.01  0.05  0.02  0.04  0.00  0.08
##   Education                            0.02  0.07  0.05  0.06  0.01  0.11
##   Entertainment                        0.00  0.00  0.02  0.01  0.00  0.03
##   Finance insurance and real estate    0.00  0.00  0.03  0.00  0.00  0.03
##   Forestry and fisheries               0.00  0.00  0.00  0.00  0.00  0.00
##   Hospital services                    0.01  0.02  0.01  0.01  0.01  0.01
##   Manufacturing-durable goods          0.04  0.03  0.07  0.04  0.02  0.04
##   Manufacturing-nondurable goods       0.02  0.06  0.05  0.01  0.02  0.03
##   Medical except hospital              0.00  0.02  0.02  0.01  0.00  0.04
##   Mining                               0.00  0.00  0.00  0.00  0.00  0.00
##   Not in universe or children          0.01  0.00  0.02  0.02  0.00  0.02
##   Other professional services          0.00  0.02  0.01  0.00  0.02  0.01
##   Personal services except private HH  0.02  0.01  0.03  0.02  0.00  0.03
##   Private household services           0.00  0.01  0.01  0.00  0.00  0.00
##   Public administration                0.00  0.01  0.00  0.02  0.01  0.01
##   Retail trade                         0.01  0.05  0.04  0.05  0.02  0.13
##   Social services                      0.01  0.00  0.01  0.02  0.02  0.01
##   Transportation                       0.01  0.00  0.01  0.03  0.00  0.06
##   Utilities and sanitary services      0.00  0.00  0.00  0.00  0.00  0.01
##   Wholesale trade                      0.00  0.01  0.01  0.02  0.00  0.04
##                                      weeks_worked_in_year
## major_industry_code                      49    50    51    52
##   Agriculture                          0.00  0.02  0.03  0.99
##   Armed Forces                         0.00  0.00  0.00  0.01
##   Business and repair services         0.02  0.06  0.02  1.70
##   Communications                       0.00  0.00  0.00  0.47
##   Construction                         0.03  0.15  0.01  1.85
##   Education                            0.00  0.07  0.00  2.75
##   Entertainment                        0.00  0.00  0.01  0.51
##   Finance insurance and real estate    0.02  0.05  0.02  2.71
##   Forestry and fisheries               0.00  0.00  0.00  0.04
##   Hospital services                    0.01  0.02  0.01  1.56
##   Manufacturing-durable goods          0.04  0.09  0.10  3.21
##   Manufacturing-nondurable goods       0.03  0.09  0.05  2.84
##   Medical except hospital              0.02  0.06  0.02  1.75
##   Mining                               0.00  0.00  0.01  0.22
##   Not in universe or children          0.00  0.01  0.00  0.69
##   Other professional services          0.02  0.05  0.02  1.72
##   Personal services except private HH  0.01  0.07  0.02  0.91
##   Private household services           0.00  0.00  0.00  0.29
##   Public administration                0.00  0.00  0.00  2.01
##   Retail trade                         0.05  0.18  0.11  5.37
##   Social services                      0.00  0.07  0.02  0.72
##   Transportation                       0.02  0.09  0.02  1.68
##   Utilities and sanitary services      0.00  0.01  0.00  0.48
##   Wholesale trade                      0.01  0.05  0.01  1.46
prop.table(table(major_industry_code,income_level))*100
##                                      income_level
## major_industry_code                   -50000 50000
##   Agriculture                           1.43  0.11
##   Armed Forces                          0.02  0.00
##   Business and repair services          2.41  0.27
##   Communications                        0.45  0.10
##   Construction                          2.84  0.24
##   Education                             3.98  0.53
##   Entertainment                         0.85  0.05
##   Finance insurance and real estate     2.77  0.54
##   Forestry and fisheries                0.08  0.00
##   Hospital services                     1.61  0.26
##   Manufacturing-durable goods           3.72  0.79
##   Manufacturing-nondurable goods        3.41  0.44
##   Medical except hospital               2.24  0.22
##   Mining                                0.21  0.04
##   Not in universe or children          48.62  0.36
##   Other professional services           1.70  0.48
##   Personal services except private HH   1.43  0.04
##   Private household services            0.59  0.00
##   Public administration                 2.04  0.31
##   Retail trade                          8.53  0.38
##   Social services                       1.23  0.02
##   Transportation                        1.89  0.29
##   Utilities and sanitary services       0.36  0.20
##   Wholesale trade                       1.72  0.20
prop.table(table(major_industry_code,full_parttime_employment_stat))*100
##                                      full_parttime_employment_stat
## major_industry_code                   Children or Armed Forces
##   Agriculture                                             0.78
##   Armed Forces                                            0.02
##   Business and repair services                            1.25
##   Communications                                          0.23
##   Construction                                            1.47
##   Education                                               2.28
##   Entertainment                                           0.43
##   Finance insurance and real estate                       1.64
##   Forestry and fisheries                                  0.04
##   Hospital services                                       0.93
##   Manufacturing-durable goods                             2.42
##   Manufacturing-nondurable goods                          1.82
##   Medical except hospital                                 1.18
##   Mining                                                  0.13
##   Not in universe or children                            36.10
##   Other professional services                             1.11
##   Personal services except private HH                     0.67
##   Private household services                              0.38
##   Public administration                                   1.16
##   Retail trade                                            4.63
##   Social services                                         0.63
##   Transportation                                          1.05
##   Utilities and sanitary services                         0.23
##   Wholesale trade                                         0.98
##                                      full_parttime_employment_stat
## major_industry_code                   Full-time schedules
##   Agriculture                                        0.54
##   Armed Forces                                       0.00
##   Business and repair services                       1.12
##   Communications                                     0.29
##   Construction                                       1.18
##   Education                                          1.80
##   Entertainment                                      0.38
##   Finance insurance and real estate                  1.40
##   Forestry and fisheries                             0.01
##   Hospital services                                  0.77
##   Manufacturing-durable goods                        1.83
##   Manufacturing-nondurable goods                     1.70
##   Medical except hospital                            1.08
##   Mining                                             0.09
##   Not in universe or children                        0.00
##   Other professional services                        0.97
##   Personal services except private HH                0.66
##   Private household services                         0.16
##   Public administration                              0.96
##   Retail trade                                       3.53
##   Social services                                    0.52
##   Transportation                                     0.88
##   Utilities and sanitary services                    0.29
##   Wholesale trade                                    0.81
##                                      full_parttime_employment_stat
## major_industry_code                   Not in labor force
##   Agriculture                                       0.01
##   Armed Forces                                      0.00
##   Business and repair services                      0.03
##   Communications                                    0.00
##   Construction                                      0.04
##   Education                                         0.01
##   Entertainment                                     0.02
##   Finance insurance and real estate                 0.03
##   Forestry and fisheries                            0.02
##   Hospital services                                 0.01
##   Manufacturing-durable goods                       0.00
##   Manufacturing-nondurable goods                    0.01
##   Medical except hospital                           0.02
##   Mining                                            0.00
##   Not in universe or children                      12.79
##   Other professional services                       0.01
##   Personal services except private HH               0.00
##   Private household services                        0.02
##   Public administration                             0.01
##   Retail trade                                      0.07
##   Social services                                   0.00
##   Transportation                                    0.01
##   Utilities and sanitary services                   0.01
##   Wholesale trade                                   0.02
##                                      full_parttime_employment_stat
## major_industry_code                   PT for econ reasons usually FT
##   Agriculture                                                   0.03
##   Armed Forces                                                  0.00
##   Business and repair services                                  0.03
##   Communications                                                0.00
##   Construction                                                  0.00
##   Education                                                     0.02
##   Entertainment                                                 0.00
##   Finance insurance and real estate                             0.01
##   Forestry and fisheries                                        0.00
##   Hospital services                                             0.00
##   Manufacturing-durable goods                                   0.02
##   Manufacturing-nondurable goods                                0.00
##   Medical except hospital                                       0.00
##   Mining                                                        0.00
##   Not in universe or children                                   0.00
##   Other professional services                                   0.00
##   Personal services except private HH                           0.02
##   Private household services                                    0.00
##   Public administration                                         0.00
##   Retail trade                                                  0.06
##   Social services                                               0.01
##   Transportation                                                0.02
##   Utilities and sanitary services                               0.00
##   Wholesale trade                                               0.01
##                                      full_parttime_employment_stat
## major_industry_code                   PT for econ reasons usually PT
##   Agriculture                                                   0.08
##   Armed Forces                                                  0.00
##   Business and repair services                                  0.07
##   Communications                                                0.00
##   Construction                                                  0.11
##   Education                                                     0.04
##   Entertainment                                                 0.01
##   Finance insurance and real estate                             0.02
##   Forestry and fisheries                                        0.01
##   Hospital services                                             0.03
##   Manufacturing-durable goods                                   0.03
##   Manufacturing-nondurable goods                                0.05
##   Medical except hospital                                       0.02
##   Mining                                                        0.02
##   Not in universe or children                                   0.00
##   Other professional services                                   0.00
##   Personal services except private HH                           0.04
##   Private household services                                    0.01
##   Public administration                                         0.06
##   Retail trade                                                  0.05
##   Social services                                               0.00
##   Transportation                                                0.06
##   Utilities and sanitary services                               0.00
##   Wholesale trade                                               0.01
##                                      full_parttime_employment_stat
## major_industry_code                   PT for non-econ reasons usually FT
##   Agriculture                                                       0.04
##   Armed Forces                                                      0.00
##   Business and repair services                                      0.09
##   Communications                                                    0.03
##   Construction                                                      0.16
##   Education                                                         0.25
##   Entertainment                                                     0.02
##   Finance insurance and real estate                                 0.14
##   Forestry and fisheries                                            0.00
##   Hospital services                                                 0.11
##   Manufacturing-durable goods                                       0.08
##   Manufacturing-nondurable goods                                    0.13
##   Medical except hospital                                           0.07
##   Mining                                                            0.00
##   Not in universe or children                                       0.00
##   Other professional services                                       0.03
##   Personal services except private HH                               0.02
##   Private household services                                        0.01
##   Public administration                                             0.14
##   Retail trade                                                      0.28
##   Social services                                                   0.06
##   Transportation                                                    0.11
##   Utilities and sanitary services                                   0.02
##   Wholesale trade                                                   0.05
##                                      full_parttime_employment_stat
## major_industry_code                   Unemployed full-time
##   Agriculture                                         0.06
##   Armed Forces                                        0.00
##   Business and repair services                        0.08
##   Communications                                      0.00
##   Construction                                        0.11
##   Education                                           0.06
##   Entertainment                                       0.02
##   Finance insurance and real estate                   0.05
##   Forestry and fisheries                              0.00
##   Hospital services                                   0.02
##   Manufacturing-durable goods                         0.13
##   Manufacturing-nondurable goods                      0.13
##   Medical except hospital                             0.06
##   Mining                                              0.01
##   Not in universe or children                         0.05
##   Other professional services                         0.06
##   Personal services except private HH                 0.04
##   Private household services                          0.00
##   Public administration                               0.01
##   Retail trade                                        0.20
##   Social services                                     0.02
##   Transportation                                      0.04
##   Utilities and sanitary services                     0.01
##   Wholesale trade                                     0.03
##                                      full_parttime_employment_stat
## major_industry_code                   Unemployed part- time
##   Agriculture                                          0.00
##   Armed Forces                                         0.00
##   Business and repair services                         0.01
##   Communications                                       0.00
##   Construction                                         0.01
##   Education                                            0.05
##   Entertainment                                        0.02
##   Finance insurance and real estate                    0.02
##   Forestry and fisheries                               0.00
##   Hospital services                                    0.00
##   Manufacturing-durable goods                          0.00
##   Manufacturing-nondurable goods                       0.01
##   Medical except hospital                              0.03
##   Mining                                               0.00
##   Not in universe or children                          0.04
##   Other professional services                          0.00
##   Personal services except private HH                  0.02
##   Private household services                           0.01
##   Public administration                                0.01
##   Retail trade                                         0.09
##   Social services                                      0.01
##   Transportation                                       0.01
##   Utilities and sanitary services                      0.00
##   Wholesale trade                                      0.01
prop.table(table(major_industry_code,citizenship))*100
##                                      citizenship
## major_industry_code                   Foreign born- Not a citizen of U S
##   Agriculture                                                       0.16
##   Armed Forces                                                      0.00
##   Business and repair services                                      0.24
##   Communications                                                    0.02
##   Construction                                                      0.27
##   Education                                                         0.21
##   Entertainment                                                     0.09
##   Finance insurance and real estate                                 0.14
##   Forestry and fisheries                                            0.01
##   Hospital services                                                 0.13
##   Manufacturing-durable goods                                       0.41
##   Manufacturing-nondurable goods                                    0.42
##   Medical except hospital                                           0.19
##   Mining                                                            0.00
##   Not in universe or children                                       2.79
##   Other professional services                                       0.05
##   Personal services except private HH                               0.24
##   Private household services                                        0.12
##   Public administration                                             0.05
##   Retail trade                                                      0.77
##   Social services                                                   0.07
##   Transportation                                                    0.22
##   Utilities and sanitary services                                   0.03
##   Wholesale trade                                                   0.12
##                                      citizenship
## major_industry_code                   Foreign born- U S citizen by naturalization
##   Agriculture                                                                0.03
##   Armed Forces                                                               0.00
##   Business and repair services                                               0.05
##   Communications                                                             0.03
##   Construction                                                               0.10
##   Education                                                                  0.11
##   Entertainment                                                              0.02
##   Finance insurance and real estate                                          0.19
##   Forestry and fisheries                                                     0.00
##   Hospital services                                                          0.14
##   Manufacturing-durable goods                                                0.26
##   Manufacturing-nondurable goods                                             0.18
##   Medical except hospital                                                    0.10
##   Mining                                                                     0.00
##   Not in universe or children                                                1.05
##   Other professional services                                                0.08
##   Personal services except private HH                                        0.05
##   Private household services                                                 0.06
##   Public administration                                                      0.07
##   Retail trade                                                               0.25
##   Social services                                                            0.04
##   Transportation                                                             0.09
##   Utilities and sanitary services                                            0.02
##   Wholesale trade                                                            0.06
##                                      citizenship
## major_industry_code                   Native- Born abroad of American Parent(s)
##   Agriculture                                                              0.01
##   Armed Forces                                                             0.00
##   Business and repair services                                             0.04
##   Communications                                                           0.01
##   Construction                                                             0.04
##   Education                                                                0.04
##   Entertainment                                                            0.01
##   Finance insurance and real estate                                        0.06
##   Forestry and fisheries                                                   0.00
##   Hospital services                                                        0.02
##   Manufacturing-durable goods                                              0.01
##   Manufacturing-nondurable goods                                           0.06
##   Medical except hospital                                                  0.01
##   Mining                                                                   0.00
##   Not in universe or children                                              0.35
##   Other professional services                                              0.02
##   Personal services except private HH                                      0.01
##   Private household services                                               0.00
##   Public administration                                                    0.02
##   Retail trade                                                             0.12
##   Social services                                                          0.00
##   Transportation                                                           0.03
##   Utilities and sanitary services                                          0.00
##   Wholesale trade                                                          0.02
##                                      citizenship
## major_industry_code                   Native- Born in Puerto Rico or U S Outlying
##   Agriculture                                                                0.00
##   Armed Forces                                                               0.00
##   Business and repair services                                               0.02
##   Communications                                                             0.00
##   Construction                                                               0.02
##   Education                                                                  0.03
##   Entertainment                                                              0.00
##   Finance insurance and real estate                                          0.03
##   Forestry and fisheries                                                     0.00
##   Hospital services                                                          0.02
##   Manufacturing-durable goods                                                0.04
##   Manufacturing-nondurable goods                                             0.01
##   Medical except hospital                                                    0.01
##   Mining                                                                     0.00
##   Not in universe or children                                                0.36
##   Other professional services                                                0.00
##   Personal services except private HH                                        0.00
##   Private household services                                                 0.00
##   Public administration                                                      0.00
##   Retail trade                                                               0.08
##   Social services                                                            0.01
##   Transportation                                                             0.01
##   Utilities and sanitary services                                            0.00
##   Wholesale trade                                                            0.02
##                                      citizenship
## major_industry_code                   Native- Born in the United States
##   Agriculture                                                      1.34
##   Armed Forces                                                     0.02
##   Business and repair services                                     2.33
##   Communications                                                   0.49
##   Construction                                                     2.65
##   Education                                                        4.12
##   Entertainment                                                    0.78
##   Finance insurance and real estate                                2.89
##   Forestry and fisheries                                           0.07
##   Hospital services                                                1.56
##   Manufacturing-durable goods                                      3.79
##   Manufacturing-nondurable goods                                   3.18
##   Medical except hospital                                          2.15
##   Mining                                                           0.25
##   Not in universe or children                                     44.43
##   Other professional services                                      2.03
##   Personal services except private HH                              1.17
##   Private household services                                       0.41
##   Public administration                                            2.21
##   Retail trade                                                     7.69
##   Social services                                                  1.13
##   Transportation                                                   1.83
##   Utilities and sanitary services                                  0.51
##   Wholesale trade                                                  1.70
prop.table(table(country_self,income_level))*100
##                               income_level
## country_self                        -50000       50000
##   Cambodia                      0.06093226  0.00000000
##   Canada                        0.17264141  0.04062151
##   China                         0.28435056  0.01015538
##   Columbia                      0.20310755  0.00000000
##   Cuba                          0.44683660  0.02031075
##   Dominican-Republic            0.38590434  0.01015538
##   Ecuador                       0.13201990  0.00000000
##   El-Salvador                   0.33512745  0.00000000
##   England                       0.24372905  0.06093226
##   France                        0.05077689  0.00000000
##   Germany                       0.44683660  0.07108764
##   Greece                        0.10155377  0.01015538
##   Guatemala                     0.12186453  0.00000000
##   Haiti                         0.15233066  0.01015538
##   Holand-Netherlands            0.01015538  0.01015538
##   Honduras                      0.11170915  0.00000000
##   Hong Kong                     0.05077689  0.00000000
##   Hungary                       0.04062151  0.02031075
##   India                         0.16248604  0.01015538
##   Iran                          0.04062151  0.02031075
##   Ireland                       0.09139840  0.01015538
##   Italy                         0.24372905  0.01015538
##   Jamaica                       0.17264141  0.00000000
##   Japan                         0.08124302  0.03046613
##   Laos                          0.04062151  0.00000000
##   Mexico                        2.74195186  0.08124302
##   Nicaragua                     0.16248604  0.01015538
##   Outlying-U S (Guam USVI etc)  0.04062151  0.00000000
##   Panama                        0.03046613  0.00000000
##   Peru                          0.11170915  0.00000000
##   Philippines                   0.38590434  0.05077689
##   Poland                        0.30466132  0.01015538
##   Portugal                      0.07108764  0.01015538
##   Puerto-Rico                   0.60932264  0.02031075
##   Scotland                      0.05077689  0.00000000
##   South Korea                   0.16248604  0.01015538
##   Taiwan                        0.07108764  0.04062151
##   Thailand                      0.05077689  0.02031075
##   Trinadad&Tobago               0.05077689  0.00000000
##   United-States                84.86848786  5.24017467
##   Vietnam                       0.21326292  0.03046613
##   Yugoslavia                    0.02031075  0.00000000
prop.table(table(citizenship,income_level))*100
##                                              income_level
## citizenship                                   -50000 50000
##   Foreign born- Not a citizen of U S            6.39  0.36
##   Foreign born- U S citizen by naturalization   2.70  0.28
##   Native- Born abroad of American Parent(s)     0.83  0.05
##   Native- Born in Puerto Rico or U S Outlying   0.64  0.02
##   Native- Born in the United States            83.57  5.16
prop.table(table(major_industry_code,sex))*100
##                                      sex
## major_industry_code                   Female  Male
##   Agriculture                           0.39  1.15
##   Armed Forces                          0.00  0.02
##   Business and repair services          1.01  1.67
##   Communications                        0.24  0.31
##   Construction                          0.34  2.74
##   Education                             3.16  1.35
##   Entertainment                         0.46  0.44
##   Finance insurance and real estate     2.01  1.30
##   Forestry and fisheries                0.00  0.08
##   Hospital services                     1.43  0.44
##   Manufacturing-durable goods           1.25  3.26
##   Manufacturing-nondurable goods        1.71  2.14
##   Medical except hospital               2.03  0.43
##   Mining                                0.02  0.23
##   Not in universe or children          28.18 20.80
##   Other professional services           1.19  0.99
##   Personal services except private HH   0.98  0.49
##   Private household services            0.53  0.06
##   Public administration                 1.06  1.29
##   Retail trade                          4.61  4.30
##   Social services                       1.05  0.20
##   Transportation                        0.70  1.48
##   Utilities and sanitary services       0.08  0.48
##   Wholesale trade                       0.69  1.23
prop.table(table(marital_status,income_level))*100
##                                  income_level
## marital_status                    -50000 50000
##   Divorced                          6.02  0.51
##   Married-A F spouse present        0.28  0.00
##   Married-civilian spouse present  38.11  4.63
##   Married-spouse absent             0.78  0.02
##   Never married                    42.60  0.47
##   Separated                         1.42  0.06
##   Widowed                           4.92  0.18
prop.table(table(member_of_labor_union,income_level))*100
##                      income_level
## member_of_labor_union -50000 50000
##       No                7.77  0.80
##       Not in universe  85.05  4.91
##       Yes               1.31  0.16
prop.table(table(race,sex))*100
##                              sex
## race                          Female  Male
##   Amer Indian Aleut or Eskimo   0.66  0.52
##   Asian or Pacific Islander     1.63  1.46
##   Black                         5.80  4.47
##   Other                         0.96  0.87
##   White                        44.07 39.56
prop.table(table(race,country_self))*100
##                              country_self
## race                             Cambodia      Canada       China
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.05077689  0.00000000  0.29450594
##   Black                        0.00000000  0.01015538  0.00000000
##   Other                        0.00000000  0.00000000  0.00000000
##   White                        0.01015538  0.20310755  0.00000000
##                              country_self
## race                             Columbia        Cuba Dominican-Republic
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000         0.00000000
##   Asian or Pacific Islander    0.00000000  0.00000000         0.00000000
##   Black                        0.00000000  0.00000000         0.02031075
##   Other                        0.00000000  0.02031075         0.09139840
##   White                        0.20310755  0.44683660         0.28435056
##                              country_self
## race                              Ecuador El-Salvador     England
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.00000000  0.00000000
##   Black                        0.00000000  0.01015538  0.00000000
##   Other                        0.05077689  0.02031075  0.00000000
##   White                        0.08124302  0.30466132  0.30466132
##                              country_self
## race                               France     Germany      Greece
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.01015538  0.00000000
##   Black                        0.00000000  0.02031075  0.00000000
##   Other                        0.00000000  0.01015538  0.00000000
##   White                        0.05077689  0.47730273  0.11170915
##                              country_self
## race                            Guatemala       Haiti Holand-Netherlands
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000         0.00000000
##   Asian or Pacific Islander    0.00000000  0.00000000         0.00000000
##   Black                        0.00000000  0.16248604         0.00000000
##   Other                        0.02031075  0.00000000         0.00000000
##   White                        0.10155377  0.00000000         0.02031075
##                              country_self
## race                             Honduras   Hong Kong     Hungary
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.04062151  0.00000000
##   Black                        0.00000000  0.00000000  0.00000000
##   Other                        0.03046613  0.00000000  0.00000000
##   White                        0.08124302  0.01015538  0.06093226
##                              country_self
## race                                India        Iran     Ireland
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.14217528  0.01015538  0.00000000
##   Black                        0.00000000  0.00000000  0.00000000
##   Other                        0.01015538  0.01015538  0.00000000
##   White                        0.02031075  0.04062151  0.10155377
##                              country_self
## race                                Italy     Jamaica       Japan
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.01015538  0.08124302
##   Black                        0.01015538  0.14217528  0.00000000
##   Other                        0.00000000  0.01015538  0.00000000
##   White                        0.24372905  0.01015538  0.03046613
##                              country_self
## race                                 Laos      Mexico   Nicaragua
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.04062151  0.00000000  0.00000000
##   Black                        0.00000000  0.00000000  0.01015538
##   Other                        0.00000000  0.43668122  0.00000000
##   White                        0.00000000  2.38651366  0.16248604
##                              country_self
## race                          Outlying-U S (Guam USVI etc)      Panama
##   Amer Indian Aleut or Eskimo                   0.00000000  0.00000000
##   Asian or Pacific Islander                     0.04062151  0.00000000
##   Black                                         0.00000000  0.00000000
##   Other                                         0.00000000  0.00000000
##   White                                         0.00000000  0.03046613
##                              country_self
## race                                 Peru Philippines      Poland
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.39605971  0.00000000
##   Black                        0.00000000  0.00000000  0.00000000
##   Other                        0.02031075  0.00000000  0.00000000
##   White                        0.09139840  0.04062151  0.31481670
##                              country_self
## race                             Portugal Puerto-Rico    Scotland
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.00000000  0.01015538  0.00000000
##   Black                        0.00000000  0.00000000  0.00000000
##   Other                        0.00000000  0.06093226  0.00000000
##   White                        0.08124302  0.55854575  0.05077689
##                              country_self
## race                          South Korea      Taiwan    Thailand
##   Amer Indian Aleut or Eskimo  0.00000000  0.00000000  0.00000000
##   Asian or Pacific Islander    0.17264141  0.11170915  0.07108764
##   Black                        0.00000000  0.00000000  0.00000000
##   Other                        0.00000000  0.00000000  0.00000000
##   White                        0.00000000  0.00000000  0.00000000
##                              country_self
## race                          Trinadad&Tobago United-States     Vietnam
##   Amer Indian Aleut or Eskimo      0.00000000    1.19833452  0.00000000
##   Asian or Pacific Islander        0.00000000    1.19833452  0.24372905
##   Black                            0.03046613    9.79993907  0.00000000
##   Other                            0.01015538    0.98507160  0.00000000
##   White                            0.01015538   76.92698284  0.00000000
##                              country_self
## race                           Yugoslavia
##   Amer Indian Aleut or Eskimo  0.00000000
##   Asian or Pacific Islander    0.00000000
##   Black                        0.00000000
##   Other                        0.00000000
##   White                        0.02031075
prop.table(table(race,citizenship))*100
##                              citizenship
## race                          Foreign born- Not a citizen of U S
##   Amer Indian Aleut or Eskimo                               0.00
##   Asian or Pacific Islander                                 1.20
##   Black                                                     0.39
##   Other                                                     0.66
##   White                                                     4.50
##                              citizenship
## race                          Foreign born- U S citizen by naturalization
##   Amer Indian Aleut or Eskimo                                        0.00
##   Asian or Pacific Islander                                          0.58
##   Black                                                              0.16
##   Other                                                              0.11
##   White                                                              2.13
##                              citizenship
## race                          Native- Born abroad of American Parent(s)
##   Amer Indian Aleut or Eskimo                                      0.00
##   Asian or Pacific Islander                                        0.08
##   Black                                                            0.07
##   Other                                                            0.03
##   White                                                            0.70
##                              citizenship
## race                          Native- Born in Puerto Rico or U S Outlying
##   Amer Indian Aleut or Eskimo                                        0.00
##   Asian or Pacific Islander                                          0.05
##   Black                                                              0.00
##   Other                                                              0.06
##   White                                                              0.55
##                              citizenship
## race                          Native- Born in the United States
##   Amer Indian Aleut or Eskimo                              1.18
##   Asian or Pacific Islander                                1.18
##   Black                                                    9.65
##   Other                                                    0.97
##   White                                                   75.75
prop.table(table(race,citizenship))*100
##                              citizenship
## race                          Foreign born- Not a citizen of U S
##   Amer Indian Aleut or Eskimo                               0.00
##   Asian or Pacific Islander                                 1.20
##   Black                                                     0.39
##   Other                                                     0.66
##   White                                                     4.50
##                              citizenship
## race                          Foreign born- U S citizen by naturalization
##   Amer Indian Aleut or Eskimo                                        0.00
##   Asian or Pacific Islander                                          0.58
##   Black                                                              0.16
##   Other                                                              0.11
##   White                                                              2.13
##                              citizenship
## race                          Native- Born abroad of American Parent(s)
##   Amer Indian Aleut or Eskimo                                      0.00
##   Asian or Pacific Islander                                        0.08
##   Black                                                            0.07
##   Other                                                            0.03
##   White                                                            0.70
##                              citizenship
## race                          Native- Born in Puerto Rico or U S Outlying
##   Amer Indian Aleut or Eskimo                                        0.00
##   Asian or Pacific Islander                                          0.05
##   Black                                                              0.00
##   Other                                                              0.06
##   White                                                              0.55
##                              citizenship
## race                          Native- Born in the United States
##   Amer Indian Aleut or Eskimo                              1.18
##   Asian or Pacific Islander                                1.18
##   Black                                                    9.65
##   Other                                                    0.97
##   White                                                   75.75
prop.table(table(race,income_level))*100
##                              income_level
## race                          -50000 50000
##   Amer Indian Aleut or Eskimo   1.13  0.05
##   Asian or Pacific Islander     2.86  0.23
##   Black                        10.02  0.25
##   Other                         1.78  0.05
##   White                        78.34  5.29
prop.table(table(race,income_level))*100
##                              income_level
## race                          -50000 50000
##   Amer Indian Aleut or Eskimo   1.13  0.05
##   Asian or Pacific Islander     2.86  0.23
##   Black                        10.02  0.25
##   Other                         1.78  0.05
##   White                        78.34  5.29
prop.table(table(hispanic_origin,income_level))*100
##                            income_level
## hispanic_origin                  -50000       50000
##   All other                 81.41237837  5.57728960
##   Central or South American  1.93600160  0.02006219
##   Chicano                    0.12037316  0.00000000
##   Cuban                      0.59183469  0.02006219
##   Do not know                0.16049754  0.00000000
##   Mexican-American           3.90209650  0.12037316
##   Mexican (Mexicano)         3.58110141  0.05015548
##   Other Spanish              1.00310964  0.06018658
##   Puerto Rican               1.41438459  0.03009329
prop.table(table(race=="White"))*100
## 
## FALSE  TRUE 
## 16.37 83.63
prop.table(table(sex,income_level))*100
##         income_level
## sex      -50000 50000
##   Female  52.00  1.12
##   Male    42.13  4.75
prop.table(table(sex,tax_filer_status))*100
##         tax_filer_status
## sex      Head of household Joint both 65+ Joint both under 65
##   Female              3.10           1.94               17.85
##   Male                0.78           2.03               16.93
##         tax_filer_status
## sex      Joint one under 65 & one 65+ Nonfiler Single
##   Female                         0.85    20.05   9.33
##   Male                           0.88    16.71   9.55
prop.table(table(member_of_labor_union,citizenship))*100
##                      citizenship
## member_of_labor_union Foreign born- Not a citizen of U S
##       No                                            0.57
##       Not in universe                               6.11
##       Yes                                           0.07
##                      citizenship
## member_of_labor_union Foreign born- U S citizen by naturalization
##       No                                                     0.28
##       Not in universe                                        2.60
##       Yes                                                    0.10
##                      citizenship
## member_of_labor_union Native- Born abroad of American Parent(s)
##       No                                                   0.05
##       Not in universe                                      0.82
##       Yes                                                  0.01
##                      citizenship
## member_of_labor_union Native- Born in Puerto Rico or U S Outlying
##       No                                                     0.02
##       Not in universe                                        0.63
##       Yes                                                    0.01
##                      citizenship
## member_of_labor_union Native- Born in the United States
##       No                                           7.65
##       Not in universe                             79.80
##       Yes                                          1.28

Boxplots of the different variables

boxplot(age~class_of_worker,data=usincome,main="Boxplot Representation of Age Vs Class of Worker",xlab="Class of Worker",ylab="Age",las=2)

boxplot(age~income_level,data=usincome,main="Boxplot Representation of Age Vs Income_Level",xlab="Income Level",ylab="Age")

boxplot(industry_code~income_level,data=usincome,main="Boxplot Representation of Industry Code Vs Income_Level",xlab="Income_Level",ylab="Industry")

boxplot(wage_per_hour~income_level,data=usincome,main="Boxplot Representation of Wage per Hour Vs Income_Level",xlab="Income_Level",ylab="Wage per Hour")

Histogram for suitable data fields.

library(lattice)
histogram(~age,data=usincome,main="Distribution of Age",xlab="Age Variation",col="pink")

library(lattice)
histogram(~class_of_worker,data=usincome,main="Distribution of Class of Worker", xlab="Class of Worker",col="green",las=2)

histogram(~occupation_code,main="Occupation Code Frequency Distribution",xlab="Occupation Code",col="gold2")

histogram(~industry_code,  main="Industry Code Frequency Distribution",xlab="Occupation Code",col="black")

Different plots for data fields.

library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplot(age,income_level,main="Variation in Salary with age",xlab="Age",ylab="Salary (US Dollars)")

library(lattice)
marriage_and_wage<-as.data.frame(table(marital_status,wage_per_hour))
xyplot(marriage_and_wage$marital_status~marriage_and_wage$Freq,type=c("p","g","smooth"),xlab="Wage/Hour",ylab="Frequency of Earning",xlim=c(0,200))

plot(industry_code~wage_per_hour,main="Industry code Vs Wage / Hour")
abline(0,1)

Occ<-as.data.frame(table(education,occupation_code))
library(UsingR)
## Loading required package: MASS
## Loading required package: HistData
## Loading required package: Hmisc
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## 
## Attaching package: 'UsingR'
## The following object is masked from 'package:survival':
## 
##     cancer
## The following objects are masked from 'package:psych':
## 
##     galton, headtail
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
## 
##     src, summarize
## The following object is masked from 'package:MASS':
## 
##     select
## The following object is masked from 'package:car':
## 
##     recode
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
g<-ggplot(filter(Occ,Freq>0),aes(x=occupation_code,y=education))
g=g+scale_size(range = c(2,20),guide="none")
g<-g+geom_point(colour="gold2",aes(size=Freq+20,show_guide=FALSE))
## Warning: Ignoring unknown aesthetics: show_guide
g

Correlation Matrix using corrgram

x<-usincome[,c(1,3,4,6,17,18,19,39,41)]
library(corrgram)
cols4<-colorRampPalette(c("peachpuff","lightpink","royalblue3","navyblue"))
corrgram(x, order=FALSE, col.regions=cols4, lower.panel=panel.shade, upper.panel=panel.pie, text.panel=panel.txt, main="Corrgram of variables")

Scatter plot Matrix

library(car)
scatterplotMatrix(formula=~wage_per_hour+class_of_worker+race,cex=0.6,data=usincome,diagonal="density")

Different Tests

cor.test(income_level,age)
## 
##  Pearson's product-moment correlation
## 
## data:  income_level and age
## t = 13.223, df = 9998, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1117873 0.1503139
## sample estimates:
##       cor 
## 0.1311001
cor.test(income_level,wage_per_hour)
## 
##  Pearson's product-moment correlation
## 
## data:  income_level and wage_per_hour
## t = 2.5488, df = 9998, p-value = 0.01082
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.005885531 0.045060225
## sample estimates:
##        cor 
## 0.02548266
cor.test(income_level,capital_gains)
## 
##  Pearson's product-moment correlation
## 
## data:  income_level and capital_gains
## t = 23.912, df = 9998, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2139579 0.2510383
## sample estimates:
##       cor 
## 0.2325826
cor.test(income_level,capital_losses)
## 
##  Pearson's product-moment correlation
## 
## data:  income_level and capital_losses
## t = 14.154, df = 9998, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1208917 0.1593220
## sample estimates:
##       cor 
## 0.1401596
chisq.test(mytable)
## Warning in chisq.test(mytable): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mytable
## X-squared = 431.81, df = 360, p-value = 0.005527
chisq.test(mytable1)
## Warning in chisq.test(mytable1): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mytable1
## X-squared = 2079.7, df = 48, p-value < 2.2e-16
chisq.test(mytable2)
## Warning in chisq.test(mytable2): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mytable2
## X-squared = 776.6, df = 23, p-value < 2.2e-16