Mroz data

Load the data set

data(Mroz, package="car")
attach(Mroz)
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
library(xtable)
library(htmlTable)

stargazer(Mroz, type="html")
Statistic N Mean St. Dev. Min Max
k5 753 0.238 0.524 0 3
k618 753 1.353 1.320 0 8
age 753 42.538 8.073 30 60
lwg 753 1.097 0.588 -2.054 3.219
inc 753 20.129 11.635 -0.029 96.000

Cross-Tabulations

t1=table(lfp);t2=t1/sum(t1)*100
t3=rbind("in labour force (N)"=t1,"in labour force (%)"=round(t2,1))
tab<-xtable(t3, digits=1); print(tab, type="html")
no yes
in labour force (N) 325.0 428.0
in labour force (%) 43.2 56.8
htmlTable(txtRound(tab,0), rowlabel = "labour force participation")
labour force participation no yes
in labour force (N) 325 428
in labour force (%) 43 57
chitest=xtabs(~ lfp+wc); print(xtable(chitest, digits=0), type="html")
no yes
no 257 68
yes 284 144
chisq.test(chitest)
Pearson's Chi-squared test with Yates' continuity correction

data: chitest X-squared = 14.158, df = 1, p-value = 0.0001681

t4<-prop.table(chitest,2)*100 
t5<- cbind(chitest, t4)

rownames(t5)<- c( "did not participate in labor force", "participated in labor force")
colnames(t5)<-c("wife didn't attend college (N)", "wife attended college (N)", "wife didn't attend college (%)", "wife attended college (%)")

htmlTable(txtRound(t5,0), rowlabel = "labour force participation")
labour force participation wife didn’t attend college (N) wife attended college (N) wife didn’t attend college (%) wife attended college (%)
did not participate in labor force 257 68 48 32
participated in labor force 284 144 52 68

chitest=xtabs(~ lfp+hc); print(xtable(chitest, digits=0), type="html")
no yes
no 207 118
yes 251 177
chisq.test(chitest)
Pearson's Chi-squared test with Yates' continuity correction

data: chitest X-squared = 1.7689, df = 1, p-value = 0.1835

rownames(chitest)<- c( "did not participate in labor force", "participated in labor force")
colnames(chitest)<-c("husband didn't attend college (N)", "husband attended college (N)")

htmlTable(txtRound(chitest,0), rowlabel = "wife's labour force participation")
wife’s labour force participation husband didn’t attend college (N) husband attended college (N)
did not participate in labor force 207 118
participated in labor force 251 177

Descriptive Stats before the labour force model

t1<- xtabs(~ k5 + lfp); t.k5 = prop.table(t1,1)*100
t1<- xtabs(~ k618 + lfp); t.k618 = prop.table(t1,1)*100
t.age<- tapply(age, lfp,mean)
t1<- xtabs(~ wc + lfp);  t.wc = prop.table(t1,1)*100
t1<- xtabs(~ hc + lfp);  t.hc = prop.table(t1,1)*100
t.wifelogwage<- tapply(lwg, lfp,mean)
t.faminc<- tapply(inc, lfp,mean)
t5<-rbind(t.k5, t.k618, t.age, t.wc, t.hc, t.wifelogwage, t.faminc)
t5<-round(t5,2)

colnames(t5)<- c("not working", "working")
rownames(t5)<-paste(c("no child", "1 child", paste0(2:3, " children"), "no child", "1 child", paste0(2:8, " children"),
                    "wife's age", "college educated",
                    "did not attend college", 
                    "college educated",
                    "did not attend college",
                    "log of wife's wages",
                    "family income excluding wife's"))

htmlTable( txtRound(t5,0, excl.rows = c(14,19,20)),
          rgroup=c("children under 6 (%)",
                   "children 6-18 years (%)",
          "wife's age in years", "wife's education (%)",
          "husband's education (%)", "wife's income",
          "family income ('000s)"),
          n.rgroup = c(4,9,1,2,2,1,1),
          cgroup = c("Wife's labor force participation"),
          n.cgroup = c(2),
          rowlabel="Demographic attributes")
