All the variables in this dataset were compiled from a sample of the National Survey of College Graduates through the IPUMS-HigherEd site.

For this assignment, we requested a new extract from CPS-IPUMS to include variables related to job satisfaction including: access to health insurance, pension benefits, paid vacation, membership to professional organizations and whether the job is related to the highest degree acquired.

The data used for this analysis consists of a sample from the National Survey of College Graduates gathered through IPUMS-Higher Ed.

library(car)
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.1. https://CRAN.R-project.org/package=stargazer
library(survey)
## Loading required package: grid
## Loading required package: Matrix
## Loading required package: survival
## 
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
## 
##     dotchart
library(ggplot2)
library(pander)
library(knitr)
library(haven)
cpsipums4<-read_dta("~/Statistics II/Data for project/highered/highered_00009.dta")
names(cpsipums4) #print the column names
##  [1] "personid" "year"     "weight"   "sample"   "surid"    "gender"  
##  [7] "minrty"   "raceth"   "bthus"    "chtot"    "dgrdg"    "lfstat"  
## [13] "hrswkgr"  "jobins"   "jobpens"  "jobvac"   "ocedrlp"  "prmbr"   
## [19] "salary"

Recoding of Variables

#income grouping
cpsipums4$salary4<-ifelse(cpsipums4$salary==9999998:9999999, NA, cpsipums4$salary)
#number of children living in the household
cpsipums4$chtot<-recode(cpsipums4$chtot, recodes="00='no children'; 01='one child'; 02='one to three children'; 03='two or more children'; 04='more than 3 children'; 98=NA", as.factor.result=T)
cpsipums4$chtot<-relevel(cpsipums4$chtot, ref = "one child")
table(cpsipums4$chtot)
## 
##            one child two or more children 
##                14472                20517
#gender
cpsipums4$female<-recode(cpsipums4$gender, recodes=1)
cpsipums4$male<-recode(cpsipums4$gender, recodes=2)
cpsipums4$gender<-recode(cpsipums4$gender, recodes="1='female'; 2='male'", as.factor.result=T)
table(cpsipums4$gender)
## 
## female   male 
##  38626  45830
cpsipums4$gender<-relevel(cpsipums4$gender, ref = "female")
#race/ethnicity 
#There are no entries in this data set under "other"
cpsipums4$asian<-recode(cpsipums4$raceth, recodes=1)
cpsipums4$white<-recode(cpsipums4$raceth, recodes=2)
cpsipums4$minorities<-recode(cpsipums4$raceth, recodes=3)
cpsipums4$other<-recode(cpsipums4$raceth, recodes=4)

cpsipums4$raceth<-recode(cpsipums4$raceth, recodes="1='asian'; 2='white'; 3='minorities'", as.factor.result=T)
cpsipums4$raceth<-relevel(cpsipums4$raceth, ref = "white")

table(cpsipums4$raceth)
## 
##      white      asian minorities 
##      51846      13868      18742
 #education level
cpsipums4$dgrdg<-recode(cpsipums4$dgrdg, recodes="1='0bachelors'; 2='1masters'; 3='2doctorate'; 4='3professional'", as.factor.result=T)
table(cpsipums4$dgrdg, cpsipums4$gender)
##                
##                 female  male
##   0bachelors     18930 25269
##   1masters       16756 16585
##   2doctorate      1103  1611
##   3professional   1837  2365

Recoding of Variables to Build Job Satisfaction Index

