Robert W. Walker
November 6, 2017
The HR Department needs a hiring diagnostic for choosing among applicants for employment. The goal is to maximize the productivity of chosen future employees by building and deploying a model for predicting and explaining worker productivity. We are to explain With as a function, potentially, of:
library(RcmdrMisc)
library(Rcmdr)
library(car)
numSummary(Hiring[,c("Dexterity", "General", "Subject", "With", "Without")], statistics=c("mean", "sd", "se(mean)", "IQR"))
mean sd se(mean) IQR n
Dexterity 176.0833 44.81860 7.469767 70.0 36
General 179.5556 54.06105 9.010175 90.0 36
Subject 18.5000 10.53565 1.755942 17.5 36
With 109.0000 12.24745 2.041241 20.0 36
Without 104.0000 12.98131 2.163551 20.0 36
Our focus will be the third row.
library(stargazer)
Mod.DW <- lm(With~Dexterity+Without, data=Hiring)
Mod.GW <- lm(With~General+Without, data=Hiring)
Mod.DG <- lm(With~General+Dexterity, data=Hiring)
stargazer(Mod.DG,Mod.DW,Mod.GW, type="html")
Dependent variable: | |||
With | |||
(1) | (2) | (3) | |
General | 0.219*** | 0.095*** | |
(0.019) | (0.018) | ||
Dexterity | -0.009 | 0.059*** | |
(0.023) | (0.012) | ||
Without | 0.797*** | 0.551*** | |
(0.041) | (0.075) | ||
Constant | 71.286*** | 15.670*** | 34.560*** |
(2.935) | (3.664) | (5.148) | |
Observations | 36 | 36 | 36 |
R2 | 0.888 | 0.955 | 0.957 |
Adjusted R2 | 0.881 | 0.952 | 0.955 |
Residual Std. Error (df = 33) | 4.223 | 2.682 | 2.607 |
F Statistic (df = 2; 33) | 130.667*** | 348.301*** | 369.641*** |
Note: | *p<0.1; **p<0.05; ***p<0.01 |
# Dexterity and General
shapiro.test(Mod.DG$residuals)
Shapiro-Wilk normality test
data: Mod.DG$residuals
W = 0.96384, p-value = 0.2816
# Dexterity and Without
shapiro.test(Mod.DW$residuals)
Shapiro-Wilk normality test
data: Mod.DW$residuals
W = 0.98128, p-value = 0.7876
# General and Without
shapiro.test(Mod.GW$residuals)
Shapiro-Wilk normality test
data: Mod.GW$residuals
W = 0.9639, p-value = 0.2828
Without and General provide the best explanation. Without and Dexterity are a close second. General and Dexterity explain almost 90% but trail far behind.
From our chosen model, a few cool things….
library(effects)
plot(allEffects(Mod.GW))
Pred.Data <- data.frame(General=119, Without=86)
Pred.Data # Newdata
General Without
1 119 86
predict(Mod.GW, newdata=Pred.Data, interval="confidence", level=.95,
se.fit=FALSE)
fit lwr upr
1 93.3029 91.76003 94.84578
predict(Mod.GW, newdata=Pred.Data, interval="prediction", level=.95,
se.fit=FALSE)
fit lwr upr
1 93.3029 87.77848 98.82733