Wife’s labor force participation
Demographic attributes not working working
children under 6 (%)
  no child 38 62
  1 child 61 39
  2 children 73 27
  3 children 100 0
children 6-18 years (%)
  no child 42 58
  1 child 46 54
  2 children 40 60
  3 children 44 56
  4 children 43 57
  5 children 42 58
  6 children 100 0
  7 children 100 0
  8 children 0 100
wife’s age in years
  wife’s age 43.28 41.97
wife’s education (%)
  college educated 48 52
  did not attend college 32 68
husband’s education (%)
  college educated 45 55
  did not attend college 40 60
wife’s income
  log of wife’s wages 0.97 1.19
family income (’000s)
  family income excluding wife’s 21.7 18.94

Older version

names(Mroz)

[1] “lfp” “k5” “k618” “age” “wc” “hc” “lwg” “inc”

attach(Mroz)
## The following objects are masked from Mroz (pos = 6):
## 
##     age, hc, inc, k5, k618, lfp, lwg, wc
t1<- xtabs(~ k5 + lfp); t1; t.k5 = prop.table(t1,1)*100

lfp k5 no yes 0 231 375 1 72 46 2 19 7 3 3 0

t1<- xtabs(~ k618 + lfp); t1; t.k618 = prop.table(t1,1)*100
lfp

k618 no yes 0 109 149 1 86 99 2 65 97 3 45 58 4 13 17 5 5 7 6 1 0 7 1 0 8 0 1

t.age<- tapply(age, lfp,mean)
t1<- xtabs(~ wc + lfp); t1; t.wc = prop.table(t1,1)*100
 lfp

wc no yes no 257 284 yes 68 144

t1<- xtabs(~ hc + lfp); t1; t.hc = prop.table(t1,1)*100
 lfp

hc no yes no 207 251 yes 118 177

t.wifelogwage<- tapply(lwg, lfp,mean)
t.faminc<- tapply(inc, lfp,mean)
t5<-rbind(t.k5, t.k618, t.age, t.wc, t.hc, t.wifelogwage, t.faminc)

colnames(t5)<- c("not working", "working")
rownames(t5)[1]<- c( "kids under 6 [0 child]")
rownames(t5)[2]<- c( "kids under 6 [1]") ; rownames(t5)[3]<- c( "kids under 6 [2]")
rownames(t5)[4]<- c( "kids under 6 [3]"); rownames(t5)[5]<- c( "kids 6 to 18 years [0 child]")
rownames(t5)[6]<- c( "kids 6 to 18 years [1]"); rownames(t5)[7]<- c( "kids 6 to 18 years [2]")
rownames(t5)[8]<- c( "kids 6 to 18 years [3]"); rownames(t5)[9]<- c( "kids 6 to 18 years [4]")
rownames(t5)[10]<- c( "kids 6 to 18 years [5]"); rownames(t5)[11]<- c( "kids 6 to 18 years [6]")
rownames(t5)[12]<- c( "kids 6 to 18 years [7]"); rownames(t5)[13]<- c( "kids 6 to 18 years [8]")
rownames(t5)[14]<- c( "wife's age"); rownames(t5)[15]<- c( "wife's college edu (no)")
rownames(t5)[16]<- c( "wife's college edu (yes)"); rownames(t5)[17]<- c( "husband's college edu (no)")
rownames(t5)[18]<- c( "husband's college edu (yes)")
rownames(t5)[19]<- c( "log of wife's wages)"); rownames(t5)[20]<- c( "family income excluding wife's")
#t5
print(xtable(t5, digits=1), type="html")
not working working
kids under 6 [0 child] 38.1 61.9
kids under 6 [1] 61.0 39.0
kids under 6 [2] 73.1 26.9
kids under 6 [3] 100.0 0.0
kids 6 to 18 years [0 child] 42.2 57.8
kids 6 to 18 years [1] 46.5 53.5
kids 6 to 18 years [2] 40.1 59.9
kids 6 to 18 years [3] 43.7 56.3
kids 6 to 18 years [4] 43.3 56.7
kids 6 to 18 years [5] 41.7 58.3
kids 6 to 18 years [6] 100.0 0.0
kids 6 to 18 years [7] 100.0 0.0
kids 6 to 18 years [8] 0.0 100.0
wife’s age 43.3 42.0
wife’s college edu (no) 47.5 52.5
wife’s college edu (yes) 32.1 67.9
husband’s college edu (no) 45.2 54.8
husband’s college edu (yes) 40.0 60.0
log of wife’s wages) 1.0 1.2
family income excluding wife’s 21.7 18.9