#Access to Pension (1=yes, 0=no)
cpsipums4$pension<-recode(cpsipums4$jobpens, recodes = "1=1; 0=0; 98=NA")
table(cpsipums4$pension)
## 
##     0     1 
## 19749 51625
#participation in professional organizations
cpsipums4$organizations<-recode(cpsipums4$prmbr, recodes = "0000=NA; 96=NA; 99=NA; 98=NA")
table(cpsipums4$organizations)
## 
##     1     2     3     4     5     6 
## 18166 11588  4874  1828   879   620
#Access to vacation (1=yes, 0=no)
cpsipums4$vacation<-recode(cpsipums4$jobvac, recodes = "1=1; 0=0; 98=NA")
table(cpsipums4$vacation)
## 
##     0     1 
## 12204 59170
#Access to Health Insurance (1=yes, 0=no)
cpsipums4$insurance<-recode(cpsipums4$jobins, recodes = "1=1; 0=0; 98=NA")
table(cpsipums4$insurance)
## 
##     0     1 
## 11497 59877
#Job relationship to highest degree (1=it is related, 0=not related)
cpsipums4$related<-recode(cpsipums4$ocedrlp, recodes = "1:2=1; 3=0; 98=NA")
table(cpsipums4$related)
## 
##     0     1 
##  9971 61403

Analysis

We will use the prcomp function to do the pca by specifying our variables we want in our index using a formula, the name of the data, we also specify R to z-score the data (center=T removes the mean, scale=T divides by the standard deviation for each variable), and the retx=T will calculate the PC scores for each individual for each component.

Our Scree plot shows an eigenvalue higher than 1. PC1 seems to be the most fitting summary measure explaining 43% of all variation however, membership to professional organizations may not be an effective variable in this index.

Further review of PC1 shows that three components account for at least 50% of the variation.

library(dplyr)
## 
## Attaching package: 'dplyr'
## 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
cpsi<- cpsipums4 %>%
  select(related, organizations, pension, vacation, insurance)%>%
  filter(complete.cases(.))

apply(cpsi, MARGIN = 2, var)
##       related organizations       pension      vacation     insurance 
##    0.07612482    1.25082159    0.20024455    0.14648699    0.12913184
cpsipums4.pc<-prcomp(~related+pension+vacation+insurance+organizations,data=cpsipums4, center=T, scale=T, retx=T)

#Screeplot
screeplot(cpsipums4.pc, type = "l", main = "Scree Plot")
abline(h=1)

#Request some basic summaries of the PCA analysis option(digits=3)
summary(cpsipums4.pc)
## Importance of components:
##                          PC1    PC2    PC3    PC4     PC5
## Standard deviation     1.477 1.0215 0.9621 0.7127 0.58543
## Proportion of Variance 0.436 0.2087 0.1851 0.1016 0.06855
## Cumulative Proportion  0.436 0.6448 0.8299 0.9314 1.00000
cpsipums4.pc$rotation
##                       PC1         PC2         PC3         PC4         PC5
## related        0.14994534 -0.63529206  0.75570251 -0.04057262 -0.03446709
## pension        0.53849708  0.02561616 -0.12864179 -0.83184327  0.02920245
## vacation       0.58499510  0.06078000 -0.07791547  0.36747642 -0.71622398
## insurance      0.58371895 -0.01065113 -0.07088716  0.41292102  0.69543510
## organizations -0.06775113 -0.76937648 -0.63345813  0.02911965 -0.03677593
#then I plot the first 2 components
hist(cpsipums4.pc$x[,1])

hist(cpsipums4.pc$x[,2])

Next, we calculate the correlation between the first 2 components to show they are orthogonal, i.e. correlation == 0

cor(cpsipums4.pc$x[,1:2])
##               PC1           PC2
## PC1  1.000000e+00 -7.943575e-15
## PC2 -7.943575e-15  1.000000e+00
scores<-data.frame(cpsipums4.pc$x)
scores$name<-rownames(cpsipums4.pc$x)
cpsipums4$name<-rownames(cpsipums4)
cpsipums4<-merge(cpsipums4, scores, by.x="name", by.y="name", all.x=F)
tail(names(cpsipums4), 20)
##  [1] "ocedrlp"       "prmbr"         "salary"        "salary4"      
##  [5] "female"        "male"          "asian"         "white"        
##  [9] "minorities"    "other"         "pension"       "organizations"
## [13] "vacation"      "insurance"     "related"       "PC1"          
## [17] "PC2"           "PC3"           "PC4"           "PC5"

Here we examine correlation among our job variables

