library(ggplot2)
library(reshape)
# If you get an error on this command, you probably need to install ggplot2
# and/or reshape, with:
# > install.packages('ggplot2')
# > install.packages('reshape')
# Then, run the library command again
#“Wage2” dataset can be found more information https://cran.r-project.org/web/packages/wooldridge/wooldridge.pdf
#“mroz” datase can be found here https://cran.r-project.org/web/packages/MASS/MASS.pdf
wages<-read.csv('http://inta.gatech.s3.amazonaws.com/wage2.csv')
# Read data from gatech website. This data accompanies the econometrics textbook by Wooldridge:
# http://www.amazon.com/Introductory-Econometrics-A-Modern-Approach/dp/1111531048
summary(wages)
## wage hours IQ KWW
## Min. : 115.0 Min. :20.00 Min. : 50.0 Min. :12.00
## 1st Qu.: 669.0 1st Qu.:40.00 1st Qu.: 92.0 1st Qu.:31.00
## Median : 905.0 Median :40.00 Median :102.0 Median :37.00
## Mean : 957.9 Mean :43.93 Mean :101.3 Mean :35.74
## 3rd Qu.:1160.0 3rd Qu.:48.00 3rd Qu.:112.0 3rd Qu.:41.00
## Max. :3078.0 Max. :80.00 Max. :145.0 Max. :56.00
##
## educ exper tenure age
## Min. : 9.00 Min. : 1.00 Min. : 0.000 Min. :28.00
## 1st Qu.:12.00 1st Qu.: 8.00 1st Qu.: 3.000 1st Qu.:30.00
## Median :12.00 Median :11.00 Median : 7.000 Median :33.00
## Mean :13.47 Mean :11.56 Mean : 7.234 Mean :33.08
## 3rd Qu.:16.00 3rd Qu.:15.00 3rd Qu.:11.000 3rd Qu.:36.00
## Max. :18.00 Max. :23.00 Max. :22.000 Max. :38.00
##
## married black south urban
## Min. :0.000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:1.000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :1.000 Median :0.0000 Median :0.0000 Median :1.0000
## Mean :0.893 Mean :0.1283 Mean :0.3412 Mean :0.7176
## 3rd Qu.:1.000 3rd Qu.:0.0000 3rd Qu.:1.0000 3rd Qu.:1.0000
## Max. :1.000 Max. :1.0000 Max. :1.0000 Max. :1.0000
##
## sibs brthord meduc feduc
## Min. : 0.000 Min. : 1.000 Min. : 0.00 Min. : 0.00
## 1st Qu.: 1.000 1st Qu.: 1.000 1st Qu.: 8.00 1st Qu.: 8.00
## Median : 2.000 Median : 2.000 Median :12.00 Median :10.00
## Mean : 2.941 Mean : 2.277 Mean :10.68 Mean :10.22
## 3rd Qu.: 4.000 3rd Qu.: 3.000 3rd Qu.:12.00 3rd Qu.:12.00
## Max. :14.000 Max. :10.000 Max. :18.00 Max. :18.00
## NA's :83 NA's :78 NA's :194
## lwage
## Min. :4.745
## 1st Qu.:6.506
## Median :6.808
## Mean :6.779
## 3rd Qu.:7.056
## Max. :8.032
##
# Print summary statistics for the data frame
table(wages$educ)
##
## 9 10 11 12 13 14 15 16 17 18
## 10 35 43 393 85 77 45 150 40 57
# Tabulate education levels in the sample
ggplot(data=wages, aes(x=educ, y=wage)) + geom_point() + stat_smooth(formula=y~x)
## `geom_smooth()` using method = 'loess'

# Look at the distribution of education and wages in a scatter plot
model.results <- lm(wage ~ educ, data=wages)
# Fit a linear model where y is wage and x is education
print(model.results)
##
## Call:
## lm(formula = wage ~ educ, data = wages)
##
## Coefficients:
## (Intercept) educ
## 146.95 60.21
# print a simple version of the model results
summary(model.results)
##
## Call:
## lm(formula = wage ~ educ, data = wages)
##
## Residuals:
## Min 1Q Median 3Q Max
## -877.38 -268.63 -38.38 207.05 2148.26
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 146.952 77.715 1.891 0.0589 .
## educ 60.214 5.695 10.573 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 382.3 on 933 degrees of freedom
## Multiple R-squared: 0.107, Adjusted R-squared: 0.106
## F-statistic: 111.8 on 1 and 933 DF, p-value: < 2.2e-16
# Print a more detailed version of model results
data.to.predict <-data.frame(educ=c(1,12,14,50))
data.to.predict$predicted.wage <- predict(model.results, data.to.predict)
# Predict outcomes for different people with different levels of education, 1,
# 12, 14, and 50 years
data.to.predict
## educ predicted.wage
## 1 1 207.1667
## 2 12 869.5238
## 3 14 989.9524
## 4 50 3157.6666
# To control for more variables, add them to the Right hand side of the
# 'formula', which is the 'wage ~ educ' piece of the code
model.results.detail <- lm(wage ~ educ + IQ, data=wages)
summary(model.results.detail)
##
## Call:
## lm(formula = wage ~ educ + IQ, data = wages)
##
## Residuals:
## Min 1Q Median 3Q Max
## -860.29 -251.00 -35.31 203.98 2110.38
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -128.8899 92.1823 -1.398 0.162
## educ 42.0576 6.5498 6.421 2.15e-10 ***
## IQ 5.1380 0.9558 5.375 9.66e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 376.7 on 932 degrees of freedom
## Multiple R-squared: 0.1339, Adjusted R-squared: 0.132
## F-statistic: 72.02 on 2 and 932 DF, p-value: < 2.2e-16
# Note that adding IQ here reduces the coefficient on education, which makes
# sense per the discussion of omitted variables that we have done
# Try using different combinations of variables to see what works and makes sense.
ggplot(data=wages, aes(x=educ, y=wage)) + geom_violin(aes(group=educ)) + stat_smooth(data=wages, aes(x=educ, y=wage), method = 'lm')
## `geom_smooth()` using formula = 'y ~ x'