Labour force participation model

library(MASS)
library(nnet)


lab.for <- glm(lfp ~ k5 + k618 + age+ wc + hc + lwg +inc, data=Mroz, 
               family = binomial(link = "logit"))
stargazer(lab.for, type="html", align=TRUE, keep.stat = c("n","ll", "aic"), 
          dep.var.labels=c("labour force participation"), no.space=TRUE, 
          covariate.labels = c("kids under 6", "kids 6 to 18", "wife's age", "wife attended college", "husband attended college", "log of wife's estimated wages", "family income excluding wife's"))
Dependent variable:
labour force participation
kids under 6 -1.463***
(0.197)
kids 6 to 18 -0.065
(0.068)
wife’s age -0.063***
(0.013)
wife attended college 0.807***
(0.230)
husband attended college 0.112
(0.206)
log of wife’s estimated wages 0.605***
(0.151)
family income excluding wife’s -0.034***
(0.008)
Constant 3.182***
(0.644)
Observations 753
Log Likelihood -452.633
Akaike Inf. Crit. 921.266
Note: p<0.1; p<0.05; p<0.01
#  EXPONENTIAL COEFFICIENTS
stargazer(cbind(exp(coef(lab.for))), type="html")
(Intercept) 24.098
k5 0.232
k618 0.937
age 0.939
wcyes 2.242
hcyes 1.118
lwg 1.831
inc 0.966

McFadden’s R Square

ll0 <- glm(lfp ~ 1 , data=Mroz, family = binomial(link = "logit"))
x2<-as.numeric(logLik(ll0)); x1<-as.numeric(logLik(lab.for))
McFaddenR<-1-(x1/x2)
McFaddenR
## [1] 0.1208846

Pew Dating Data

Downloading data from the website. The download command downloads data in the working directory.

Data are downloaded, loaded, and names of fields are read from the file:

setInternet2(TRUE) # solution for https files
download.file("https://sites.google.com/site/econometriks/docs/dating.RData", "dating.RData")
load("dating.RData")

Loading required packages and attaching the data set.

library(xtable)
library(psych)
# names(dating)
attach(dating)
## The following objects are masked from Mroz (pos = 6):
## 
##     age, inc
## 
## The following objects are masked from Mroz (pos = 10):
## 
##     age, inc

load packages for model estimation

library(nnet)
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(stargazer)
library(car)
## 
## Attaching package: 'car'
## 
## The following object is masked from 'package:psych':
## 
##     logit