round(cor(cpsipums4[,c("related","pension","vacation","insurance","organizations")], method = "spearman"), 3)
##               related pension vacation insurance organizations
## related         1.000   0.086    0.097     0.132         0.051
## pension         0.086   1.000    0.535     0.526        -0.039
## vacation        0.097   0.535    1.000     0.655        -0.076
## insurance       0.132   0.526    0.655     1.000        -0.039
## organizations   0.051  -0.039   -0.076    -0.039         1.000

The correlations among the original variables and the components under PC1 show that pension, vacation and insurance have a positive relationship to the job satisfaction index followed by the job’s relationship to the highest degree earned. The component of membership to professional organizations has a slight negative relationship.

round(cor(cpsipums4[,c("related","pension","vacation","insurance","organizations", "PC1", "PC2")], method = "spearman"),3)
##               related pension vacation insurance organizations    PC1
## related         1.000   0.086    0.097     0.132         0.051  0.291
## pension         0.086   1.000    0.535     0.526        -0.039  0.741
## vacation        0.097   0.535    1.000     0.655        -0.076  0.660
## insurance       0.132   0.526    0.655     1.000        -0.039  0.626
## organizations   0.051  -0.039   -0.076    -0.039         1.000 -0.432
## PC1             0.291   0.741    0.660     0.626        -0.432  1.000
## PC2            -0.469   0.198    0.189     0.081        -0.841  0.444
##                  PC2
## related       -0.469
## pension        0.198
## vacation       0.189
## insurance      0.081
## organizations -0.841
## PC1            0.444
## PC2            1.000

Using the Principal Components

Next, we use the PC’s we just generated in an analysis

#Survey design object
options(survey.lonely.psu = "adjust")
cpsipums4$pc1q<-cpsipums4$PC1
des<-svydesign(ids=~1, strata=~sample, weights=~weight, data=cpsipums4)