# A picture of how the linear model does, with marginal distributions
# Save the picture by uncommenting the line below:
# ggsave('violin.png', width=7, height=5, units = "in")
lfp <- read.csv('http://inta.gatech.s3.amazonaws.com/mroz.csv')
# Load labor force participation data
summary(lfp)
## inlf hours kidslt6 kidsge6
## Min. :0.0000 Min. : 0.0 Min. :0.0000 Min. :0.000
## 1st Qu.:0.0000 1st Qu.: 0.0 1st Qu.:0.0000 1st Qu.:0.000
## Median :1.0000 Median : 288.0 Median :0.0000 Median :1.000
## Mean :0.5684 Mean : 740.6 Mean :0.2377 Mean :1.353
## 3rd Qu.:1.0000 3rd Qu.:1516.0 3rd Qu.:0.0000 3rd Qu.:2.000
## Max. :1.0000 Max. :4950.0 Max. :3.0000 Max. :8.000
##
## age educ wage repwage
## Min. :30.00 Min. : 5.00 Min. : 0.1282 Min. :0.00
## 1st Qu.:36.00 1st Qu.:12.00 1st Qu.: 2.2626 1st Qu.:0.00
## Median :43.00 Median :12.00 Median : 3.4819 Median :0.00
## Mean :42.54 Mean :12.29 Mean : 4.1777 Mean :1.85
## 3rd Qu.:49.00 3rd Qu.:13.00 3rd Qu.: 4.9708 3rd Qu.:3.58
## Max. :60.00 Max. :17.00 Max. :25.0000 Max. :9.98
## NA's :325
## hushrs husage huseduc huswage
## Min. : 175 Min. :30.00 Min. : 3.00 Min. : 0.4121
## 1st Qu.:1928 1st Qu.:38.00 1st Qu.:11.00 1st Qu.: 4.7883
## Median :2164 Median :46.00 Median :12.00 Median : 6.9758
## Mean :2267 Mean :45.12 Mean :12.49 Mean : 7.4822
## 3rd Qu.:2553 3rd Qu.:52.00 3rd Qu.:15.00 3rd Qu.: 9.1667
## Max. :5010 Max. :60.00 Max. :17.00 Max. :40.5090
##
## faminc mtr motheduc fatheduc
## Min. : 1500 Min. :0.4415 Min. : 0.000 Min. : 0.000
## 1st Qu.:15428 1st Qu.:0.6215 1st Qu.: 7.000 1st Qu.: 7.000
## Median :20880 Median :0.6915 Median :10.000 Median : 7.000
## Mean :23081 Mean :0.6789 Mean : 9.251 Mean : 8.809
## 3rd Qu.:28200 3rd Qu.:0.7215 3rd Qu.:12.000 3rd Qu.:12.000
## Max. :96000 Max. :0.9415 Max. :17.000 Max. :17.000
##
## unem city exper nwifeinc
## Min. : 3.000 Min. :0.0000 Min. : 0.00 Min. :-0.02906
## 1st Qu.: 7.500 1st Qu.:0.0000 1st Qu.: 4.00 1st Qu.:13.02504
## Median : 7.500 Median :1.0000 Median : 9.00 Median :17.70000
## Mean : 8.624 Mean :0.6428 Mean :10.63 Mean :20.12896
## 3rd Qu.:11.000 3rd Qu.:1.0000 3rd Qu.:15.00 3rd Qu.:24.46600
## Max. :14.000 Max. :1.0000 Max. :45.00 Max. :96.00000
##
## lwage expersq
## Min. :-2.0542 Min. : 0
## 1st Qu.: 0.8165 1st Qu.: 16
## Median : 1.2476 Median : 81
## Mean : 1.1902 Mean : 178
## 3rd Qu.: 1.6036 3rd Qu.: 225
## Max. : 3.2189 Max. :2025
## NA's :325
################################################################################################################
# CHANGE DESCRIPTION
################################################## CODE CHANGE STARTS ############################
linear.model2 <- lm(inlf ~ exper + educ + age + city + fatheduc + motheduc, data = lfp)
logit.model2 <- glm(inlf ~ exper+ educ + age + city + fatheduc + motheduc, data = lfp, family='binomial')
probit.model2 <-glm(inlf ~ exper + educ + age + city + fatheduc + motheduc, data = lfp, family=binomial(link = "probit"))
predicted2 <- data.frame(exper=seq(0,20))
predicted2$educ<-15
predicted2$age<-21
predicted2$city<-1.0
predicted2$fatheduc <- 17
predicted2$motheduc <- 15
predicted2$Logit<-predict(logit.model2, newdata=predicted2, type="response")
predicted2$Probit<-predict(probit.model2, newdata=predicted2, type="response")
predicted2$Linear<-predict(linear.model2, newdata=predicted2)
subdata <- predicted2[,c("exper", "Linear", "Probit","Logit")]
msd<-melt(subdata, id="exper")
ggplot(msd) + geom_line(aes(x=exper, y=value, colour=variable)) +
scale_colour_manual(values=c("red","green","blue"), name="") +
ggtitle("Sai Salian (Work Force)") +
theme(plot.title = element_text(lineheight=8, face="bold", size=26)) +
theme(legend.text = element_text(size=18)) +
theme(axis.title = element_text(size=18)) +
theme(legend.title = element_text()) +
labs(x="Experience", y="Probability Woman Is In Labor Force")

############################################### CODE CHANGE ENDS ################################################
# For this change, I wanted to see what my chances of being in the labor force
# would be. I added variables for education (15 years), age (21),
# city (I want to work in the city), father's education (17 years),
# and mother's education (15 years). I ran a Logistic,
# Probit, and Linear regression, and since I have approximately
# 2 years of experience working as a software developer,
# the results from all three regression tests indicate that I
# have approximately a .67-.70 or a 67-70% chance of being in
# the Labor Force, which is still a fairly high value. Since
# I am unmarried and recently finished my Bachelor's,
# it would make sense that I'd be interested
# in applying what I've learned throughout my years of
# education in the work field.
# END OF CHANGE DESCRIPTION
################################################################################################################
#################################################################################################################
# CHANGE DESCRIPTION
#################################################### CODE CHANGE STARTS #########################################
# WITH VARIABLE kidslt6
linear.model3 <- lm(inlf ~ exper + educ + age + city + faminc + huswage + kidslt6, data = lfp)
logit.model3 <- glm(inlf ~ exper+ educ + age + city + faminc + huswage + kidslt6, data = lfp, family='binomial')
probit.model3 <-glm(inlf ~ exper + educ + age + city + faminc + huswage + kidslt6, data = lfp, family=binomial(link = "probit"))
predicted3 <- data.frame(educ=seq(0,20))
predicted3$exper<-10
predicted3$age<-42
predicted3$city<-1.0
predicted3$faminc <- 20880
predicted3$huswage <- 6.98
predicted3$kidslt6 <- 2
predicted3$Logit<-predict(logit.model3, newdata=predicted3, type="response")
predicted3$Probit<-predict(probit.model3, newdata=predicted3, type="response")
predicted3$Linear<-predict(linear.model3, newdata=predicted3)
subdata <- predicted3[,c("educ", "Linear", "Probit","Logit")]
msd<-melt(subdata, id="educ")
ggplot(msd) + geom_line(aes(x=educ, y=value, colour=variable)) +
scale_colour_manual(values=c("red","green","blue"), name="") +
ggtitle("Example (With kidslt6 var.)") +
theme(plot.title = element_text(lineheight=8, face="bold", size=26)) +
theme(legend.text = element_text(size=18)) +
theme(axis.title = element_text(size=18)) +
theme(legend.title = element_text()) +
labs(x="Education", y="Probability Woman Is In Labor Force")

# WITHOUT VARIABLE kidslt6
linear.model4 <- lm(inlf ~ exper + educ + age + city + faminc + huswage, data = lfp)
logit.model4 <- glm(inlf ~ exper+ educ + age + city + faminc + huswage, data = lfp, family='binomial')
probit.model4 <-glm(inlf ~ exper + educ + age + city + faminc + huswage, data = lfp, family=binomial(link = "probit"))
predicted3 <- data.frame(educ=seq(0,20))
predicted3$exper<-10
predicted3$age<-42
predicted3$city<-1.0
predicted3$faminc <- 20880
predicted3$huswage <- 6.98
predicted3$Logit<-predict(logit.model4, newdata=predicted3, type="response")
predicted3$Probit<-predict(probit.model4, newdata=predicted3, type="response")
predicted3$Linear<-predict(linear.model4, newdata=predicted3)
subdata <- predicted3[,c("educ", "Linear", "Probit","Logit")]
msd<-melt(subdata, id="educ")
ggplot(msd) + geom_line(aes(x=educ, y=value, colour=variable)) +
scale_colour_manual(values=c("red","green","blue"), name="") +
ggtitle("Example (w/o kidslt6 var.)") +
theme(plot.title = element_text(lineheight=8, face="bold", size=26)) +
theme(legend.text = element_text(size=18)) +
theme(axis.title = element_text(size=18)) +
theme(legend.title = element_text()) +
labs(x="Education", y="Probability Woman Is In Labor Force")