attach(dating)
## The following objects are masked from dating (pos = 6):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from Mroz (pos = 10):
## 
##     age, inc
## 
## The following objects are masked from Mroz (pos = 14):
## 
##     age, inc
tab<-table(dating$cregion)/sum(table(dating$cregion))*100
print(xtable(cbind("region"=tab), digits=0), type="html")
region
Northeast 17
Midwest 23
South 39
West 22
tab<-table(dating$sex)/sum(table(dating$sex))*100
print(xtable(cbind("gender (%)"=tab), digits=0), type="html")
gender (%)
Male 46
Female 54
tab<-table(dating$educ2)/sum(table(dating$educ2))*100
print(xtable(cbind("education  (%)"=tab), digits=0), type="html")
education (%)
Less than high school (Grades 1-8 or no formal schooling) 2
High school incomplete (Grades 9-11 or Grade 12 with NO diploma) 5
High school graduate (Grade 12 with diploma or GED certificate) 28
Some college, no degree (includes some community college) 17
Two year associate degree from a college or university 10
Four year college or university degree/Bachelor’s degree 21
Some postgraduate or professional schooling, no postgraduate degree 1
Postgraduate or professional degree, including master’s, doctorate, medical or law degree 15
tab<-table(dating$lifequal)/sum(table(dating$lifequal))*100
print(xtable(cbind("quality of life  (%)"=tab), digits=0), type="html")
quality of life (%)
Excellent 18
Very good 28
Good 34
Fair 15
Poor 5
x1=xtabs(~ mar +romantic)
x2 = prop.table(x1,1)*100
tab=xtable(cbind( "xtab between married and romantic " =x2))
htmlTable(txtRound(tab,0), rowlabel = "Marital Status",
          header=c("Yes (%)", "No (%)"),
          cgroup = c("In A Romantic Relationship"),
          n.cgroup= c(2))
In A Romantic Relationship
Marital Status Yes (%) No (%)
Married
Living with a partner
Divorced 24 76
Separated 15 85
Widowed 7 93
Never been married 29 71
x1=xtabs(~ meet + sex)
x2 = prop.table(x1,2)*100
tab=xtable(cbind( "xtab between gender and meeting others"=x2))
htmlTable(txtRound(tab,0), rowlabel = "Meeting Others", 
          header=c("Male (%)","Female (%)"),
          cgroup = c("Gender"), n.cgroup= c(2))
Gender
Meeting Others Male (%) Female (%)
Easy to meet people 59 37
Difficult to meet people 41 63
tab<-table(dating$datingbrand)/sum(table(dating$datingbrand))*100
print(xtable(cbind("Online dating service (%)"=tab), digits=0), type="html")
Online dating service (%)
Match.com 41
eHarmony 18
OK Cupid 11
Plenty of Fish 9
Christian Mongle 2
Zoosk 1
J Date 1
Adult Friend Finder 1
Other 10
Don’t know 8
99 1

names(dating)

Data preperation

dating$flirtonline <-factor(dating$flirtonline,
                            labels = c("Flirts online", "Does not flirt online"))
dating$email <-factor(dating$email,
                            labels = c("Emails", "Does not email"))
attach(dating)
## The following objects are masked from dating (pos = 3):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from dating (pos = 7):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from Mroz (pos = 11):
## 
##     age, inc
## 
## The following objects are masked from Mroz (pos = 15):
## 
##     age, inc
t1=xtabs(~ sex + metonline);gender=round(prop.table(t1,1)*100,2)
t1=xtabs(~ mar + metonline);mar2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ email + metonline);email2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ flirtonline + metonline);flirt2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ community + metonline);comm2=round(prop.table(t1,1)*100,2)
tab=rbind(gender, mar2, email2, flirt2, comm2)

c1<-rbind("sex","" , "marital","","","","","","email","", "flirting", "", "urban/rural","","" )

colnames(c1) <- "categorical variable"
tab1=  cbind(c1,"categories"=rownames(tab), tab)

tab2 <-xtable(tab1, digits=2)
print(tab2, type="html", include.rownames=FALSE, floating=FALSE)
categorical variable categories Met online Met offline
sex Male 4.79 95.21
Female 4.12 95.88
marital Married 2.58 97.42
Living with a partner 13.56 86.44
Divorced 11.67 88.33
Separated 0 100
Widowed 0 100
Never been married 9.45 90.55
email Emails 5.29 94.71
Does not email 0.84 99.16
flirting Flirts online 17.65 82.35
Does not flirt online 2.13 97.87
urban/rural rural 3.14 96.86
suburban 3.86 96.14
urban 6.17 93.83