#means of the variables in the index
svyby( ~related+pension+vacation+insurance+organizations,~pc1q, des,FUN=svymean , na.rm=T)
##                          pc1q related pension vacation insurance
## -4.25093822316251  -4.2509382       0       0        0         0
## -4.19035967655366  -4.1903597       0       0        0         0
## -4.1297811299448   -4.1297811       0       0        0         0
## -4.06920258333594  -4.0692026       0       0        0         0
## -4.00862403672709  -4.0086240       0       0        0         0
## -3.94804549011823  -3.9480455       0       0        0         0
## -3.7074754155757   -3.7074754       1       0        0         0
## -3.64689686896684  -3.6468969       1       0        0         0
## -3.58631832235798  -3.5863183       1       0        0         0
## -3.52573977574913  -3.5257398       1       0        0         0
## -3.46516122914027  -3.4651612       1       0        0         0
## -3.40458268253142  -3.4045827       1       0        0         0
## -3.04755765999889  -3.0475577       0       1        0         0
## -2.92640056678118  -2.9264006       0       1        0         0
## -2.86582202017232  -2.8658220       0       1        0         0
## -2.80524347356346  -2.8052435       0       1        0         0
## -2.74466492695461  -2.7446649       0       1        0         0
## -2.72248307515592  -2.7224831       0       0        1         0
## -2.6013259819382   -2.6013260       0       0        1         0
## -2.56598156364506  -2.5659816       0       0        0         1
## -2.54074743532935  -2.5407474       0       0        1         0
## -2.5054030170362   -2.5054030       0       0        0         1
## -2.50409485241207  -2.5040949       1       1        0         0
## -2.48016888872049  -2.4801689       0       0        1         0
## -2.44482447042734  -2.4448245       0       0        0         1
## -2.44351630580322  -2.4435163       1       1        0         0
## -2.41959034211163  -2.4195903       0       0        1         0
## -2.38424592381849  -2.3842459       0       0        0         1
## -2.38293775919436  -2.3829378       1       1        0         0
## -2.32366737720963  -2.3236674       0       0        0         1
## -2.32235921258551  -2.3223592       1       1        0         0
## -2.26178066597665  -2.2617807       1       1        0         0
## -2.20120211936779  -2.2012021       1       1        0         0
## -2.1790202675691   -2.1790203       1       0        1         0
## -2.11844172096025  -2.1184417       1       0        1         0
## -2.0830973026671   -2.0830973       1       0        0         1
## -2.05786317435139  -2.0578632       1       0        1         0
## -2.02251875605824  -2.0225188       1       0        0         1
## -1.99728462774253  -1.9972846       1       0        1         0
## -1.96194020944939  -1.9619402       1       0        0         1
## -1.93670608113368  -1.9367061       1       0        1         0
## -1.90136166284053  -1.9013617       1       0        0         1
## -1.87612753452482  -1.8761275       1       0        1         0
## -1.84078311623167  -1.8407831       1       0        0         1
## -1.78020456962282  -1.7802046       1       0        0         1
## -1.45852396538344  -1.4585240       0       1        1         0
## -1.42317954709029  -1.4231795       0       1        0         1
## -1.39794541877458  -1.3979454       0       1        1         0
## -1.33736687216572  -1.3373669       0       1        1         0
## -1.30202245387258  -1.3020225       0       1        0         1
## -1.27678832555687  -1.2767883       0       1        1         0
## -1.24144390726372  -1.2414439       0       1        0         1
## -1.21620977894801  -1.2162098       0       1        1         0
## -1.18086536065486  -1.1808654       0       1        0         1
## -1.12028681404601  -1.1202868       0       1        0         1
## -1.09810496224732  -1.0981050       0       0        1         1
## -1.03752641563846  -1.0375264       0       0        1         1
## -0.976947869029604 -0.9769479       0       0        1         1
## -0.975639704405479 -0.9756397       1       1        1         0
## -0.916369322420748 -0.9163693       0       0        1         1
## -0.915061157796623 -0.9150612       1       1        1         0
## -0.879716739503475 -0.8797167       1       1        0         1
## -0.855790775811892 -0.8557908       0       0        1         1
## -0.854482611187766 -0.8544826       1       1        1         0
## -0.819138192894619 -0.8191382       1       1        0         1
## -0.795212229203035 -0.7952122       0       0        1         1
## -0.79390406457891  -0.7939041       1       1        1         0
## -0.758559646285763 -0.7585596       1       1        0         1
## -0.733325517970054 -0.7333255       1       1        1         0
## -0.697981099676907 -0.6979811       1       1        0         1
## -0.672746971361198 -0.6727470       1       1        1         0
## -0.63740255306805  -0.6374026       1       1        0         1
## -0.576824006459194 -0.5768240       1       1        0         1
## -0.554642154660502 -0.5546422       1       0        1         1
## -0.494063608051645 -0.4940636       1       0        1         1
## -0.433485061442789 -0.4334851       1       0        1         1
## -0.372906514833933 -0.3729065       1       0        1         1
## -0.312327968225077 -0.3123280       1       0        1         1
## -0.251749421616221 -0.2517494       1       0        1         1
## 0.105275600916307   0.1052756       0       1        1         1
## 0.165854147525163   0.1658541       0       1        1         1
## 0.226432694134019   0.2264327       0       1        1         1
## 0.287011240742875   0.2870112       0       1        1         1
## 0.347589787351731   0.3475898       0       1        1         1
## 0.408168333960587   0.4081683       0       1        1         1
## 0.648738408503121   0.6487384       1       1        1         1
## 0.709316955111977   0.7093170       1       1        1         1
## 0.769895501720833   0.7698955       1       1        1         1
## 0.830474048329689   0.8304740       1       1        1         1
## 0.891052594938546   0.8910526       1       1        1         1
## 0.951631141547402   0.9516311       1       1        1         1
##                    organizations   se.related   se.pension  se.vacation
## -4.25093822316251              6 0.000000e+00 0.000000e+00 0.000000e+00
## -4.19035967655366              5 0.000000e+00 0.000000e+00 0.000000e+00
## -4.1297811299448               4 0.000000e+00 0.000000e+00 0.000000e+00
## -4.06920258333594              3 0.000000e+00 0.000000e+00 0.000000e+00
## -4.00862403672709              2 0.000000e+00 0.000000e+00 0.000000e+00
## -3.94804549011823              1 0.000000e+00 0.000000e+00 0.000000e+00
## -3.7074754155757               6 0.000000e+00 0.000000e+00 0.000000e+00
## -3.64689686896684              5 0.000000e+00 0.000000e+00 0.000000e+00
## -3.58631832235798              4 0.000000e+00 0.000000e+00 0.000000e+00
## -3.52573977574913              3 0.000000e+00 0.000000e+00 0.000000e+00
## -3.46516122914027              2 0.000000e+00 0.000000e+00 0.000000e+00
## -3.40458268253142              1 0.000000e+00 0.000000e+00 0.000000e+00
## -3.04755765999889              6 0.000000e+00 0.000000e+00 0.000000e+00
## -2.92640056678118              4 0.000000e+00 0.000000e+00 0.000000e+00
## -2.86582202017232              3 0.000000e+00 6.159077e-17 0.000000e+00
## -2.80524347356346              2 0.000000e+00 3.631379e-17 0.000000e+00
## -2.74466492695461              1 0.000000e+00 0.000000e+00 0.000000e+00
## -2.72248307515592              6 0.000000e+00 0.000000e+00 0.000000e+00
## -2.6013259819382               4 0.000000e+00 0.000000e+00 0.000000e+00
## -2.56598156364506              5 0.000000e+00 0.000000e+00 0.000000e+00
## -2.54074743532935              3 0.000000e+00 0.000000e+00 0.000000e+00
## -2.5054030170362               4 0.000000e+00 0.000000e+00 0.000000e+00
## -2.50409485241207              6 0.000000e+00 0.000000e+00 0.000000e+00
## -2.48016888872049              2 0.000000e+00 0.000000e+00 0.000000e+00
## -2.44482447042734              3 0.000000e+00 0.000000e+00 0.000000e+00
## -2.44351630580322              5 0.000000e+00 0.000000e+00 0.000000e+00
## -2.41959034211163              1 0.000000e+00 0.000000e+00 0.000000e+00
## -2.38424592381849              2 0.000000e+00 0.000000e+00 0.000000e+00
## -2.38293775919436              4 0.000000e+00 0.000000e+00 0.000000e+00
## -2.32366737720963              1 0.000000e+00 0.000000e+00 0.000000e+00
## -2.32235921258551              3 0.000000e+00 0.000000e+00 0.000000e+00
## -2.26178066597665              2 2.076334e-17 2.076334e-17 0.000000e+00
## -2.20120211936779              1 0.000000e+00 0.000000e+00 0.000000e+00
## -2.1790202675691               6 0.000000e+00 0.000000e+00 0.000000e+00
## -2.11844172096025              5 0.000000e+00 0.000000e+00 0.000000e+00
## -2.0830973026671               6 0.000000e+00 0.000000e+00 0.000000e+00
## -2.05786317435139              4 0.000000e+00 0.000000e+00 0.000000e+00
## -2.02251875605824              5 0.000000e+00 0.000000e+00 0.000000e+00
## -1.99728462774253              3 0.000000e+00 0.000000e+00 0.000000e+00
## -1.96194020944939              4 0.000000e+00 0.000000e+00 0.000000e+00
## -1.93670608113368              2 0.000000e+00 0.000000e+00 0.000000e+00
## -1.90136166284053              3 0.000000e+00 0.000000e+00 0.000000e+00
## -1.87612753452482              1 0.000000e+00 0.000000e+00 0.000000e+00
## -1.84078311623167              2 1.407415e-17 0.000000e+00 0.000000e+00
## -1.78020456962282              1 0.000000e+00 0.000000e+00 0.000000e+00
## -1.45852396538344              5 0.000000e+00 0.000000e+00 0.000000e+00
## -1.42317954709029              6 0.000000e+00 0.000000e+00 0.000000e+00
## -1.39794541877458              4 0.000000e+00 0.000000e+00 0.000000e+00
## -1.33736687216572              3 0.000000e+00 0.000000e+00 0.000000e+00
## -1.30202245387258              4 0.000000e+00 0.000000e+00 0.000000e+00
## -1.27678832555687              2 0.000000e+00 0.000000e+00 0.000000e+00
## -1.24144390726372              3 0.000000e+00 0.000000e+00 0.000000e+00
## -1.21620977894801              1 0.000000e+00 0.000000e+00 0.000000e+00
## -1.18086536065486              2 0.000000e+00 0.000000e+00 0.000000e+00
## -1.12028681404601              1 0.000000e+00 0.000000e+00 0.000000e+00
## -1.09810496224732              6 0.000000e+00 0.000000e+00 0.000000e+00
## -1.03752641563846              5 0.000000e+00 0.000000e+00 5.821941e-17
## -0.976947869029604             4 0.000000e+00 0.000000e+00 0.000000e+00
## -0.975639704405479             6 0.000000e+00 0.000000e+00 0.000000e+00
## -0.916369322420748             3 0.000000e+00 0.000000e+00 0.000000e+00
## -0.915061157796623             5 0.000000e+00 0.000000e+00 0.000000e+00
## -0.879716739503475             6 3.324619e-17 3.324619e-17 0.000000e+00
## -0.855790775811892             2 0.000000e+00 0.000000e+00 0.000000e+00
## -0.854482611187766             4 4.952958e-17 4.952958e-17 4.952958e-17
## -0.819138192894619             5 0.000000e+00 0.000000e+00 0.000000e+00
## -0.795212229203035             1 0.000000e+00 0.000000e+00 1.800281e-17
## -0.79390406457891              3 0.000000e+00 0.000000e+00 0.000000e+00
## -0.758559646285763             4 2.258359e-17 2.258359e-17 0.000000e+00
## -0.733325517970054             2 0.000000e+00 0.000000e+00 0.000000e+00
## -0.697981099676907             3 0.000000e+00 0.000000e+00 0.000000e+00
## -0.672746971361198             1 0.000000e+00 0.000000e+00 0.000000e+00
## -0.63740255306805              2 0.000000e+00 0.000000e+00 0.000000e+00
## -0.576824006459194             1 0.000000e+00 0.000000e+00 0.000000e+00
## -0.554642154660502             6 0.000000e+00 0.000000e+00 0.000000e+00
## -0.494063608051645             5 0.000000e+00 0.000000e+00 0.000000e+00
## -0.433485061442789             4 0.000000e+00 0.000000e+00 0.000000e+00
## -0.372906514833933             3 0.000000e+00 0.000000e+00 0.000000e+00
## -0.312327968225077             2 6.861203e-18 0.000000e+00 6.861203e-18
## -0.251749421616221             1 0.000000e+00 0.000000e+00 0.000000e+00
## 0.105275600916307              6 0.000000e+00 0.000000e+00 0.000000e+00
## 0.165854147525163              5 0.000000e+00 0.000000e+00 0.000000e+00
## 0.226432694134019              4 0.000000e+00 0.000000e+00 0.000000e+00
## 0.287011240742875              3 0.000000e+00 0.000000e+00 0.000000e+00
## 0.347589787351731              2 0.000000e+00 0.000000e+00 0.000000e+00
## 0.408168333960587              1 0.000000e+00 0.000000e+00 0.000000e+00
## 0.648738408503121              6 0.000000e+00 0.000000e+00 0.000000e+00
## 0.709316955111977              5 0.000000e+00 0.000000e+00 0.000000e+00
## 0.769895501720833              4 6.270735e-18 6.270735e-18 6.270735e-18
## 0.830474048329689              3 0.000000e+00 0.000000e+00 0.000000e+00
## 0.891052594938546              2 0.000000e+00 0.000000e+00 0.000000e+00
## 0.951631141547402              1 0.000000e+00 0.000000e+00 0.000000e+00
##                    se.insurance se.organizations
## -4.25093822316251  0.000000e+00     0.000000e+00
## -4.19035967655366  0.000000e+00     0.000000e+00
## -4.1297811299448   0.000000e+00     1.083679e-16
## -4.06920258333594  0.000000e+00     1.044029e-16
## -4.00862403672709  0.000000e+00     0.000000e+00
## -3.94804549011823  0.000000e+00     1.116973e-17
## -3.7074754155757   0.000000e+00     0.000000e+00
## -3.64689686896684  0.000000e+00     0.000000e+00
## -3.58631832235798  0.000000e+00     0.000000e+00
## -3.52573977574913  0.000000e+00     0.000000e+00
## -3.46516122914027  0.000000e+00     0.000000e+00
## -3.40458268253142  0.000000e+00     0.000000e+00
## -3.04755765999889  0.000000e+00     0.000000e+00
## -2.92640056678118  0.000000e+00     0.000000e+00
## -2.86582202017232  0.000000e+00     0.000000e+00
## -2.80524347356346  0.000000e+00     7.262759e-17
## -2.74466492695461  0.000000e+00     0.000000e+00
## -2.72248307515592  0.000000e+00     0.000000e+00
## -2.6013259819382   0.000000e+00     0.000000e+00
## -2.56598156364506  0.000000e+00     0.000000e+00
## -2.54074743532935  0.000000e+00     0.000000e+00
## -2.5054030170362   0.000000e+00     0.000000e+00
## -2.50409485241207  0.000000e+00     6.435783e-16
## -2.48016888872049  0.000000e+00     0.000000e+00
## -2.44482447042734  0.000000e+00     1.843480e-16
## -2.44351630580322  0.000000e+00     0.000000e+00
## -2.41959034211163  0.000000e+00     0.000000e+00
## -2.38424592381849  0.000000e+00     0.000000e+00
## -2.38293775919436  0.000000e+00     0.000000e+00
## -2.32366737720963  0.000000e+00     0.000000e+00
## -2.32235921258551  0.000000e+00     0.000000e+00
## -2.26178066597665  0.000000e+00     4.152669e-17
## -2.20120211936779  0.000000e+00     0.000000e+00
## -2.1790202675691   0.000000e+00     0.000000e+00
## -2.11844172096025  0.000000e+00     0.000000e+00
## -2.0830973026671   0.000000e+00     3.488200e-16
## -2.05786317435139  0.000000e+00     0.000000e+00
## -2.02251875605824  0.000000e+00     0.000000e+00
## -1.99728462774253  0.000000e+00     0.000000e+00
## -1.96194020944939  0.000000e+00     0.000000e+00
## -1.93670608113368  0.000000e+00     0.000000e+00
## -1.90136166284053  0.000000e+00     0.000000e+00
## -1.87612753452482  0.000000e+00     0.000000e+00
## -1.84078311623167  1.407415e-17     2.814829e-17
## -1.78020456962282  0.000000e+00     0.000000e+00
## -1.45852396538344  0.000000e+00     0.000000e+00
## -1.42317954709029  0.000000e+00     0.000000e+00
## -1.39794541877458  0.000000e+00     0.000000e+00
## -1.33736687216572  0.000000e+00     0.000000e+00
## -1.30202245387258  0.000000e+00     0.000000e+00
## -1.27678832555687  0.000000e+00     0.000000e+00
## -1.24144390726372  0.000000e+00     0.000000e+00
## -1.21620977894801  0.000000e+00     0.000000e+00
## -1.18086536065486  0.000000e+00     0.000000e+00
## -1.12028681404601  0.000000e+00     0.000000e+00
## -1.09810496224732  0.000000e+00     0.000000e+00
## -1.03752641563846  5.821941e-17     0.000000e+00
## -0.976947869029604 0.000000e+00     0.000000e+00
## -0.975639704405479 0.000000e+00     0.000000e+00
## -0.916369322420748 0.000000e+00     0.000000e+00
## -0.915061157796623 0.000000e+00     0.000000e+00
## -0.879716739503475 3.324619e-17     0.000000e+00
## -0.855790775811892 0.000000e+00     0.000000e+00
## -0.854482611187766 0.000000e+00     1.981183e-16
## -0.819138192894619 0.000000e+00     0.000000e+00
## -0.795212229203035 1.800281e-17     1.800281e-17
## -0.79390406457891  0.000000e+00     0.000000e+00
## -0.758559646285763 2.258359e-17     9.033437e-17
## -0.733325517970054 0.000000e+00     0.000000e+00
## -0.697981099676907 0.000000e+00     0.000000e+00
## -0.672746971361198 0.000000e+00     0.000000e+00
## -0.63740255306805  0.000000e+00     0.000000e+00
## -0.576824006459194 0.000000e+00     0.000000e+00
## -0.554642154660502 0.000000e+00     0.000000e+00
## -0.494063608051645 0.000000e+00     0.000000e+00
## -0.433485061442789 0.000000e+00     0.000000e+00
## -0.372906514833933 0.000000e+00     0.000000e+00
## -0.312327968225077 6.861203e-18     1.372241e-17
## -0.251749421616221 0.000000e+00     0.000000e+00
## 0.105275600916307  0.000000e+00     3.092426e-16
## 0.165854147525163  0.000000e+00     0.000000e+00
## 0.226432694134019  0.000000e+00     0.000000e+00
## 0.287011240742875  0.000000e+00     0.000000e+00
## 0.347589787351731  0.000000e+00     0.000000e+00
## 0.408168333960587  0.000000e+00     0.000000e+00
## 0.648738408503121  0.000000e+00     0.000000e+00
## 0.709316955111977  0.000000e+00     0.000000e+00
## 0.769895501720833  6.270735e-18     2.508294e-17
## 0.830474048329689  0.000000e+00     0.000000e+00
## 0.891052594938546  0.000000e+00     0.000000e+00
## 0.951631141547402  0.000000e+00     0.000000e+00