#################################################### CODE CHANGE ENDS ###########################################
# In this change, I'm aiming to see how likely it is for
# a woman in her early 40s, with 2 kids less than 6
# to be in the workforce. Parameters were set for
# experience (10 years), age (42), city (yes), family
# income was 20880 (median value in table), husband's
# wage (6.98 median value in table), and 2 kids
# (< 6 years old). I ran a
# linear, probit, and logistic regression, and assuming
# she has 17 years of education (k-12 +
# 4 years bachelor's degree), she has
# a 0.21 - 0.24 or 21-24% chance of being in the
# labor force. We can assume she might want to take
# care of her young kids instead of working.
# However, removing kidslt6 increases that probability
# to 0.65-0.7 or 65-70% chance
# of her being in the labor force.
# END OF CHANGE DESCRIPTION
#########################################################################################################
linear.model <- lm(inlf ~ nwifeinc + educ + exper + expersq + age + kidslt6 + kidsge6, data = lfp)
summary(linear.model)
##
## Call:
## lm(formula = inlf ~ nwifeinc + educ + exper + expersq + age +
## kidslt6 + kidsge6, data = lfp)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.93432 -0.37526 0.08833 0.34404 0.99417
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.5855192 0.1541780 3.798 0.000158 ***
## nwifeinc -0.0034052 0.0014485 -2.351 0.018991 *
## educ 0.0379953 0.0073760 5.151 3.32e-07 ***
## exper 0.0394924 0.0056727 6.962 7.38e-12 ***
## expersq -0.0005963 0.0001848 -3.227 0.001306 **
## age -0.0160908 0.0024847 -6.476 1.71e-10 ***
## kidslt6 -0.2618105 0.0335058 -7.814 1.89e-14 ***
## kidsge6 0.0130122 0.0131960 0.986 0.324415
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4271 on 745 degrees of freedom
## Multiple R-squared: 0.2642, Adjusted R-squared: 0.2573
## F-statistic: 38.22 on 7 and 745 DF, p-value: < 2.2e-16
# Fit a linear model
logit.model <- glm(inlf ~ nwifeinc + educ + exper + expersq + age + kidslt6 + kidsge6, data = lfp, family='binomial')
# Fit a logistic model using the 'glm' command
summary(logit.model)
##
## Call:
## glm(formula = inlf ~ nwifeinc + educ + exper + expersq + age +
## kidslt6 + kidsge6, family = "binomial", data = lfp)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.425452 0.860365 0.495 0.62095
## nwifeinc -0.021345 0.008421 -2.535 0.01126 *
## educ 0.221170 0.043439 5.091 3.55e-07 ***
## exper 0.205870 0.032057 6.422 1.34e-10 ***
## expersq -0.003154 0.001016 -3.104 0.00191 **
## age -0.088024 0.014573 -6.040 1.54e-09 ***
## kidslt6 -1.443354 0.203583 -7.090 1.34e-12 ***
## kidsge6 0.060112 0.074789 0.804 0.42154
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1029.75 on 752 degrees of freedom
## Residual deviance: 803.53 on 745 degrees of freedom
## AIC: 819.53
##
## Number of Fisher Scoring iterations: 4
probit.model <-glm(inlf ~ nwifeinc + educ + exper + expersq + age + kidslt6 + kidsge6, data = lfp, family=binomial(link = "probit"))
# Fit a probit model, also using the 'glm' command.
# Note how the family command changes us from logit to probit
#############
#Prepare to plot predicitons for education from 0 to 20. Don't worry about
# understanding this code
predicted <- data.frame(educ=seq(0,20))
predicted$nwifeinc <- 17.7
predicted$exper<-9
predicted$expersq<-81
predicted$age<-42
predicted$kidslt6<-.238
predicted$kidsge6<-1.35
predicted$Logit<-predict(logit.model, newdata=predicted, type="response")
predicted$Probit<-predict(probit.model, newdata=predicted, type="response")
predicted$Linear<-predict(linear.model, newdata=predicted)
subdata <- predicted[,c("educ", "Linear", "Probit","Logit")]
msd<-melt(subdata, id="educ")
ggplot(msd) + geom_line(aes(x=educ, y=value, colour=variable)) +
scale_colour_manual(values=c("red","green","blue"), name="") +
ggtitle("Binary Response") +
theme(plot.title = element_text(lineheight=8, face="bold", size=26)) +
theme(legend.text = element_text(size=18)) +
theme(axis.title = element_text(size=18)) +
theme(legend.title = element_text()) +
labs(x="Education", y="Probability Woman Is In Labor Force")