Model estimation

Binary Logit:

How I met your mother?

#table(dating$metonline)
dating$metonline <- factor(dating$metonline, 
                    levels = c("Met offline", "Met online"))
print(xtable(
   table(metonline)), 
   type="html")
metonline
Met online 63
Met offline 1354

## # weights:  16 (15 variable)
## initial  value 434.603282 
## iter  10 value 125.619687
## iter  20 value 107.951460
## iter  30 value 107.892537
## final  value 107.891295 
## converged

How I met your mother?

stargazer(mod.0, type="html", no.space=TRUE)
Dependent variable:
metonline
sexFemale -0.045
(0.402)
cregionMidwest -0.152
(0.654)
cregionSouth -0.047
(0.546)
cregionWest 0.258
(0.580)
marLiving with a partner 1.312**
(0.526)
marDivorced 0.923
(0.712)
marSeparated -7.706***
(0.00002)
marWidowed -6.603***
(0.00003)
marNever been married 0.427
(0.627)
emailDoes not email -0.925
(1.053)
flirtonlineDoes not flirt online -1.745***
(0.452)
age 0.006
(0.016)
communitysuburban 0.307
(0.609)
communityurban 0.306
(0.616)
Constant -2.587**
(1.079)
Akaike Inf. Crit. 245.783
Note: p<0.1; p<0.05; p<0.01
stargazer(mod.0, type="html", no.space=TRUE, 
          covariate.labels=c("Female", "midwest","south", "west", "living with a partner", 
                             "divorced", "separated", "widowed", "never been married",
                             "does not email", "does not flirt online", "age in years",
                             "suburban", "urban"))
Dependent variable:
metonline
Female -0.045
(0.402)
midwest -0.152
(0.654)
south -0.047
(0.546)
west 0.258
(0.580)
living with a partner 1.312**
(0.526)
divorced 0.923
(0.712)
separated -7.706***
(0.00002)
widowed -6.603***
(0.00003)
never been married 0.427
(0.627)
does not email -0.925
(1.053)
does not flirt online -1.745***
(0.452)
age in years 0.006
(0.016)
suburban 0.307
(0.609)
urban 0.306
(0.616)
Constant -2.587**
(1.079)
Akaike Inf. Crit. 245.783
Note: p<0.1; p<0.05; p<0.01
## Exponentiated coefficients

exponentiate <- function(x) (exp(x)-1)*100
stargazer(mod.0, type="html", no.space=TRUE, apply.coef= exponentiate, se= list(NA), 
          omit.table.layout = "a", 
          dep.var.labels=c("Odds (%)"),
          covariate.labels=c("Female", "midwest","south", "west", "living with a partner", 
                             "divorced", "separated", "widowed", "never been married",
                             "does not email", "does not flirt online", "age in years",
                             "suburban", "urban"))
Dependent variable:
Odds (%)
Female -4.444
midwest -14.110
south -4.636
west 29.410
living with a partner 271.325
divorced 151.787
separated -99.955
widowed -99.864
never been married 53.233
does not email -60.345
does not flirt online -82.533
age in years 0.630
suburban 35.993
urban 35.852
Constant -92.476
Akaike Inf. Crit. 245.783
Note: p<0.1; p<0.05; p<0.01

Type of dating service

newdata <- subset(dating, datingbrand == "Match.com" |   
                  datingbrand == "eHarmony" |
                  datingbrand == "OK Cupid" |
                  datingbrand == "Plenty of Fish")
newdata$datingbrand <- droplevels(newdata$datingbrand)

