Last data update: 2014.03.03

R: Bank Wages
BankWagesR Documentation

Bank Wages

Description

Wages of employees of a US bank.

Usage

data("BankWages")

Format

A data frame containing 474 observations on 4 variables.

job

Ordered factor indicating job category, with levels "custodial", "admin" and "manage".

education

Education in years.

gender

Factor indicating gender.

minority

Factor. Is the employee member of a minority?

Source

Online complements to Heij, de Boer, Franses, Kloek, and van Dijk (2004).

http://www.oup.com/uk/booksites/content/0199268010/datasets/ch6/xr614bwa.asc

References

Heij, C., de Boer, P.M.C., Franses, P.H., Kloek, T. and van Dijk, H.K. (2004). Econometric Methods with Applications in Business and Economics. Oxford: Oxford University Press.

Examples

data("BankWages")

## exploratory analysis of job ~ education
## (tables and spine plots, some education levels merged)
xtabs(~ education + job, data = BankWages)
edcat <- factor(BankWages$education)
levels(edcat)[3:10] <- rep(c("14-15", "16-18", "19-21"), c(2, 3, 3))
tab <- xtabs(~ edcat + job, data = BankWages)
prop.table(tab, 1)
spineplot(tab, off = 0)
plot(job ~ edcat, data = BankWages, off = 0)

## fit multinomial model for male employees
library("nnet")
fm_mnl <- multinom(job ~ education + minority, data = BankWages,
  subset = gender == "male", trace = FALSE)
summary(fm_mnl)
confint(fm_mnl)

## same with mlogit package
if(require("mlogit")) {
fm_mlogit <- mlogit(job ~ 1 | education + minority, data = BankWages,
  subset = gender == "male", shape = "wide", reflevel = "custodial")
summary(fm_mlogit)
}

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AER)
Loading required package: car
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AER/BankWages.Rd_%03d_medium.png", width=480, height=480)
> ### Name: BankWages
> ### Title: Bank Wages
> ### Aliases: BankWages
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data("BankWages")
> 
> ## exploratory analysis of job ~ education
> ## (tables and spine plots, some education levels merged)
> xtabs(~ education + job, data = BankWages)
         job
education custodial admin manage
       8         13    40      0
       12        13   176      1
       14         0     6      0
       15         1   111      4
       16         0    24     35
       17         0     3      8
       18         0     2      7
       19         0     1     26
       20         0     0      2
       21         0     0      1
> edcat <- factor(BankWages$education)
> levels(edcat)[3:10] <- rep(c("14-15", "16-18", "19-21"), c(2, 3, 3))
> tab <- xtabs(~ edcat + job, data = BankWages)
> prop.table(tab, 1)
       job
edcat     custodial       admin      manage
  8     0.245283019 0.754716981 0.000000000
  12    0.068421053 0.926315789 0.005263158
  14-15 0.008196721 0.959016393 0.032786885
  16-18 0.000000000 0.367088608 0.632911392
  19-21 0.000000000 0.033333333 0.966666667
> spineplot(tab, off = 0)
> plot(job ~ edcat, data = BankWages, off = 0)
> 
> ## fit multinomial model for male employees
> library("nnet")
> fm_mnl <- multinom(job ~ education + minority, data = BankWages,
+   subset = gender == "male", trace = FALSE)
> summary(fm_mnl)
Call:
multinom(formula = job ~ education + minority, data = BankWages, 
    subset = gender == "male", trace = FALSE)

Coefficients:
       (Intercept) education minorityyes
admin    -4.760725 0.5533995  -0.4269495
manage  -30.774855 2.1867717  -2.5360409

Std. Errors:
       (Intercept)  education minorityyes
admin     1.172774 0.09904108   0.5027084
manage    4.478612 0.29483562   0.9342070

Residual Deviance: 237.472 
AIC: 249.472 
> confint(fm_mnl)
, , admin

                 2.5 %     97.5 %
(Intercept) -7.0593203 -2.4621301
education    0.3592825  0.7475164
minorityyes -1.4122398  0.5583409

, , manage

                 2.5 %      97.5 %
(Intercept) -39.552774 -21.9969368
education     1.608904   2.7646389
minorityyes  -4.367053  -0.7050288

> 
> ## same with mlogit package
> if(require("mlogit")) {
+ fm_mlogit <- mlogit(job ~ 1 | education + minority, data = BankWages,
+   subset = gender == "male", shape = "wide", reflevel = "custodial")
+ summary(fm_mlogit)
+ }
Loading required package: mlogit
Loading required package: Formula
Loading required package: maxLik
Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/

Call:
mlogit(formula = job ~ 1 | education + minority, data = BankWages, 
    subset = gender == "male", reflevel = "custodial", shape = "wide", 
    method = "nr", print.level = 0)

Frequencies of alternatives:
custodial     admin    manage 
  0.10465   0.60853   0.28682 

nr method
8 iterations, 0h:0m:0s 
g'(-H)^-1g = 9.15E-06 
successive function values within tolerance limits 

Coefficients :
                     Estimate Std. Error t-value  Pr(>|t|)    
admin:(intercept)   -4.760722   1.172774 -4.0594 4.921e-05 ***
manage:(intercept) -30.774826   4.478608 -6.8715 6.352e-12 ***
admin:education      0.553399   0.099041  5.5876 2.303e-08 ***
manage:education     2.186770   0.294835  7.4169 1.199e-13 ***
admin:minorityyes   -0.426952   0.502708 -0.8493  0.395712    
manage:minorityyes  -2.536041   0.934207 -2.7146  0.006635 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log-Likelihood: -118.74
McFadden R^2:  0.48676 
Likelihood ratio test : chisq = 225.22 (p.value = < 2.22e-16)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>