Health Insurance Data

setInternet2(TRUE) # solution for https files
download.file("https://sites.google.com/site/econometriks/docs/insurance.rda", "HI.Rdata")
load("HI.RData")
 ##save file
save(HI, file= "HI.rda")

## list variables
names(HI)
##  [1] "whrswk"     "hhi"        "whi"        "hhi2"       "education" 
##  [6] "race"       "hispanic"   "experience" "kidslt6"    "kids618"   
## [11] "husby"      "region"     "wght"       "mean_wt"    "lfp"       
## [16] "lfp_yn"     "exp2"       "exp3"       "black"      "edu"       
## [21] "edu2"       "race2"
attach(HI)
library(xtable)
library(htmlTable)

Summary Statistics

Table 9.26

t1<- xtabs(~ hhi + lfp); insx= round(prop.table(t1,1)*100,2)
t1<- xtabs(~ edu2 + lfp); edux= round(prop.table(t1,1)*100,2)
t1<- xtabs(~ race2 + lfp); racex= round(prop.table(t1,1)*100,2)
exper.years<- round(tapply(experience, lfp,mean),2)
kids.under.6<- round(tapply(kidslt6, lfp,mean),2)
kids.6.to.18<- round(tapply(kids618, lfp,mean),2)
husb.inc<- round(tapply(husby, lfp,mean),2)
t1<- xtabs(~ region + lfp); regionx= round(prop.table(t1,1)*100,2)

tab<- rbind(insx, edux, racex, exper.years, kids.under.6, kids.6.to.18, husb.inc, regionx)
tab1<-xtable(tab)
print(tab1, type="html")
unemployed part-time full-time
no 26.17 13.82 60.01
yes 33.62 22.25 44.13
LT 9 years 64.80 9.00 26.20
9-11years 52.00 14.06 33.94
12years 31.88 18.57 49.56
13-15years 23.94 20.55 55.51
16years 19.50 18.38 62.13
GT 16 years 12.15 15.28 72.57
Whites 30.13 18.50 51.36
African-Americans 24.09 10.64 65.27
Other race 39.18 9.94 50.88
exper.years 26.92 22.07 20.97
kids.under.6 0.47 0.37 0.27
kids.6.to.18 0.67 0.85 0.65
husb.inc 25.66 29.76 27.00
other 28.86 20.75 50.39
northcentral 26.86 21.18 51.96
south 31.75 13.03 55.22
west 31.72 18.42 49.87
htmlTable(txtRound(tab1,0, excl.rows = c(13,14)),
          rgroup=c("Husband's insurance covers wife (%)",
                   "Education status (%)",
                   "Race (%)",
                   "Experience in years",
                   "Children less than 6 years old",
                   "Children between 6 and 18 years old",
                   "Husband's income",
                   "Region of origin (%)"),
          n.rgroup = c(2,6,3,1,1,1,1,4),
          cgroup = c("Wives' Work Status"),
          n.cgroup = c(3),
          rowlabel="Demographic Attributes")
Wives’ Work Status
Demographic Attributes unemployed part-time full-time
Husband’s insurance covers wife (%)
  no 26 14 60
  yes 34 22 44
Education status (%)
  LT 9 years 65 9 26
  9-11years 52 14 34
  12years 32 19 50
  13-15years 24 21 56
  16years 20 18 62
  GT 16 years 12 15 73
Race (%)
  Whites 30 18 51
  African-Americans 24 11 65
  Other race 39 10 51
Experience in years
  exper.years 27 22 21
Children less than 6 years old
  kids.under.6 0.47 0.37 0.27
Children between 6 and 18 years old
  kids.6.to.18 0.67 0.85 0.65
Husband’s income
  husb.inc 26 30 27
Region of origin (%)
  other 29 21 50
  northcentral 27 21 52
  south 32 13 55
  west 32 18 50

Binary Model

library(stargazer)
## 
## Please cite as: 
## 
##  Hlavac, Marek (2014). stargazer: LaTeX code and ASCII text for well-formatted regression and summary statistics tables.
##  R package version 5.1. http://CRAN.R-project.org/package=stargazer
table(HI$lfp_yn)