attach(newdata)
t1=xtabs(~ sex + datingbrand);gender=round(prop.table(t1,1)*100,2)
t1=xtabs(~ community + datingbrand);community2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ par + datingbrand);parent2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ email + datingbrand);email2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ intmob + datingbrand);intmob2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ teletype + datingbrand);teletype2=round(prop.table(t1,1)*100, 2)


tab=rbind(gender, community2, parent2, email2, intmob2, teletype2)

c1<-rbind("sex","","community type", "","","parental status","","email","",
          "mobile internet", "",  "telephone type","" )

colnames(c1) <- "categorical variable"
tab1=  cbind(c1,"categories"=rownames(tab), tab)
tab2 <-xtable(tab1, digits=2)
## Warning in data.row.names(row.names, rowsi, i): some row.names duplicated:
## 10,11 --> row.names NOT used
print(tab2, type="html", include.rownames=FALSE, floating=FALSE)
categorical variable categories Match.com eHarmony OK Cupid Plenty of Fish
sex Male 60.81 17.57 10.81 10.81
Female 44.44 27.16 16.05 12.35
community type rural 61.11 22.22 5.56 11.11
suburban 56 24 10.67 9.33
urban 45.16 20.97 19.35 14.52
parental status Yes 61.9 19.05 9.52 9.52
No 48.67 23.89 15.04 12.39
email Emails 54.02 20.69 11.49 13.79
Does not email 50 0 50 0
mobile internet Yes 52.94 21.01 13.45 12.61
No 50 27.78 13.89 8.33
telephone type Landline 56.36 25.45 5.45 12.73
Cell 50 21 18 11

##                [,1]
## Match.com        81
## eHarmony         35
## OK Cupid         21
## Plenty of Fish   18
## Warning in multinom(datingbrand ~ sex + community + par + email + intmob +
## : groups 'Christian Mongle' 'Zoosk' 'J Date' 'Adult Friend Finder' 'Other'
## 'Don't know' '99' are empty
## # weights:  36 (24 variable)
## initial  value 123.380198 
## iter  10 value 93.829727
## iter  20 value 93.275517
## iter  30 value 93.238790
## final  value 93.238660 
## converged

stargazer(mod.3, type="html", no.space=TRUE)
Dependent variable:
eHarmony OK Cupid Plenty of Fish
(1) (2) (3)
sexFemale 0.078 1.073 0.038
(0.607) (0.804) (0.699)
communitysuburban 0.342 0.401 0.018
(0.923) (1.545) (0.954)
communityurban 0.344 2.425 -0.036
(0.959) (1.513) (1.000)
parNo 1.083 1.653 1.233
(0.729) (1.154) (0.847)
emailDoes not email -13.858*** 2.283 -13.508***
(0.00000) (1.683) (0.00000)
intmobNo 0.596 -0.134 -0.599
(0.623) (0.879) (0.869)
teletypeCell -0.481 1.771 -0.060
(0.625) (1.193) (0.755)
Constant -1.981* -6.377*** -2.129
(1.194) (2.257) (1.314)
Akaike Inf. Crit. 234.477 234.477 234.477
Note: p<0.1; p<0.05; p<0.01

Multinomial Logit, phone type

dating$intuse <-factor(dating$intuse,
                            labels = c("Uses internet", "Does not use internet"))
                            
dating$par <-factor(dating$par,
                            labels = c("Parent", "Not parent"))
                            
dating$intmob <-factor(dating$intmob,
                            labels = c("Uses mobile internet", 
                            "Does not use mobile internet"))
                            