#ggsave('binary_response.png', width=7, height=5, units = "in")
# Complete plotting logit and probit comparison
################
# Stepwise regression
library(MASS)
start.model<-lm(wage ~ hours + IQ + KWW + educ + exper + tenure + age + married + black + south + urban + sibs, data=wages)
# Give an initial model, which will be the most coefficients we'd want to ever use
summary(start.model)
##
## Call:
## lm(formula = wage ~ hours + IQ + KWW + educ + exper + tenure +
## age + married + black + south + urban + sibs, data = wages)
##
## Residuals:
## Min 1Q Median 3Q Max
## -849.76 -223.19 -40.18 172.09 2091.17
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -562.589 185.142 -3.039 0.00244 **
## hours -3.485 1.621 -2.150 0.03182 *
## IQ 2.828 1.004 2.817 0.00495 **
## KWW 5.261 1.981 2.656 0.00804 **
## educ 48.213 7.182 6.713 3.33e-11 ***
## exper 9.774 3.589 2.723 0.00658 **
## tenure 5.242 2.406 2.178 0.02963 *
## age 5.046 4.930 1.024 0.30634
## married 170.231 37.883 4.494 7.89e-06 ***
## black -108.844 39.808 -2.734 0.00637 **
## south -53.689 25.536 -2.102 0.03578 *
## urban 160.652 26.200 6.132 1.29e-09 ***
## sibs -1.068 5.455 -0.196 0.84488
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 352.6 on 922 degrees of freedom
## Multiple R-squared: 0.2493, Adjusted R-squared: 0.2395
## F-statistic: 25.51 on 12 and 922 DF, p-value: < 2.2e-16
stepwise.model<- step(start.model)
## Start: AIC=10981.26
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs
##
## Df Sum of Sq RSS AIC
## - sibs 1 4763 114655843 10979
## - age 1 130265 114781346 10980
## <none> 114651080 10981
## - south 1 549683 115200763 10984
## - hours 1 574799 115225880 10984
## - tenure 1 590101 115241181 10984
## - KWW 1 877455 115528536 10986
## - exper 1 922291 115573372 10987
## - black 1 929659 115580739 10987
## - IQ 1 986880 115637960 10987
## - married 1 2510929 117162009 11000
## - urban 1 4675218 119326298 11017
## - educ 1 5603726 120254807 11024
##
## Step: AIC=10979.3
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban
##
## Df Sum of Sq RSS AIC
## - age 1 128704 114784547 10978
## <none> 114655843 10979
## - south 1 546953 115202796 10982
## - hours 1 575305 115231148 10982
## - tenure 1 590732 115246575 10982
## - KWW 1 911607 115567450 10985
## - exper 1 926789 115582632 10985
## - black 1 1000335 115656178 10985
## - IQ 1 1002450 115658294 10985
## - married 1 2508266 117164110 10998
## - urban 1 4686063 119341906 11015
## - educ 1 5673927 120329770 11022
##
## Step: AIC=10978.35
## wage ~ hours + IQ + KWW + educ + exper + tenure + married + black +
## south + urban
##
## Df Sum of Sq RSS AIC
## <none> 114784547 10978
## - hours 1 562954 115347501 10981
## - south 1 565737 115350283 10981
## - tenure 1 680663 115465209 10982
## - IQ 1 907667 115692213 10984
## - black 1 980306 115764853 10984
## - KWW 1 1413125 116197671 10988
## - exper 1 1678662 116463208 10990
## - married 1 2538972 117323519 10997
## - urban 1 4639497 119424043 11013
## - educ 1 6097302 120881849 11025
# The command "step" adds and subtracts coefficients to maximize a measure of
# goodness of fit
summary(stepwise.model)
##
## Call:
## lm(formula = wage ~ hours + IQ + KWW + educ + exper + tenure +
## married + black + south + urban, data = wages)
##
## Residuals:
## Min 1Q Median 3Q Max
## -872.52 -224.26 -41.71 171.08 2086.14
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -453.2969 141.0390 -3.214 0.001354 **
## hours -3.4474 1.6194 -2.129 0.033536 *
## IQ 2.6621 0.9848 2.703 0.006996 **
## KWW 6.0918 1.8062 3.373 0.000775 ***
## educ 49.4804 7.0627 7.006 4.73e-12 ***
## exper 11.5519 3.1425 3.676 0.000251 ***
## tenure 5.5777 2.3828 2.341 0.019455 *
## married 171.1045 37.8476 4.521 6.96e-06 ***
## black -109.2993 38.9083 -2.809 0.005072 **
## south -54.4073 25.4951 -2.134 0.033103 *
## urban 159.8942 26.1639 6.111 1.46e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 352.5 on 924 degrees of freedom
## Multiple R-squared: 0.2484, Adjusted R-squared: 0.2402
## F-statistic: 30.53 on 10 and 924 DF, p-value: < 2.2e-16
stepwise.model.interactions <- step(start.model, scope=wage~.^2)
## Start: AIC=10981.26
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs
##
## Df Sum of Sq RSS AIC
## + KWW:educ 1 1911037 112740043 10968
## + educ:age 1 1282120 113368961 10973
## + KWW:black 1 1194791 113456289 10974
## + IQ:KWW 1 1066753 113584327 10974
## + black:sibs 1 806249 113844831 10977
## + hours:KWW 1 755386 113895694 10977
## + educ:urban 1 695416 113955664 10978
## + IQ:sibs 1 694361 113956719 10978
## + educ:exper 1 667627 113983453 10978
## + KWW:age 1 631767 114019314 10978
## + hours:south 1 625168 114025912 10978
## + married:sibs 1 574498 114076582 10979
## + south:urban 1 564654 114086426 10979
## + black:south 1 487564 114163516 10979
## - sibs 1 4763 114655843 10979
## + IQ:educ 1 449771 114201309 10980
## + educ:married 1 415461 114235619 10980
## + hours:age 1 411927 114239154 10980
## + tenure:black 1 409691 114241390 10980
## + KWW:married 1 391481 114259600 10980
## + hours:sibs 1 382852 114268228 10980
## - age 1 130265 114781346 10980
## + KWW:sibs 1 354299 114296782 10980
## + exper:age 1 348719 114302361 10980
## + educ:black 1 319990 114331091 10981
## <none> 114651080 10981
## + hours:tenure 1 214599 114436481 10982
## + black:urban 1 200281 114450799 10982
## + tenure:south 1 187488 114463592 10982
## + educ:sibs 1 181656 114469425 10982
## + IQ:black 1 175403 114475677 10982
## + exper:south 1 163186 114487895 10982
## + hours:married 1 161641 114489439 10982
## + IQ:urban 1 155293 114495787 10982
## + IQ:age 1 139542 114511539 10982
## + age:sibs 1 139255 114511825 10982
## + tenure:urban 1 137750 114513330 10982
## + age:married 1 132430 114518650 10982
## + tenure:age 1 111540 114539540 10982
## + hours:exper 1 107393 114543688 10982
## + hours:educ 1 97692 114553388 10982
## + age:black 1 92171 114558909 10982
## + exper:urban 1 87171 114563909 10983
## + IQ:married 1 58427 114592653 10983
## + IQ:exper 1 46633 114604448 10983
## + educ:south 1 42024 114609056 10983
## + age:south 1 40889 114610192 10983
## + hours:IQ 1 26239 114624841 10983
## + exper:tenure 1 23621 114627460 10983
## + exper:black 1 22305 114628776 10983
## + tenure:sibs 1 22068 114629013 10983
## + educ:tenure 1 20822 114630258 10983
## + tenure:married 1 19810 114631271 10983
## + married:black 1 19545 114631536 10983
## + married:south 1 18028 114633052 10983
## + IQ:south 1 14743 114636338 10983
## + exper:sibs 1 13695 114637385 10983
## + age:urban 1 12597 114638483 10983
## + married:urban 1 10511 114640569 10983
## + IQ:tenure 1 8883 114642197 10983
## + KWW:south 1 7896 114643185 10983
## + hours:black 1 5003 114646077 10983
## + KWW:urban 1 4334 114646746 10983
## + hours:urban 1 2445 114648636 10983
## + south:sibs 1 2348 114648733 10983
## + KWW:exper 1 2189 114648891 10983
## + exper:married 1 1749 114649331 10983
## + KWW:tenure 1 1325 114649756 10983
## + urban:sibs 1 1141 114649939 10983
## - south 1 549683 115200763 10984
## - hours 1 574799 115225880 10984
## - tenure 1 590101 115241181 10984
## - KWW 1 877455 115528536 10986
## - exper 1 922291 115573372 10987
## - black 1 929659 115580739 10987
## - IQ 1 986880 115637960 10987
## - married 1 2510929 117162009 11000
## - urban 1 4675218 119326298 11017
## - educ 1 5603726 120254807 11024
##
## Step: AIC=10967.55
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ
##
## Df Sum of Sq RSS AIC
## + hours:south 1 817073 111922970 10963
## + educ:exper 1 719870 112020173 10964
## + KWW:black 1 710103 112029939 10964
## + married:sibs 1 587553 112152490 10965
## + KWW:age 1 580504 112159539 10965
## + black:sibs 1 561664 112178379 10965
## - sibs 1 9692 112749735 10966
## + educ:urban 1 463226 112276817 10966
## + south:urban 1 462838 112277205 10966
## - age 1 33893 112773936 10966
## + black:south 1 434569 112305474 10966
## + hours:KWW 1 434379 112305664 10966
## + hours:age 1 419380 112320663 10966
## + educ:age 1 416833 112323210 10966
## + tenure:black 1 399466 112340577 10966
## + KWW:exper 1 352312 112387731 10967
## + educ:married 1 338394 112401649 10967
## + KWW:married 1 337930 112402113 10967
## + IQ:sibs 1 327205 112412838 10967
## + hours:sibs 1 304679 112435364 10967
## + hours:tenure 1 263415 112476627 10967
## <none> 112740043 10968
## + black:urban 1 237466 112502577 10968
## + educ:south 1 191103 112548940 10968
## + age:sibs 1 188318 112551725 10968
## + hours:married 1 181409 112558634 10968
## + tenure:south 1 170538 112569505 10968
## + hours:exper 1 148645 112591398 10968
## + exper:age 1 136044 112603999 10968
## + IQ:black 1 123781 112616262 10968
## + age:married 1 105507 112634536 10969
## + age:black 1 96147 112643896 10969
## + tenure:urban 1 89523 112650520 10969
## + IQ:urban 1 88532 112651511 10969
## + exper:south 1 85995 112654048 10969
## + tenure:age 1 75240 112664803 10969
## + IQ:KWW 1 72108 112667935 10969
## + KWW:sibs 1 61009 112679034 10969
## + educ:black 1 51332 112688711 10969
## + exper:urban 1 46837 112693206 10969
## + IQ:married 1 45561 112694482 10969
## + IQ:south 1 27547 112712496 10969
## + IQ:tenure 1 24162 112715881 10969
## + hours:educ 1 23840 112716203 10969
## + married:black 1 21600 112718443 10969
## + age:south 1 17543 112722500 10969
## + KWW:south 1 17328 112722715 10969
## + south:sibs 1 16832 112723210 10969
## + IQ:age 1 15833 112724210 10969
## + KWW:urban 1 12939 112727104 10969
## + urban:sibs 1 12901 112727141 10969
## + IQ:exper 1 10976 112729067 10970
## + tenure:sibs 1 10849 112729193 10970
## + married:urban 1 10462 112729581 10970
## + hours:urban 1 9378 112730665 10970
## + IQ:educ 1 8591 112731452 10970
## + hours:IQ 1 8113 112731930 10970
## + educ:tenure 1 7158 112732885 10970
## + tenure:married 1 6599 112733444 10970
## + exper:tenure 1 6552 112733491 10970
## + age:urban 1 2718 112737325 10970
## + married:south 1 2300 112737743 10970
## + exper:married 1 1983 112738060 10970
## + educ:sibs 1 292 112739751 10970
## + hours:black 1 171 112739872 10970
## + exper:black 1 158 112739885 10970
## + KWW:tenure 1 6 112740037 10970
## + exper:sibs 1 0 112740042 10970
## - south 1 527821 113267864 10970
## - tenure 1 566619 113306661 10970
## - hours 1 570019 113310062 10970
## - exper 1 917406 113657449 10973
## - IQ 1 1095767 113835810 10975
## - black 1 1105170 113845212 10975
## - KWW:educ 1 1911037 114651080 10981
## - married 1 2750422 115490465 10988
## - urban 1 4874564 117614607 11005
##
## Step: AIC=10962.74
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south
##
## Df Sum of Sq RSS AIC
## + educ:exper 1 714377 111208593 10959
## + hours:age 1 660933 111262037 10959
## + KWW:black 1 641840 111281130 10959
## + married:sibs 1 543455 111379515 10960
## + black:sibs 1 543307 111379663 10960
## + KWW:age 1 528609 111394361 10960
## + hours:KWW 1 500513 111422457 10961
## + south:urban 1 481332 111441638 10961
## + educ:urban 1 479930 111443040 10961
## - sibs 1 1402 111924372 10961
## + educ:age 1 442742 111480227 10961
## - age 1 58057 111981027 10961
## + tenure:black 1 357266 111565704 10962
## + IQ:sibs 1 313593 111609377 10962
## + black:south 1 310588 111612382 10962
## + KWW:exper 1 309651 111613319 10962
## + educ:married 1 307083 111615887 10962
## + KWW:married 1 290622 111632348 10962
## + black:urban 1 254038 111668932 10963
## <none> 111922970 10963
## + tenure:south 1 226508 111696462 10963
## + hours:sibs 1 203816 111719154 10963
## + hours:exper 1 190664 111732306 10963
## + age:sibs 1 186799 111736171 10963
## + exper:age 1 170085 111752885 10963
## + exper:south 1 136770 111786200 10964
## + educ:south 1 135744 111787226 10964
## + tenure:age 1 134542 111788428 10964
## + tenure:urban 1 125728 111797242 10964
## + hours:tenure 1 116715 111806255 10964
## + hours:married 1 114291 111808679 10964
## + age:married 1 101965 111821005 10964
## + IQ:urban 1 100857 111822113 10964
## + IQ:black 1 99401 111823569 10964
## + age:black 1 85715 111837255 10964
## + IQ:KWW 1 73083 111849887 10964
## + educ:black 1 62829 111860141 10964
## + hours:educ 1 56285 111866685 10964
## + KWW:sibs 1 53792 111869178 10964
## + exper:urban 1 51192 111871778 10964
## + hours:IQ 1 47289 111875681 10964
## + hours:black 1 44304 111878666 10964
## + IQ:married 1 40532 111882438 10964
## + urban:sibs 1 29585 111893385 10964
## + IQ:tenure 1 24936 111898034 10964
## + married:black 1 21653 111901317 10965
## + IQ:age 1 18975 111903995 10965
## + IQ:exper 1 18638 111904332 10965
## + exper:tenure 1 18376 111904594 10965
## + tenure:sibs 1 16849 111906121 10965
## + IQ:educ 1 13790 111909180 10965
## + age:south 1 11702 111911268 10965
## + IQ:south 1 9392 111913578 10965
## + educ:tenure 1 9268 111913702 10965
## + married:urban 1 8848 111914122 10965
## + south:sibs 1 3758 111919212 10965
## + KWW:urban 1 3149 111919821 10965
## + tenure:married 1 2451 111920519 10965
## + exper:black 1 2145 111920825 10965
## + exper:married 1 1927 111921043 10965
## + age:urban 1 1891 111921079 10965
## + KWW:south 1 1390 111921580 10965
## + married:south 1 800 111922170 10965
## + hours:urban 1 751 111922219 10965
## + KWW:tenure 1 421 111922549 10965
## + educ:sibs 1 95 111922875 10965
## + exper:sibs 1 1 111922969 10965
## - tenure 1 554537 112477507 10965
## - hours:south 1 817073 112740043 10968
## - exper 1 930661 112853631 10968
## - black 1 1089791 113012761 10970
## - IQ 1 1107439 113030409 10970
## - KWW:educ 1 2102942 114025912 10978
## - married 1 2538323 114461293 10982
## - urban 1 4874022 116796992 11001
##
## Step: AIC=10958.76
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south + educ:exper
##
## Df Sum of Sq RSS AIC
## + hours:age 1 660743 110547850 10955
## + KWW:black 1 600325 110608267 10956
## + hours:KWW 1 525220 110683373 10956
## + educ:urban 1 484388 110724205 10957
## + married:sibs 1 483882 110724711 10957
## + black:sibs 1 480063 110728530 10957
## - sibs 1 34 111208627 10957
## + south:urban 1 463078 110745515 10957
## + IQ:exper 1 406361 110802232 10957
## + tenure:black 1 399586 110809007 10957
## - age 1 124398 111332991 10958
## + IQ:sibs 1 302204 110906389 10958
## + black:south 1 291432 110917161 10958
## + age:sibs 1 286905 110921688 10958
## + KWW:age 1 276216 110932377 10958
## + black:urban 1 241347 110967246 10959
## <none> 111208593 10959
## + exper:south 1 218073 110990520 10959
## + KWW:married 1 211555 110997038 10959
## + educ:married 1 210413 110998180 10959
## + tenure:south 1 209489 110999104 10959
## + hours:sibs 1 189802 111018791 10959
## + tenure:age 1 156068 111052525 10959
## + hours:exper 1 150329 111058264 10960
## + educ:black 1 125655 111082938 10960
## + tenure:urban 1 122549 111086043 10960
## + educ:south 1 115964 111092629 10960
## + hours:tenure 1 112868 111095725 10960
## + IQ:urban 1 107678 111100915 10960
## + age:married 1 96706 111111887 10960
## + educ:age 1 93696 111114896 10960
## + hours:married 1 93678 111114915 10960
## + IQ:black 1 90928 111117665 10960
## + hours:educ 1 87490 111121103 10960
## + IQ:educ 1 81206 111127386 10960
## + exper:age 1 73850 111134743 10960
## + KWW:exper 1 63640 111144953 10960
## + exper:urban 1 59434 111149159 10960
## + hours:IQ 1 59199 111149394 10960
## + hours:black 1 54469 111154124 10960
## + age:black 1 44306 111164287 10960
## + IQ:tenure 1 41461 111167132 10960
## + IQ:KWW 1 39868 111168725 10960
## + married:black 1 39356 111169237 10960
## + exper:black 1 37781 111170812 10960
## + urban:sibs 1 35462 111173131 10960
## + KWW:sibs 1 35391 111173202 10960
## + educ:tenure 1 29338 111179255 10960
## + IQ:married 1 21904 111186689 10961
## + exper:tenure 1 16953 111191640 10961
## + exper:sibs 1 16457 111192136 10961
## + tenure:sibs 1 11858 111196735 10961
## + KWW:tenure 1 11629 111196964 10961
## + tenure:married 1 11391 111197202 10961
## + married:urban 1 10102 111198491 10961
## + exper:married 1 9490 111199103 10961
## + IQ:south 1 8879 111199714 10961
## + south:sibs 1 6916 111201677 10961
## + IQ:age 1 5590 111203003 10961
## + hours:urban 1 3569 111205024 10961
## + age:south 1 1556 111207037 10961
## + married:south 1 1381 111207212 10961
## + KWW:urban 1 987 111207606 10961
## + KWW:south 1 651 111207942 10961
## + age:urban 1 265 111208328 10961
## + educ:sibs 1 99 111208494 10961
## - tenure 1 625711 111834304 10962
## - educ:exper 1 714377 111922970 10963
## - hours:south 1 811580 112020173 10964
## - IQ 1 1096866 112305459 10966
## - black 1 1103148 112311741 10966
## - KWW:educ 1 2156607 113365200 10975
## - married 1 2563689 113772282 10978
## - urban 1 4871756 116080349 10997
##
## Step: AIC=10955.19
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south + educ:exper +
## hours:age
##
## Df Sum of Sq RSS AIC
## + KWW:black 1 595742 109952108 10952
## + black:sibs 1 493258 110054592 10953
## + married:sibs 1 479687 110068163 10953
## - sibs 1 383 110548233 10953
## + south:urban 1 467160 110080689 10953
## + educ:urban 1 455769 110092081 10953
## + IQ:exper 1 435120 110112729 10954
## + tenure:black 1 409685 110138164 10954
## + age:sibs 1 338231 110209619 10954
## + IQ:sibs 1 317741 110230108 10954
## + hours:sibs 1 266360 110281489 10955
## + black:south 1 263143 110284706 10955
## + black:urban 1 243458 110304392 10955
## <none> 110547850 10955
## + KWW:married 1 212695 110335154 10955
## + exper:south 1 208634 110339216 10955
## + hours:tenure 1 189084 110358765 10956
## + educ:married 1 181201 110366649 10956
## + KWW:age 1 177889 110369961 10956
## + hours:KWW 1 171760 110376090 10956
## + tenure:south 1 156310 110391539 10956
## + educ:black 1 151475 110396374 10956
## + tenure:age 1 131900 110415949 10956
## + educ:south 1 129305 110418544 10956
## + IQ:urban 1 114289 110433561 10956
## + IQ:educ 1 97607 110450242 10956
## + tenure:urban 1 96942 110450907 10956
## + IQ:black 1 89715 110458135 10956
## + age:married 1 81771 110466079 10956
## + exper:black 1 75974 110471876 10956
## + hours:married 1 71498 110476351 10957
## + hours:black 1 62424 110485425 10957
## + educ:age 1 62318 110485531 10957
## + exper:age 1 54545 110493305 10957
## + married:black 1 51560 110496290 10957
## + exper:urban 1 49432 110498418 10957
## + IQ:KWW 1 46118 110501732 10957
## + hours:educ 1 45908 110501942 10957
## + KWW:exper 1 41964 110505885 10957
## + IQ:tenure 1 40064 110507785 10957
## + educ:tenure 1 34325 110513525 10957
## + hours:IQ 1 33455 110514394 10957
## + urban:sibs 1 28521 110519329 10957
## + KWW:sibs 1 27308 110520541 10957
## + IQ:married 1 22101 110525748 10957
## + IQ:age 1 17949 110529901 10957
## + KWW:tenure 1 16701 110531149 10957
## + exper:tenure 1 16371 110531478 10957
## + exper:sibs 1 13302 110534548 10957
## + tenure:married 1 12583 110535266 10957
## + IQ:south 1 12007 110535843 10957
## + age:black 1 10266 110537584 10957
## + south:sibs 1 7088 110540761 10957
## + tenure:sibs 1 5061 110542788 10957
## + hours:urban 1 4108 110543742 10957
## + exper:married 1 3968 110543882 10957
## + age:urban 1 2041 110545809 10957
## + married:urban 1 1795 110546055 10957
## + married:south 1 1081 110546769 10957
## + educ:sibs 1 980 110546870 10957
## + KWW:urban 1 593 110547256 10957
## + hours:exper 1 438 110547411 10957
## + age:south 1 197 110547652 10957
## + KWW:south 1 53 110547797 10957
## - hours:age 1 660743 111208593 10959
## - tenure 1 681596 111229446 10959
## - educ:exper 1 714187 111262037 10959
## - IQ 1 1000072 111547921 10962
## - hours:south 1 1052421 111600271 10962
## - black 1 1101064 111648913 10962
## - KWW:educ 1 2199037 112746887 10972
## - married 1 2599903 113147753 10975
## - urban 1 4709989 115257838 10992
##
## Step: AIC=10952.13
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black
##
## Df Sum of Sq RSS AIC
## + educ:urban 1 554648 109397460 10949
## + IQ:exper 1 506033 109446074 10950
## - sibs 1 19457 109971565 10950
## + south:urban 1 419655 109532453 10951
## + married:sibs 1 386146 109565962 10951
## + age:sibs 1 369456 109582652 10951
## + tenure:black 1 339277 109612831 10951
## + black:south 1 279647 109672461 10952
## <none> 109952108 10952
## + hours:sibs 1 230458 109721650 10952
## + IQ:sibs 1 215984 109736123 10952
## + hours:tenure 1 211883 109740225 10952
## + exper:south 1 204404 109747704 10952
## + black:sibs 1 195739 109756369 10952
## + KWW:age 1 186375 109765733 10952
## + educ:married 1 156799 109795309 10953
## + tenure:age 1 143678 109808430 10953
## + black:urban 1 143529 109808579 10953
## + KWW:married 1 140712 109811396 10953
## + educ:south 1 134442 109817666 10953
## + IQ:urban 1 130450 109821658 10953
## + tenure:urban 1 118316 109833792 10953
## + tenure:south 1 118258 109833850 10953
## + hours:KWW 1 108321 109843787 10953
## + IQ:educ 1 102260 109849848 10953
## + educ:age 1 82409 109869699 10953
## + hours:married 1 75462 109876646 10954
## + exper:black 1 71424 109880684 10954
## + married:black 1 66723 109885385 10954
## + age:married 1 65114 109886994 10954
## + exper:urban 1 64681 109887427 10954
## + KWW:tenure 1 47457 109904651 10954
## + exper:age 1 41165 109910943 10954
## + hours:educ 1 40651 109911457 10954
## + IQ:tenure 1 40129 109911979 10954
## + hours:black 1 36389 109915719 10954
## + educ:tenure 1 36031 109916076 10954
## + KWW:exper 1 34017 109918091 10954
## + IQ:age 1 33417 109918691 10954
## + urban:sibs 1 26306 109925802 10954
## + educ:black 1 25930 109926178 10954
## + IQ:south 1 24050 109928058 10954
## + hours:IQ 1 19444 109932664 10954
## + south:sibs 1 18240 109933868 10954
## + tenure:married 1 16072 109936035 10954
## + exper:sibs 1 13792 109938316 10954
## + married:south 1 12694 109939413 10954
## + exper:tenure 1 12137 109939971 10954
## + KWW:south 1 10535 109941573 10954
## + IQ:married 1 9760 109942348 10954
## + hours:urban 1 6628 109945479 10954
## + KWW:urban 1 6229 109945878 10954
## + educ:sibs 1 6210 109945898 10954
## + tenure:sibs 1 5613 109946495 10954
## + KWW:sibs 1 3771 109948337 10954
## + married:urban 1 3308 109948800 10954
## + exper:married 1 2740 109949368 10954
## + age:urban 1 2032 109950076 10954
## + age:black 1 1703 109950405 10954
## + IQ:KWW 1 200 109951908 10954
## + IQ:black 1 147 109951960 10954
## + age:south 1 104 109952004 10954
## + hours:exper 1 102 109952006 10954
## - tenure 1 582305 110534412 10955
## - KWW:black 1 595742 110547850 10955
## - hours:age 1 656160 110608267 10956
## - educ:exper 1 672833 110624940 10956
## - hours:south 1 977443 110929551 10958
## - IQ 1 1028420 110980528 10959
## - KWW:educ 1 1696292 111648400 10964
## - married 1 2560152 112512260 10972
## - urban 1 4679040 114631147 10989
##
## Step: AIC=10949.4
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban
##
## Df Sum of Sq RSS AIC
## + IQ:exper 1 505093 108892366 10947
## - sibs 1 19527 109416987 10948
## + married:sibs 1 378315 109019144 10948
## + age:sibs 1 338296 109059163 10948
## + tenure:black 1 313688 109083772 10949
## + south:urban 1 293618 109103841 10949
## + black:south 1 293270 109104190 10949
## + hours:sibs 1 238947 109158513 10949
## <none> 109397460 10949
## + IQ:sibs 1 220113 109177347 10950
## + black:sibs 1 199314 109198146 10950
## + exper:south 1 199030 109198430 10950
## + KWW:age 1 193304 109204156 10950
## + educ:married 1 182244 109215215 10950
## + educ:south 1 178084 109219375 10950
## + hours:tenure 1 158154 109239306 10950
## + KWW:married 1 148352 109249108 10950
## + tenure:south 1 130815 109266644 10950
## + tenure:age 1 127071 109270389 10950
## + educ:age 1 123308 109274152 10950
## + IQ:educ 1 117014 109280445 10950
## + hours:KWW 1 94403 109303056 10951
## + tenure:urban 1 93411 109304049 10951
## + exper:black 1 89539 109307920 10951
## + hours:married 1 88851 109308609 10951
## + age:married 1 87240 109310219 10951
## + married:black 1 72449 109325010 10951
## + black:urban 1 68142 109329318 10951
## + educ:black 1 50821 109346638 10951
## + KWW:urban 1 50451 109347009 10951
## + hours:black 1 48628 109348832 10951
## + exper:age 1 45809 109351650 10951
## + KWW:exper 1 45394 109352065 10951
## + IQ:south 1 38425 109359035 10951
## + hours:educ 1 31954 109365506 10951
## + IQ:tenure 1 31626 109365833 10951
## + educ:tenure 1 29212 109368248 10951
## + KWW:tenure 1 28064 109369396 10951
## + KWW:south 1 24944 109372515 10951
## + south:sibs 1 24515 109372945 10951
## + IQ:age 1 24436 109373024 10951
## + hours:IQ 1 20075 109377384 10951
## + hours:urban 1 16748 109380711 10951
## + IQ:married 1 14435 109383025 10951
## + exper:urban 1 10859 109386600 10951
## + educ:sibs 1 10799 109386661 10951
## + married:south 1 9637 109387823 10951
## + tenure:sibs 1 9364 109388096 10951
## + exper:tenure 1 8763 109388697 10951
## + exper:sibs 1 7290 109390170 10951
## + tenure:married 1 5634 109391825 10951
## + age:south 1 3993 109393467 10951
## + IQ:urban 1 2829 109394631 10951
## + age:black 1 2448 109395011 10951
## + age:urban 1 2123 109395337 10951
## + exper:married 1 1264 109396196 10951
## + IQ:black 1 405 109397055 10951
## + KWW:sibs 1 305 109397154 10951
## + IQ:KWW 1 196 109397264 10951
## + married:urban 1 93 109397367 10951
## + urban:sibs 1 34 109397425 10951
## + hours:exper 1 1 109397459 10951
## - tenure 1 528788 109926247 10952
## - educ:urban 1 554648 109952108 10952
## - hours:age 1 624279 110021739 10953
## - educ:exper 1 674128 110071587 10953
## - KWW:black 1 694621 110092081 10953
## - hours:south 1 984400 110381860 10956
## - IQ 1 1127889 110525349 10957
## - KWW:educ 1 1431244 110828704 10960
## - married 1 2474614 111872074 10968
##
## Step: AIC=10947.08
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + sibs + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban + IQ:exper
##
## Df Sum of Sq RSS AIC
## - sibs 1 18534 108910900 10945
## + married:sibs 1 381996 108510370 10946
## + black:south 1 301685 108590681 10946
## + tenure:black 1 299788 108592578 10946
## + south:urban 1 288156 108604210 10947
## + KWW:age 1 283894 108608473 10947
## + age:sibs 1 263436 108628931 10947
## <none> 108892366 10947
## + educ:south 1 222612 108669755 10947
## + hours:sibs 1 193761 108698606 10947
## + KWW:married 1 185026 108707340 10948
## + educ:married 1 174946 108717420 10948
## + hours:tenure 1 170092 108722274 10948
## + KWW:exper 1 149029 108743337 10948
## + black:sibs 1 147544 108744822 10948
## + IQ:sibs 1 143621 108748745 10948
## + educ:age 1 142317 108750049 10948
## + tenure:south 1 139591 108752776 10948
## + tenure:age 1 107018 108785348 10948
## + exper:south 1 101277 108791089 10948
## + hours:married 1 100270 108792097 10948
## + tenure:urban 1 96412 108795954 10948
## + hours:KWW 1 95520 108796846 10948
## + age:married 1 82831 108809535 10948
## + married:black 1 63333 108829033 10948
## + black:urban 1 57468 108834898 10949
## + exper:age 1 55400 108836966 10949
## + IQ:married 1 54015 108838352 10949
## + IQ:age 1 52745 108839621 10949
## + IQ:south 1 48254 108844112 10949
## + hours:black 1 41513 108850854 10949
## + KWW:urban 1 37534 108854832 10949
## + educ:tenure 1 36106 108856260 10949
## + educ:sibs 1 31021 108861346 10949
## + hours:educ 1 30199 108862168 10949
## + south:sibs 1 29936 108862430 10949
## + hours:urban 1 24537 108867829 10949
## + KWW:south 1 19811 108872555 10949
## + hours:IQ 1 18599 108873767 10949
## + educ:black 1 18088 108874278 10949
## + KWW:tenure 1 15302 108877064 10949
## + exper:urban 1 13400 108878966 10949
## + IQ:educ 1 11675 108880691 10949
## + IQ:urban 1 11339 108881027 10949
## + tenure:sibs 1 10475 108881892 10949
## + married:south 1 8622 108883744 10949
## + IQ:black 1 8353 108884013 10949
## + age:black 1 6525 108885841 10949
## + tenure:married 1 5066 108887300 10949
## + IQ:tenure 1 4622 108887744 10949
## + age:urban 1 4113 108888253 10949
## + exper:black 1 1999 108890367 10949
## + exper:sibs 1 1514 108890852 10949
## + exper:married 1 1389 108890977 10949
## + IQ:KWW 1 1053 108891314 10949
## + KWW:sibs 1 1032 108891334 10949
## + urban:sibs 1 449 108891918 10949
## + hours:exper 1 398 108891968 10949
## + exper:tenure 1 297 108892069 10949
## + married:urban 1 35 108892331 10949
## + age:south 1 19 108892347 10949
## - IQ:exper 1 505093 109397460 10949
## - educ:urban 1 553708 109446074 10950
## - tenure 1 565987 109458354 10950
## - hours:age 1 654297 109546664 10951
## - KWW:black 1 770361 109662728 10952
## - hours:south 1 1039019 109931385 10954
## - educ:exper 1 1133904 110026270 10955
## - KWW:educ 1 1277132 110169498 10956
## - married 1 2510032 111402398 10966
##
## Step: AIC=10945.24
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban + IQ:exper
##
## Df Sum of Sq RSS AIC
## + black:south 1 305279 108605621 10945
## + tenure:black 1 294360 108616540 10945
## + south:urban 1 288402 108622498 10945
## + KWW:age 1 280039 108630861 10945
## <none> 108910900 10945
## + educ:south 1 225691 108685209 10945
## + KWW:married 1 188755 108722145 10946
## + educ:married 1 175523 108735377 10946
## + hours:tenure 1 164254 108746646 10946
## + KWW:exper 1 149097 108761803 10946
## + tenure:south 1 142289 108768611 10946
## + educ:age 1 141465 108769435 10946
## + tenure:age 1 107022 108803878 10946
## + exper:south 1 106247 108804653 10946
## + hours:KWW 1 98065 108812835 10946
## + hours:married 1 97440 108813460 10946
## + tenure:urban 1 96307 108814593 10946
## + age:married 1 79810 108831090 10947
## + married:black 1 63145 108847755 10947
## + exper:age 1 58854 108852046 10947
## + IQ:married 1 55207 108855693 10947
## + black:urban 1 52060 108858840 10947
## + IQ:south 1 50889 108860011 10947
## + IQ:age 1 49940 108860960 10947
## + hours:black 1 41036 108869864 10947
## + KWW:urban 1 36317 108874583 10947
## + educ:tenure 1 36177 108874723 10947
## + hours:educ 1 32017 108878883 10947
## + hours:urban 1 22860 108888040 10947
## + KWW:south 1 20173 108890727 10947
## + hours:IQ 1 19612 108891288 10947
## + sibs 1 18534 108892366 10947
## + educ:black 1 16763 108894137 10947
## + exper:urban 1 14733 108896167 10947
## + KWW:tenure 1 14096 108896804 10947
## + IQ:urban 1 12768 108898132 10947
## + IQ:educ 1 9628 108901272 10947
## + IQ:black 1 8341 108902559 10947
## + married:south 1 7190 108903710 10947
## + age:black 1 6480 108904420 10947
## + age:urban 1 4931 108905969 10947
## + IQ:tenure 1 4225 108906675 10947
## + tenure:married 1 4015 108906885 10947
## + exper:black 1 2096 108908804 10947
## + exper:married 1 1468 108909432 10947
## + IQ:KWW 1 1453 108909447 10947
## + hours:exper 1 382 108910518 10947
## + exper:tenure 1 365 108910535 10947
## + age:south 1 62 108910838 10947
## + married:urban 1 28 108910872 10947
## - IQ:exper 1 506087 109416987 10948
## - educ:urban 1 553639 109464539 10948
## - tenure 1 570102 109481002 10948
## - hours:age 1 648272 109559172 10949
## - KWW:black 1 751828 109662728 10950
## - hours:south 1 1062585 109973485 10952
## - educ:exper 1 1151590 110062490 10953
## - KWW:educ 1 1282127 110193027 10954
## - married 1 2503295 111414195 10964
##
## Step: AIC=10944.61
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban + IQ:exper + black:south
##
## Df Sum of Sq RSS AIC
## + KWW:age 1 298327 108307295 10944
## + tenure:black 1 265921 108339701 10944
## <none> 108605621 10945
## + south:urban 1 231570 108374052 10945
## + black:urban 1 176159 108429462 10945
## - black:south 1 305279 108910900 10945
## + educ:married 1 158943 108446679 10945
## + educ:south 1 154547 108451075 10945
## + KWW:exper 1 153713 108451908 10945
## + hours:tenure 1 145989 108459632 10945
## + educ:age 1 144489 108461132 10945
## + KWW:married 1 134822 108470800 10946
## + married:black 1 126803 108478818 10946
## + exper:south 1 123592 108482029 10946
## + tenure:age 1 117629 108487992 10946
## + tenure:south 1 113252 108492369 10946
## + hours:married 1 109572 108496049 10946
## + hours:KWW 1 92515 108513107 10946
## + tenure:urban 1 84909 108520712 10946
## + age:married 1 77821 108527800 10946
## + exper:age 1 61400 108544221 10946
## + IQ:age 1 52401 108553221 10946
## + hours:black 1 35522 108570100 10946
## + hours:educ 1 34496 108571125 10946
## + IQ:married 1 30322 108575299 10946
## + educ:tenure 1 26621 108579000 10946
## + hours:urban 1 21085 108584536 10946
## + age:black 1 20581 108585040 10946
## + KWW:urban 1 19983 108585638 10946
## + KWW:tenure 1 15772 108589850 10946
## + sibs 1 14940 108590681 10946
## + exper:urban 1 14449 108591173 10946
## + hours:IQ 1 12691 108592930 10946
## + married:south 1 11541 108594081 10946
## + tenure:married 1 8064 108597557 10946
## + IQ:educ 1 7581 108598040 10946
## + educ:black 1 7044 108598577 10947
## + age:urban 1 4554 108601068 10947
## + IQ:black 1 2551 108603070 10947
## + IQ:tenure 1 2095 108603526 10947
## + IQ:urban 1 2028 108603593 10947
## + exper:married 1 1309 108604312 10947
## + IQ:south 1 995 108604627 10947
## + exper:tenure 1 797 108604824 10947
## + married:urban 1 608 108605013 10947
## + IQ:KWW 1 605 108605016 10947
## + exper:black 1 355 108605267 10947
## + age:south 1 101 108605521 10947
## + hours:exper 1 52 108605569 10947
## + KWW:south 1 50 108605572 10947
## - IQ:exper 1 514459 109120080 10947
## - educ:urban 1 567525 109173147 10948
## - tenure 1 573785 109179407 10948
## - hours:age 1 618667 109224288 10948
## - KWW:black 1 777029 109382650 10949
## - hours:south 1 912034 109517656 10950
## - educ:exper 1 1134103 109739725 10952
## - KWW:educ 1 1223607 109829229 10953
## - married 1 2642563 111248184 10965
##
## Step: AIC=10944.04
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban + IQ:exper + black:south +
## KWW:age
##
## Df Sum of Sq RSS AIC
## + tenure:black 1 314372 107992923 10943
## <none> 108307295 10944
## + south:urban 1 219869 108087425 10944
## + educ:south 1 181442 108125853 10944
## + hours:tenure 1 172071 108135224 10945
## - KWW:age 1 298327 108605621 10945
## + black:urban 1 163759 108143536 10945
## - black:south 1 323567 108630861 10945
## + married:black 1 136031 108171263 10945
## + educ:married 1 136030 108171264 10945
## + tenure:age 1 127289 108180006 10945
## + tenure:south 1 123367 108183927 10945
## + hours:married 1 122822 108184473 10945
## + hours:KWW 1 119425 108187870 10945
## + exper:south 1 103727 108203567 10945
## + tenure:urban 1 100713 108206581 10945
## + KWW:married 1 87961 108219334 10945
## + exper:age 1 69598 108237696 10945
## + age:married 1 58226 108249069 10946
## + KWW:tenure 1 56214 108251081 10946
## + educ:age 1 53586 108253709 10946
## + hours:black 1 39243 108268052 10946
## + hours:educ 1 39216 108268079 10946
## + educ:tenure 1 37122 108270173 10946
## + KWW:urban 1 25920 108281375 10946
## + married:south 1 24550 108282744 10946
## + IQ:married 1 19593 108287702 10946
## + sibs 1 18425 108288870 10946
## + hours:IQ 1 17420 108289874 10946
## + hours:urban 1 16063 108291232 10946
## + KWW:exper 1 14868 108292427 10946
## + IQ:urban 1 8415 108298879 10946
## + tenure:married 1 7947 108299348 10946
## + educ:black 1 7860 108299434 10946
## + IQ:tenure 1 7749 108299546 10946
## + IQ:age 1 6286 108301009 10946
## + exper:urban 1 5623 108301672 10946
## + IQ:black 1 4501 108302793 10946
## + IQ:educ 1 3686 108303608 10946
## + IQ:south 1 2691 108304603 10946
## + married:urban 1 2686 108304608 10946
## + exper:black 1 1047 108306247 10946
## + age:black 1 826 108306468 10946
## + age:south 1 702 108306592 10946
## + exper:tenure 1 485 108306809 10946
## + exper:married 1 259 108307036 10946
## + IQ:KWW 1 214 108307081 10946
## + KWW:south 1 108 108307187 10946
## + age:urban 1 38 108307256 10946
## + hours:exper 1 1 108307294 10946
## - hours:age 1 500706 108808000 10946
## - tenure 1 526154 108833448 10947
## - educ:urban 1 576645 108883939 10947
## - IQ:exper 1 608701 108915996 10947
## - KWW:black 1 795200 109102495 10949
## - hours:south 1 847708 109155003 10949
## - educ:exper 1 911431 109218726 10950
## - KWW:educ 1 1158970 109466265 10952
## - married 1 2523426 110830721 10964
##
## Step: AIC=10943.32
## wage ~ hours + IQ + KWW + educ + exper + tenure + age + married +
## black + south + urban + KWW:educ + hours:south + educ:exper +
## hours:age + KWW:black + educ:urban + IQ:exper + black:south +
## KWW:age + tenure:black
##
## Df Sum of Sq RSS AIC
## <none> 107992923 10943
## + south:urban 1 226760 107766163 10943
## + educ:south 1 172188 107820735 10944
## - black:south 1 293261 108286184 10944
## + educ:married 1 152773 107840150 10944
## - tenure:black 1 314372 108307295 10944
## + black:urban 1 140382 107852540 10944
## + hours:tenure 1 131307 107861615 10944
## + tenure:urban 1 129164 107863758 10944
## + exper:south 1 127949 107864973 10944
## + hours:married 1 119348 107873574 10944
## + hours:KWW 1 116235 107876688 10944
## - KWW:age 1 346778 108339701 10944
## + KWW:married 1 104562 107888361 10944
## + tenure:age 1 96982 107895941 10944
## + exper:age 1 80304 107912619 10945
## + tenure:south 1 77999 107914923 10945
## + married:black 1 69989 107922933 10945
## + educ:age 1 58344 107934579 10945
## + hours:educ 1 40395 107952527 10945
## + age:married 1 36308 107956614 10945
## + IQ:married 1 34472 107958451 10945
## + KWW:urban 1 25931 107966991 10945
## + married:south 1 25172 107967751 10945
## + sibs 1 24630 107968293 10945
## + hours:black 1 22216 107970706 10945
## + hours:urban 1 19490 107973432 10945
## + age:black 1 18419 107974504 10945
## + educ:tenure 1 13074 107979849 10945
## + hours:IQ 1 12379 107980543 10945
## + IQ:age 1 12336 107980586 10945
## + KWW:exper 1 12234 107980689 10945
## + IQ:urban 1 11707 107981216 10945
## + IQ:tenure 1 9040 107983883 10945
## + educ:black 1 6092 107986830 10945
## + exper:black 1 5723 107987200 10945
## + KWW:tenure 1 5494 107987429 10945
## + tenure:married 1 5167 107987756 10945
## + IQ:educ 1 4939 107987984 10945
## + IQ:black 1 3222 107989700 10945
## + IQ:south 1 2497 107990426 10945
## + exper:urban 1 1973 107990950 10945
## + age:south 1 1677 107991246 10945
## + KWW:south 1 1673 107991250 10945
## + married:urban 1 973 107991950 10945
## + exper:tenure 1 694 107992228 10945
## + IQ:KWW 1 355 107992568 10945
## + exper:married 1 343 107992579 10945
## + hours:exper 1 205 107992717 10945
## + age:urban 1 75 107992847 10945
## - hours:age 1 501050 108493973 10946
## - educ:urban 1 550444 108543367 10946
## - IQ:exper 1 601609 108594531 10946
## - KWW:black 1 705363 108698286 10947
## - hours:south 1 816354 108809277 10948
## - educ:exper 1 929219 108922142 10949
## - KWW:educ 1 1172742 109165664 10951
## - married 1 2364942 110357865 10962
# The command "step" adds and subtracts coefficients to maximize a measure of
# goodness of fit.
summary(stepwise.model.interactions)
##
## Call:
## lm(formula = wage ~ hours + IQ + KWW + educ + exper + tenure +
## age + married + black + south + urban + KWW:educ + hours:south +
## educ:exper + hours:age + KWW:black + educ:urban + IQ:exper +
## black:south + KWW:age + tenure:black, data = wages)
##
## Residuals:
## Min 1Q Median 3Q Max
## -840.95 -217.56 -36.92 175.98 1972.19
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3557.21923 993.37267 3.581 0.00036 ***
## hours -40.59382 16.84503 -2.410 0.01616 *
## IQ 8.60609 2.62919 3.273 0.00110 **
## KWW -52.96021 19.81093 -2.673 0.00765 **
## educ -105.91470 32.69827 -3.239 0.00124 **
## exper -0.07971 22.30843 -0.004 0.99715
## tenure 3.69311 2.49869 1.478 0.13975
## age -73.93581 27.83318 -2.656 0.00804 **
## married 167.53913 37.46867 4.471 8.75e-06 ***
## black 237.42907 168.52142 1.409 0.15921
## south -416.46084 149.65943 -2.783 0.00550 **
## urban -178.50960 159.21454 -1.121 0.26250
## KWW:educ 2.25091 0.71486 3.149 0.00169 **
## hours:south 8.75759 3.33355 2.627 0.00876 **
## educ:exper 4.47284 1.59583 2.803 0.00517 **
## hours:age 1.02681 0.49890 2.058 0.03986 *
## KWW:black -11.40575 4.67067 -2.442 0.01480 *
## educ:urban 25.36348 11.75748 2.157 0.03125 *
## IQ:exper -0.48403 0.21463 -2.255 0.02435 *
## black:south -112.74961 71.60609 -1.575 0.11570
## KWW:age 0.92317 0.53916 1.712 0.08719 .
## tenure:black 11.87634 7.28489 1.630 0.10339
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 343.9 on 913 degrees of freedom
## Multiple R-squared: 0.2929, Adjusted R-squared: 0.2766
## F-statistic: 18 on 21 and 913 DF, p-value: < 2.2e-16