unemployed employed 6652 15620

rm(mod.1)
## Warning in rm(mod.1): object 'mod.1' not found
mod.1<-glm(formula = lfp_yn ~ hhi + factor(edu2) +race2 +
    factor(hispanic)+ experience + exp2 +exp3 +kidslt6 +
    kids618 + husby +factor(region), weight=mean_wt,
    family = binomial(link = "probit"), 
    data=HI)
## Warning: non-integer #successes in a binomial glm!
stargazer(mod.1, type="html", no.space=TRUE,
          covariate.labels = c("Wife covered by husband's insurance", "9-11 years education", 
          "12 years education", "13-15 years education", "16 years education",
          "GT 16 years education", "African-American", "Other race", "Hispanic",
          "Years of potential work experience", "Potential LF exp2/100",
          "Potential LF exp3/100"  ,"No. of children < 6 years old",
          "No. of children 6±18 years old", "Husband's income in thousands",
          "North Central Region", "South Region", "West Region"))
Dependent variable:
lfp_yn
Wife covered by husband’s insurance -0.283***
(0.021)
9-11 years education 0.093*
(0.056)
12 years education 0.529***
(0.050)
13-15 years education 0.682***
(0.052)
16 years education 0.774***
(0.056)
GT 16 years education 1.026***
(0.066)
African-American 0.220***
(0.040)
Other race -0.152
(0.133)
Hispanic -0.227***
(0.045)
Years of potential work experience 0.044***
(0.010)
Potential LF exp2/100 -0.200***
(0.046)
Potential LF exp3/100 0.001
(0.001)
No. of children < 6 years old -0.566***
(0.017)
No. of children 6±18 years old -0.165***
(0.011)
Husband’s income in thousands -0.003***
(0.0005)
North Central Region 0.055*
(0.029)
South Region -0.120***
(0.027)
West Region -0.114***
(0.030)
Constant 0.749***
(0.088)
Observations 22,272
Log Likelihood -11,794.590
Akaike Inf. Crit. 23,627.190
Note: p<0.1; p<0.05; p<0.01
library(nnet)
rm(mod.2)
## Warning in rm(mod.2): object 'mod.2' not found
mod.2<- multinom(lfp ~ hhi + factor(edu2) + race2 +
                   factor(hispanic)+ experience + exp2 +exp3 +kidslt6 +
                   kids618 + husby +factor(region), weight=mean_wt, data=HI)
## # weights:  60 (38 variable)
## initial  value 24468.292893 
## iter  10 value 20539.051691
## iter  20 value 20257.930245
## iter  30 value 19851.086965
## iter  40 value 19745.014947
## final  value 19734.064405 
## converged

Table 9.27

stargazer(mod.2, type="html", no.space=TRUE,
          covariate.labels = c("Wife covered by husband's insurance", "9-11 years education", 
          "12 years education", "13-15 years education", "16 years education",
          "GT 16 years education", "African-American", "Other race", "Hispanic",
          "Years of potential work experience", "Potential LF exp2/100",
          "Potential LF exp3/100"  ,"No. of children < 6 years old",
          "No. of children 6±18 years old", "Husband's income in thousands",
          "North Central Region", "South Region", "West Region"))