attach(dating)
## The following objects are masked from newdata:
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from dating (pos = 4):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from dating (pos = 5):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from dating (pos = 9):
## 
##     adults, age, askedout, birth.hisp, breaka, breakb, cellphn,
##     cellular, community, cregion, date3a, date3b, date5a, date9a,
##     date9b, date9c, date9d, dateserv, datingbrand, educ2, email,
##     eminuse, employed, flirtonline, fonebrand, fonedateserv, hisp,
##     inc, intbank, intmob, intuse, kids12to17, kids6to11,
##     kidsunder6, lang, lgbt, lifequal, longdist.rel, look4love,
##     mar, mar.duration, meet, metonline, onlineserv, par, psraid,
##     race, romantic, search.old.flame, searched.online, sex,
##     smartfone, smarttab, socnet, standwt, teletype, twitter,
##     weight
## 
## The following objects are masked from Mroz (pos = 13):
## 
##     age, inc
## 
## The following objects are masked from Mroz (pos = 17):
## 
##     age, inc
t1=xtabs(~ sex + fonebrand);gender=round(prop.table(t1,1)*100,2)
t1=xtabs(~ cregion + fonebrand);region2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ mar + fonebrand);mar2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ par + fonebrand);parent2=round(prop.table(t1,1)*100,2)
t1=xtabs(~ intuse + fonebrand);intuse2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ email + fonebrand);email2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ intmob + fonebrand);intmob2=round(prop.table(t1,1)*100, 2)
t1=xtabs(~ teletype + fonebrand);teletype2=round(prop.table(t1,1)*100, 2)


tab=rbind(gender, region2, mar2, parent2, intuse2, email2, intmob2, teletype2)

c1<-rbind("sex","","region", "","","", "marital","","","","","",
          "parental status","","internet use","","email","",
          "mobile internet", "",  "telephone type","" )

colnames(c1) <- "categorical variable"
tab1=  cbind(c1,"categories"=rownames(tab), tab)

tab2 <-xtable(tab1, digits=2)
print(tab2, type="html", include.rownames=FALSE, floating=FALSE)
categorical variable categories iPhone Blackberry Android (VOL.) Basic cell phone - unspecified
sex Male 25.3 4.34 29.64 40.72
Female 25.68 3.31 23.54 47.47
region Northeast 27.9 5.33 25.71 41.07
Midwest 18.81 2.43 26.55 52.21
South 28.1 3.83 25.59 42.48
West 26.19 4.05 28.33 41.43
marital Married 28.29 4.09 25.03 42.59
Living with a partner 26.85 2.78 32.41 37.96
Divorced 18.47 3.15 23.42 54.95
Separated 20.41 6.12 24.49 48.98
Widowed 13.84 2.52 9.43 74.21
Never been married 27.91 3.88 37.38 30.83
parental status Parent 33.72 3.49 37.4 25.39
Not parent 22.54 3.93 22.47 51.05
internet use Uses internet 28.3 3.74 28.19 39.77
Does not use internet 4.24 3.39 11.02 81.36
email Emails 28.98 3.73 28.98 38.31
Does not email 8.19 3.51 12.87 75.44
mobile internet Uses mobile internet 37.01 4.3 37.87 20.81
Does not use mobile internet 3.59 2.84 4.63 88.94
telephone type Landline 21.33 4.36 18.92 55.39
Cell 28.88 3.34 32.5 35.28

## # weights:  64 (45 variable)
## initial  value 1332.228881 
## iter  10 value 895.840032
## iter  20 value 868.268946
## iter  30 value 865.935209
## iter  40 value 865.898108
## final  value 865.898077 
## converged

Phone type