The first analysis will look at variation in my job satisfaction index across gender, education, race/ethnicity level and number of children.

A comparison by gender shows that males are more likely to experience job statisfaction than women as observed in the gender plot.

The education plot shows interestingly that those with a professional degree rank lower in the job satisfaction index while those with a masters degree rank highest.

Our race/ethnicity plot shows that the white participants of our sample rank higher than the asian and other minorities in the index of job satisfaction.

The number of children does not show any visible differences between those that have one child versus those that have two or more.

library(ggplot2)
ggplot(aes(x=gender, y=PC1), data=cpsipums4)+geom_boxplot()

ggplot(aes(x=dgrdg, y=PC1), data=cpsipums4)+geom_boxplot()

ggplot(aes(x=raceth, y=PC1), data=cpsipums4)+geom_boxplot()

ggplot(aes(x=chtot, y=PC1), data=cpsipums4)+geom_boxplot()

fit.9<-svyglm(PC1~gender+dgrdg+raceth+chtot, des, family=gaussian)
summary(fit.9)
## 
## Call:
## svyglm(formula = PC1 ~ gender + dgrdg + raceth + chtot, des, 
##     family = gaussian)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~sample, weights = ~weight, data = cpsipums4)
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)               -0.14040    0.05922  -2.371   0.0178 *  
## gendermale                 0.25822    0.05119   5.044 4.60e-07 ***
## dgrdg1masters              0.08405    0.05427   1.549   0.1214    
## dgrdg2doctorate            0.13741    0.08973   1.531   0.1257    
## dgrdg3professional        -0.50685    0.07370  -6.877 6.34e-12 ***
## racethasian               -0.04470    0.08292  -0.539   0.5898    
## racethminorities           0.12017    0.06254   1.921   0.0547 .  
## chtottwo or more children  0.05318    0.05029   1.057   0.2903    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for gaussian family taken to be 2.450064)
## 
## Number of Fisher Scoring iterations: 2