Dependent variable:
part-time full-time
(1) (2)
Wife covered by husband’s insurance 0.064 -0.701***
(0.047) (0.038)
9-11 years education 0.219 0.166
(0.140) (0.105)
12 years education 0.839*** 0.928***
(0.124) (0.093)
13-15 years education 1.119*** 1.164***
(0.129) (0.097)
16 years education 1.121*** 1.388***
(0.136) (0.103)
GT 16 years education 1.370*** 1.897***
(0.160) (0.125)
African-American -0.172* 0.542***
(0.101) (0.072)
Other race -0.534*** -0.179
(0.081) (0.190)
Hispanic -0.456*** -0.336***
(0.108) (0.082)
Years of potential work experience 0.007 0.106***
(0.023) (0.019)
Potential LF exp2/100 -0.058 -0.472***
(0.103) (0.086)
Potential LF exp3/100 -0.001 0.002**
(0.001) (0.001)
No. of children < 6 years old -0.594*** -1.114***
(0.038) (0.033)
No. of children 6±18 years old -0.049** -0.390***
(0.024) (0.021)
Husband’s income in thousands -0.004*** -0.005***
(0.001) (0.001)
North Central Region 0.032 0.115**
(0.061) (0.053)
South Region -0.510*** -0.081*
(0.059) (0.049)
West Region -0.235*** -0.164***
(0.064) (0.055)
Constant -0.252 0.952***
(0.203) (0.163)
Akaike Inf. Crit. 39,544.130 39,544.130
Note: p<0.1; p<0.05; p<0.01

Table 9.28 and Table 9.29

exponentiate <- function(x) exp(x)
stargazer(mod.2, type="html", no.space=TRUE, apply.coef= exponentiate, se= list(NA),
         covariate.labels = c("Wife covered by husband's insurance", "9-11 years education", 
          "12 years education", "13-15 years education", "16 years education",
          "GT 16 years education", "African-American", "Other race", "Hispanic",
          "Years of potential work experience", "Potential LF exp2/100",
          "Potential LF exp3/100"  ,"No. of children < 6 years old",
          "No. of children 6±18 years old", "Husband's income in thousands",
          "North Central Region", "South Region", "West Region"))
Dependent variable:
part-time full-time
(1) (2)
Wife covered by husband’s insurance 1.067 0.496
9-11 years education 1.244 1.180
12 years education 2.314 2.531
13-15 years education 3.063 3.202
16 years education 3.067 4.006
GT 16 years education 3.934 6.669
African-American 0.842 1.719
Other race 0.586 0.836
Hispanic 0.634 0.715
Years of potential work experience 1.007 1.112
Potential LF exp2/100 0.943 0.624
Potential LF exp3/100 0.999 1.002
No. of children < 6 years old 0.552 0.328
No. of children 6±18 years old 0.953 0.677
Husband’s income in thousands 0.996 0.995
North Central Region 1.033 1.122
South Region 0.601 0.923
West Region 0.791 0.848
Constant 0.778 2.591
Akaike Inf. Crit. 39,544.130 39,544.130
Note: p<0.1; p<0.05; p<0.01
percentx <- function(x) (exp(x)-1)*100
stargazer(mod.2, type="html", no.space=TRUE, apply.coef= percentx, se= list(NA),
         covariate.labels = c("Wife covered by husband's insurance", "9-11 years education", 
          "12 years education", "13-15 years education", "16 years education",
          "GT 16 years education", "African-American", "Other race", "Hispanic",
          "Years of potential work experience", "Potential LF exp2/100",
          "Potential LF exp3/100"  ,"No. of children < 6 years old",
          "No. of children 6±18 years old", "Husband's income in thousands",
          "North Central Region", "South Region", "West Region"))
Dependent variable:
part-time full-time
(1) (2)
Wife covered by husband’s insurance 6.660 -50.385
9-11 years education 24.430 18.001
12 years education 131.402 153.065
13-15 years education 206.293 220.190
16 years education 206.689 300.579
GT 16 years education 293.446 566.864
African-American -15.761 71.947
Other race -41.391 -16.390
Hispanic -36.646 -28.508
Years of potential work experience 0.737 11.228
Potential LF exp2/100 -5.679 -37.613
Potential LF exp3/100 -0.110 0.245
No. of children < 6 years old -44.762 -67.172
No. of children 6±18 years old -4.739 -32.300
Husband’s income in thousands -0.442 -0.505
North Central Region 3.293 12.193
South Region -39.939 -7.735
West Region -20.937 -15.161
Constant -22.245 159.071
Akaike Inf. Crit. 39,544.130 39,544.130
Note: p<0.1; p<0.05; p<0.01