stargazer(mod.1, type="html", no.space=TRUE)
Dependent variable:
Blackberry Android (VOL.) Basic cell phone - unspecified
(1) (2) (3)
sexFemale -0.628 -0.167 0.352*
(0.384) (0.186) (0.208)
cregionMidwest -0.293 0.457 1.045***
(0.570) (0.295) (0.331)
cregionSouth -0.496 0.105 0.448
(0.489) (0.262) (0.304)
cregionWest -0.175 0.320 0.613*
(0.532) (0.289) (0.335)
marLiving with a partner -0.675 0.476 0.010
(1.076) (0.387) (0.452)
marDivorced -0.479 0.535* 0.231
(0.798) (0.320) (0.349)
marSeparated 0.899 -0.419 -0.077
(0.908) (0.748) (0.680)
marWidowed -1.141 -0.745 -0.098
(1.099) (0.532) (0.440)
marNever been married -0.257 0.299 -0.253
(0.480) (0.232) (0.265)
parNot parent 0.204 -0.294 0.350
(0.430) (0.204) (0.234)
intuseDoes not use internet 0.431 1.083* 0.613
(0.945) (0.617) (0.593)
emailDoes not email 1.119* 0.128 0.759*
(0.652) (0.412) (0.406)
intmobDoes not use mobile internet 1.036* 0.072 3.395***
(0.565) (0.409) (0.318)
teletypeCell -0.892** 0.150 -0.294
(0.389) (0.197) (0.210)
Constant -1.191** -0.181 -1.413***
(0.515) (0.292) (0.350)
Akaike Inf. Crit. 1,821.796 1,821.796 1,821.796
Note: p<0.1; p<0.05; p<0.01

Recoding fonebrand into brand2

  • Factor varaibles are changed for easy reading
  • Basic cellphone is now the base case.
dating$brand2 <-dating$fonebrand
dating$brand2 <-factor(dating$brand2, levels = c("(VOL.) Basic cell phone - unspecified",
                                                 "iPhone", "Blackberry", "Android"), 
                    labels = c("basic cell phone", "iPhone", "Blackberry", "Android"))
tab.1<- xtable(cbind(brand2=table(dating$brand2 )))
tab.2<- xtable(cbind(fonebrand=table(dating$fonebrand)))
print (tab.1, type="html")
brand2
basic cell phone 863
iPhone 497
Blackberry 74
Android 515
print (tab.2, type="html")
fonebrand
iPhone 497
Blackberry 74
Android 515
(VOL.) Basic cell phone - unspecified 863
Re-estimating the Phone Type model
## # weights:  64 (45 variable)
## initial  value 1332.228881 
## iter  10 value 903.898551
## iter  20 value 869.618127
## iter  30 value 865.986541
## iter  40 value 865.898187
## final  value 865.898094 
## converged

stargazer(mod.1, type="html", no.space=TRUE, 
          covariate.labels=c("Female", "midwest","south", "west", "living with a partner", 
                             "divorced", "separated", "widowed", "never been married", 
                             "no children", "does not use internet", "no email", 
                             "no internet on mobile phone", 
                             "respondent reached on cellular"))
Dependent variable:
iPhone Blackberry Android
(1) (2) (3)
Female -0.352* -0.980** -0.519**
(0.208) (0.386) (0.206)
midwest -1.044*** -1.337** -0.587*
(0.331) (0.571) (0.331)
south -0.447 -0.943* -0.342
(0.304) (0.501) (0.314)
west -0.612* -0.788 -0.292
(0.335) (0.545) (0.340)
living with a partner -0.010 -0.686 0.466
(0.452) (1.076) (0.423)
divorced -0.231 -0.710 0.304
(0.349) (0.783) (0.321)
separated 0.077 0.977 -0.342
(0.680) (0.872) (0.759)
widowed 0.099 -1.045 -0.646
(0.440) (1.075) (0.527)
never been married 0.253 -0.005 0.552**
(0.265) (0.486) (0.262)
no children -0.350 -0.146 -0.644***
(0.234) (0.437) (0.230)
does not use internet -0.613 -0.183 0.471
(0.593) (0.819) (0.480)
no email -0.760* 0.359 -0.632*
(0.406) (0.612) (0.374)
no internet on mobile phone -3.395*** -2.358*** -3.323***
(0.318) (0.502) (0.310)
respondent reached on cellular 0.294 -0.599 0.444**
(0.210) (0.391) (0.210)
Constant 1.413*** 0.223 1.231***
(0.350) (0.542) (0.354)
Akaike Inf. Crit. 1,821.796 1,821.796 1,821.796
Note: p<0.1; p<0.05; p<0.01