title: “R Notebook”
output: html_notebook
This will help us to understand the characteristics of the variables in the data set which further assist in analysis of data.
library(Ecdat)
## Loading required package: Ecfun
##
## Attaching package: 'Ecfun'
## The following object is masked from 'package:base':
##
## sign
##
## Attaching package: 'Ecdat'
## The following object is masked from 'package:datasets':
##
## Orange
data(Workinghours)
str(Workinghours)
## 'data.frame': 3382 obs. of 12 variables:
## $ hours : int 2000 390 1900 0 3177 0 0 1040 2040 0 ...
## $ income : int 350 241 160 80 456 390 181 726 -5 78 ...
## $ age : int 26 29 33 20 33 22 41 31 33 30 ...
## $ education : int 12 8 10 9 12 12 9 16 12 11 ...
## $ child5 : int 0 0 0 2 0 2 0 2 0 1 ...
## $ child13 : int 1 1 2 0 2 0 0 1 3 1 ...
## $ child17 : int 0 1 0 0 0 0 1 0 0 0 ...
## $ nonwhite : int 0 0 0 0 0 0 0 0 0 0 ...
## $ owned : int 1 1 1 1 1 1 1 1 0 0 ...
## $ mortgage : int 1 1 0 1 1 1 0 1 0 0 ...
## $ occupation: Factor w/ 4 levels "other","mp","swcc",..: 3 1 3 1 3 1 3 2 4 1 ...
## $ unemp : int 7 4 7 7 7 7 7 3 4 5 ...
The purpose of this analysis is to better understand about the sample in terms of given characteristics.
summary(Workinghours)
## hours income age education
## Min. : 0 Min. :-139.0 Min. :18.00 Min. : 0.00
## 1st Qu.: 0 1st Qu.: 146.0 1st Qu.:28.00 1st Qu.:12.00
## Median :1304 Median : 247.0 Median :34.00 Median :12.00
## Mean :1135 Mean : 296.9 Mean :36.81 Mean :12.55
## 3rd Qu.:1944 3rd Qu.: 368.8 3rd Qu.:44.00 3rd Qu.:14.00
## Max. :5840 Max. :7220.0 Max. :64.00 Max. :17.00
## child5 child13 child17 nonwhite
## Min. :0.0000 Min. :0.0000 Min. :0.000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.000 1st Qu.:0.0000
## Median :0.0000 Median :0.0000 Median :0.000 Median :0.0000
## Mean :0.5074 Mean :0.5618 Mean :0.215 Mean :0.2957
## 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:0.000 3rd Qu.:1.0000
## Max. :4.0000 Max. :5.0000 Max. :6.000 Max. :1.0000
## owned mortgage occupation unemp
## Min. :0.000 Min. :0.0000 other:1314 Min. : 1.000
## 1st Qu.:0.000 1st Qu.:0.0000 mp : 962 1st Qu.: 4.000
## Median :1.000 Median :1.0000 swcc :1021 Median : 5.000
## Mean :0.681 Mean :0.5278 fr : 85 Mean : 5.641
## 3rd Qu.:1.000 3rd Qu.:1.0000 3rd Qu.: 7.000
## Max. :1.000 Max. :1.0000 Max. :30.000
hist(Workinghours$hours, main="Wife working hours in a year", xlab="Total yearly woking hours")
The above distribution is looks like a positively skewed bi modal distribution. It indicates that less than 500 hours and between 1500-2000 hours of work in a year were highly frequent in the distribution.
plot(density(Workinghours$income), main="Household income in 100 dollar")
rug(Workinghours$income)
The income distribution is a positively skewed distribution indicating that household income of major of the sample was less than 1500 hundred dollar.
plot(density(Workinghours$age), main="Wife age")
rug(Workinghours$age)
The age distribution is slightly positively skewed indicating that majority of the women were between the age range of 22 and 40 years.
plot(density(Workinghours$education), main="Wife education in year")
rug(Workinghours$education)
The distribution of education is negatively skewed indicating women with 12 years of education were highly frequent in the sample.
hist(Workinghours$child5, main="Children aged 0-5 years", xlab="Number of children")
hist(Workinghours$child13, main="Children aged 6-13 years", xlab="Number of children")
hist(Workinghours$child17, main="Children aged 14-17 years", xlab="Number of children")
The distribution suggests less than 1000 women having a child between 0 and 5 years, less than 500 women having 2 children of this age. Only few women had 3 or 4 children of this age. Almost similar distribution was observed in case of children aged between 6-13 years. Approximately 500 women had a child between the age rage of 14-17 years.
pie(table(Workinghours$occupation))
The chart indicates that approximately one fourth of the total women husband were manager or professional, another one fourth were sales worker or clerical or craftsman, very few were farm workers and rest of them were in some other occupations.
barplot(sort(table(Workinghours$nonwhite)))
The chart indicates that less than half of the women were non-white.
barplot(sort(table(Workinghours$owned)))
More than two third of the women had house owned by the household.
barplot(sort(table(Workinghours$mortgage)))
More than half of the houses were in mortgage.
plot(density(Workinghours$unemp), main="Frequency of local unemployment rate", xlab="Percentage of local unemployment rate")
rug(Workinghours$unemp)
In most cases, the rates of local unemployment were between 3 and 7%.
w1<-lm(hours~income, data = Workinghours)
summary(w1)
##
## Call:
## lm(formula = hours ~ income, data = Workinghours)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1216.2 -1052.5 170.8 799.4 4759.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1216.5210 21.9633 55.39 < 2e-16 ***
## income -0.2730 0.0531 -5.14 2.9e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 889.3 on 3380 degrees of freedom
## Multiple R-squared: 0.007757, Adjusted R-squared: 0.007463
## F-statistic: 26.42 on 1 and 3380 DF, p-value: 2.9e-07
The model w1 showed a significant negative correlation between wife working hours and household income. The result indicates that 100 dollar increase in household income results 0.273 hours decrease of work in a year.
w2<-lm(hours~age, data = Workinghours)
summary(w2)
##
## Call:
## lm(formula = hours ~ age, data = Workinghours)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1354.3 -923.9 173.3 770.4 4683.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1563.580 51.522 30.348 <2e-16 ***
## age -11.629 1.337 -8.695 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 882.9 on 3380 degrees of freedom
## Multiple R-squared: 0.02188, Adjusted R-squared: 0.02159
## F-statistic: 75.6 on 1 and 3380 DF, p-value: < 2.2e-16
The model w2 showed a significant negative correlation between wife working hours and wife age. The result indicates that every year increase in wife’s age results 11.62 hours decrease of work in a year.
w3<-lm(hours~age+income, data = Workinghours)
summary(w3)
##
## Call:
## lm(formula = hours ~ age + income, data = Workinghours)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1376.3 -927.8 168.1 771.3 4723.0
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1583.93066 51.76471 30.599 < 2e-16 ***
## age -10.66563 1.36334 -7.823 6.83e-15 ***
## income -0.18802 0.05374 -3.498 0.000474 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 881.4 on 3379 degrees of freedom
## Multiple R-squared: 0.02541, Adjusted R-squared: 0.02483
## F-statistic: 44.05 on 2 and 3379 DF, p-value: < 2.2e-16
The results of model w3 indicates that controlling for household income, every one year increase of wife’s age results 10.66 hours decrease of work in a year. On the other hand, controlling for age, every 100 dollar increase of household income results 0.19 hours decrease of work in a year.
w4<-lm( hours~education+age+income, data = Workinghours)
summary(w4)
##
## Call:
## lm(formula = hours ~ education + age + income, data = Workinghours)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1570.2 -882.1 115.1 753.3 4891.8
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 512.83260 103.08932 4.975 6.86e-07 ***
## education 78.23117 6.55535 11.934 < 2e-16 ***
## age -6.64203 1.37757 -4.822 1.49e-06 ***
## income -0.38699 0.05523 -7.007 2.93e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 863.6 on 3378 degrees of freedom
## Multiple R-squared: 0.06484, Adjusted R-squared: 0.06401
## F-statistic: 78.07 on 3 and 3378 DF, p-value: < 2.2e-16
The results of model w4 indicates that controlling for household income and wife age, every one year increase of wife’s education results 78.23 hours increase of work in a year. On the other hand, controlling for education and income, one year increase of wife age results 6.64 hours decreases of work in a year. When controlling for education and age, 100 dollar increase of household income results 0.38 hours decreases of work in a year.
w5<-lm( hours~education+age+income+unemp+occupation+child5+child13+child17+owned+nonwhite+mortgage, data = Workinghours)
summary(w5)
##
## Call:
## lm(formula = hours ~ education + age + income + unemp + occupation +
## child5 + child13 + child17 + owned + nonwhite + mortgage,
## data = Workinghours)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1772.0 -721.6 78.3 630.9 5337.0
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1363.31519 116.88540 11.664 < 2e-16 ***
## education 67.73889 6.57447 10.303 < 2e-16 ***
## age -19.40928 1.57629 -12.313 < 2e-16 ***
## income -0.44460 0.05461 -8.142 5.42e-16 ***
## unemp -25.42188 6.16526 -4.123 3.82e-05 ***
## occupationmp 7.49035 39.56159 0.189 0.8498
## occupationswcc 44.53966 34.91966 1.275 0.2022
## occupationfr -189.47773 90.92851 -2.084 0.0373 *
## child5 -385.98479 20.51836 -18.812 < 2e-16 ***
## child13 -123.79311 16.71943 -7.404 1.66e-13 ***
## child17 39.32726 28.28154 1.391 0.1644
## owned 11.08645 49.06172 0.226 0.8212
## nonwhite 136.38427 32.70156 4.171 3.11e-05 ***
## mortgage 208.36814 43.64143 4.775 1.88e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 808.2 on 3368 degrees of freedom
## Multiple R-squared: 0.1834, Adjusted R-squared: 0.1802
## F-statistic: 58.19 on 13 and 3368 DF, p-value: < 2.2e-16
Controlling for all other variables in the model w5, 1% increase in unemployment rate results 25.42 hours total decrease of working hours per year. In this model, husband occupation is significant only in case of farm-related work. Controlling for all other variables in the model w6, wives whose husband work in farm, work 189.48 hours less in a year compared to those whose husband work otherwise. When all other variables remain same, increase of 1 child between age 0-5 results 385.98 hours decrease of work in a year. When all other variables remain same, increase of 1 child between age 6-13 results 123.79 hours decrease of work in a year.
Controlling for all other variables in the model w5, on average non-white wife works 136.38 hours more in a year compared to white wife. Controlling for all other variables in the model w5, on average wife whose house is in mortgage works 208.37 hours more in a year compared to wife whose house is not in mortgage.
It is obvious from previous analysis that there is a significant difference in working hours of nonwhite and white wife. So, the purpose of the present analysis is to understand whether the variables influence differently in case of nonwhite and white wife’s working hours.
library(tidyverse)
## ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 2.2.1 ✔ purrr 0.2.4
## ✔ tibble 1.4.2 ✔ dplyr 0.7.4
## ✔ tidyr 0.8.0 ✔ stringr 1.2.0
## ✔ readr 1.1.1 ✔ forcats 0.2.0
## ── Conflicts ──────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
nonwhite <- Workinghours %>%
filter(nonwhite == 1)
white <- Workinghours %>%
filter(nonwhite == 0)
w6<-lm( hours~education+age+income+unemp+occupation+child5+child13+child17+owned+mortgage, data = nonwhite)
w7<-lm( hours~education+age+income+unemp+occupation+child5+child13+child17+owned+mortgage, data = white)
library(texreg)
## Version: 1.36.23
## Date: 2017-03-03
## Author: Philip Leifeld (University of Glasgow)
##
## Please cite the JSS article in your publications -- see citation("texreg").
##
## Attaching package: 'texreg'
## The following object is masked from 'package:tidyr':
##
## extract
screenreg(list(w6, w7))
##
## ========================================
## Model 1 Model 2
## ----------------------------------------
## (Intercept) 1267.71 *** 1472.99 ***
## (216.18) (137.78)
## education 72.19 *** 65.24 ***
## (11.75) (8.05)
## age -17.19 *** -20.62 ***
## (2.92) (1.89)
## income -0.14 -0.44 ***
## (0.22) (0.06)
## unemp -40.79 *** -17.40 *
## (10.53) (7.58)
## occupationmp 135.33 -27.90
## (83.98) (46.07)
## occupationswcc 68.73 7.06
## (59.46) (43.38)
## occupationfr -97.14 -208.34 *
## (199.95) (102.91)
## child5 -262.60 *** -449.25 ***
## (34.16) (25.69)
## child13 -97.78 *** -141.25 ***
## (27.65) (20.93)
## child17 39.85 34.33
## (46.96) (35.40)
## owned 1.66 -5.32
## (84.13) (60.65)
## mortgage 244.85 ** 206.88 ***
## (82.98) (51.89)
## ----------------------------------------
## R^2 0.19 0.19
## Adj. R^2 0.18 0.19
## Num. obs. 1000 2382
## RMSE 795.26 809.88
## ========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
The above findings suggested that whereas education, local unemployment rate and whether the house is on mortgage had greater influence on non-white wife working hours than white counterpart, whereas wife’s age and having children between 0-5 years and 6-13 years had a greater influence on white over non-white working hour. In addition, whereas significant negative relationship was found between household income and working hour of white wife, the relationship was not significant in case of nonwhite wife. Similarly, whereas significant negative relationship was found between husband’s farm related work and working hour of white wife, the relationship was not significant in case of nonwhite wife.
The previous analysis helps to understand the influence of one variable on wife working hours while controlling for the rest of the variables in the model. The purpose of present interaction model is to understand, whether the influence of age, education, household income, number of children on wife working hours differ by the factors of another variable for example, race.
w20nonwhite<- lm(hours ~ nonwhite*education, data = nonwhite)
w20white <- lm(hours ~ nonwhite*education, data = white)
screenreg(list( w20nonwhite, w20white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) -129.47 362.23 ***
## (128.92) (102.16)
## education 107.78 *** 59.76 ***
## (10.63) (7.83)
## -------------------------------------
## R^2 0.09 0.02
## Adj. R^2 0.09 0.02
## Num. obs. 1000 2382
## RMSE 837.50 887.70
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
The above results suggested significant positive relationship between education and working hours both in case of nonwhite and white wife. It suggested greater influence of education on nonwhite wife working hours relative to white wife. Every one year increases in education rests 107.78 hours and 59.76 hours increase in work among nonwhite and white wife respectively.
w21nonwhite<- lm(hours ~ nonwhite*age, data = nonwhite)
w21white <- lm(hours ~ nonwhite*age, data = white)
screenreg(list( w21nonwhite, w21white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1605.48 *** 1545.36 ***
## (92.24) (62.18)
## age -12.68 *** -11.19 ***
## (2.45) (1.60)
## -------------------------------------
## R^2 0.03 0.02
## Adj. R^2 0.03 0.02
## Num. obs. 1000 2382
## RMSE 867.95 889.41
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
The above results shows that age has almost similar effect on working hours of both non-white and white wife. It suggested that every year increase in age, yearly working hours decrease 12.68 hours and 11.19 hours in case of non-white and white wife respectively.
w22nonwhite<- lm(hours ~ nonwhite*income, data = nonwhite)
w22white <- lm(hours ~ nonwhite*income, data = white)
screenreg(list(w22nonwhite, w22white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1022.71 *** 1244.89 ***
## (50.41) (26.29)
## income 0.62 ** -0.34 ***
## (0.21) (0.06)
## -------------------------------------
## R^2 0.01 0.02
## Adj. R^2 0.01 0.01
## Num. obs. 1000 2382
## RMSE 875.59 891.57
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
The above results suggested that although household income is positively related with nonwhite wife working hours, the relationship is negative in case of white wife working hours. With 100 dollar increase in income results 0.62 hours yearly increase in work for non-white wife while it is decrease 0.34 hours yearly in case of white wife.
w23nonwhite<- lm(hours ~ nonwhite*child5, data = nonwhite)
w23white <- lm(hours ~ nonwhite*child5, data = white)
screenreg(list(w23nonwhite, w23white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1253.99 *** 1259.05 ***
## (34.25) (21.21)
## child5 -170.76 *** -279.41 ***
## (33.41) (24.47)
## -------------------------------------
## R^2 0.03 0.05
## Adj. R^2 0.02 0.05
## Num. obs. 1000 2382
## RMSE 868.26 874.86
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
w24nonwhite<- lm(hours ~ nonwhite*child13, data = nonwhite)
w24white <- lm(hours ~ nonwhite*child13, data = white)
screenreg(list(w24nonwhite, w24white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1196.15 *** 1168.50 ***
## (34.47) (21.66)
## child13 -67.87 * -76.44 ***
## (29.64) (22.60)
## -------------------------------------
## R^2 0.01 0.00
## Adj. R^2 0.00 0.00
## Num. obs. 1000 2382
## RMSE 877.24 896.35
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
w25nonwhite<- lm(hours ~ nonwhite*child17, data = nonwhite)
w25white <- lm(hours ~ nonwhite*child17, data = white)
screenreg(list(w25nonwhite, w25white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1146.64 *** 1114.76 ***
## (30.57) (19.88)
## child17 10.51 75.26 *
## (49.80) (37.99)
## -------------------------------------
## R^2 0.00 0.00
## Adj. R^2 -0.00 0.00
## Num. obs. 1000 2382
## RMSE 879.52 897.76
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Number of children aged 13 years or less is negatively related with working hours both in case of non-white and white wife. However, significant positive relationship has been found among number of children between 14-17 years and working hours only in case of white wife. Children aged 0-5 years have greater influence on working hours than other age groups. Increase of one children between age range of 0-5 years results 170.76 and 279.41 hours decrease while increase of one children between age range of 6-13 years results 67.87 and 76.44 hours decrease in yearly working hours among non-white and white wife respectively. On the other hand, increasing one child between 14-17 years results 75.26 hours increase in work in a year among white wife.
w26nonwhite<- lm(hours ~ nonwhite*unemp, data = nonwhite)
w26white <- lm(hours ~ nonwhite*unemp, data = white)
screenreg(list(w26nonwhite, w26white))
##
## =====================================
## Model 1 Model 2
## -------------------------------------
## (Intercept) 1494.36 *** 1231.34 ***
## (73.39) (48.82)
## unemp -57.45 *** -18.53 *
## (11.33) (8.24)
## -------------------------------------
## R^2 0.03 0.00
## Adj. R^2 0.02 0.00
## Num. obs. 1000 2382
## RMSE 868.43 897.55
## =====================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Although significant negative relationship was found between working hours and local unemployment rate, a greater effect of unemployment rate was found in case of non-white wife relative to the white wife. Whereas yearly working hours reduced by 57.45 hours in case of non-white wife with the increase of 1% unemployment rate, it was 18.53 hours in case of white wife.
The purpose of present interaction model is to understand, whether the influence of age, education, household income, number of children on wife working hours differ by mortgage and whether these interaction differ in case of nonwhite and white wife.
w30nonwhite<- lm(hours ~ mortgage*education, data = nonwhite)
w30white <- lm(hours ~ mortgage*education, data = white)
screenreg(list(w30nonwhite, w30white))
##
## ============================================
## Model 1 Model 2
## --------------------------------------------
## (Intercept) -348.55 * 92.15
## (158.83) (155.17)
## mortgage 749.21 ** 601.88 **
## (269.76) (208.63)
## education 119.50 *** 75.55 ***
## (13.34) (12.42)
## mortgage:education -44.98 * -36.72 *
## (22.02) (16.18)
## --------------------------------------------
## R^2 0.11 0.03
## Adj. R^2 0.11 0.03
## Num. obs. 1000 2382
## RMSE 830.36 884.66
## ============================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Above results suggested that in case of non-white, every one year increase in education results greater increase of yearly working hours among those whose houses were not in mortgage (119.50 hours) compared to those whose houses were in the mortgage (119.50-44.98 hours). Similar result was found in case of white wife. In case of white, every one year increase in education results greater increase of yearly working hours among those whose houses were not in mortgage (75.55 hours) compared to those whose houses were in the mortgage (75.55-36.72 hours)
w31nonwhite<- lm(hours ~ mortgage*age, data = nonwhite)
w31white <- lm(hours ~ mortgage*age, data = white)
screenreg(list(w31nonwhite, w31white))
##
## ======================================
## Model 1 Model 2
## --------------------------------------
## (Intercept) 1656.56 *** 1483.48 ***
## (109.84) (81.80)
## mortgage 11.31 58.49
## (196.79) (126.28)
## age -17.81 *** -12.36 ***
## (3.01) (2.05)
## mortgage:age 8.46 3.34
## (5.12) (3.25)
## --------------------------------------
## R^2 0.06 0.03
## Adj. R^2 0.06 0.03
## Num. obs. 1000 2382
## RMSE 853.38 885.02
## ======================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Above results suggested significant negative relationship between age and working hours of those wife whose houses were not in mortgage. Those whose houses were not in mortgage, one year increase of age results 17.81 hours and 12.36 hours decrease in work among nonwhite and white respectively.
w32nonwhite<- lm(hours ~ mortgage*income, data = nonwhite)
w32white <- lm(hours ~ mortgage*income, data = white)
screenreg(list(w32nonwhite, w32white))
##
## =========================================
## Model 1 Model 2
## -----------------------------------------
## (Intercept) 947.97 *** 1101.53 ***
## (63.14) (35.04)
## mortgage 338.69 ** 308.64 ***
## (110.06) (52.61)
## income 0.56 -0.31 ***
## (0.31) (0.08)
## mortgage:income -0.46 -0.21
## (0.43) (0.11)
## -----------------------------------------
## R^2 0.03 0.03
## Adj. R^2 0.02 0.03
## Num. obs. 1000 2382
## RMSE 868.94 883.67
## =========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Significant negative relationship was found between income and working hours only in case of white wife whose houses were not in mortgage.
w33nonwhite<- lm(hours ~ mortgage*child5, data = nonwhite)
w33white <- lm(hours ~ mortgage*child5, data = white)
screenreg(list(w33nonwhite, w33white))
##
## =========================================
## Model 1 Model 2
## -----------------------------------------
## (Intercept) 1162.15 *** 1120.92 ***
## (44.53) (32.11)
## mortgage 210.71 ** 241.80 ***
## (68.82) (42.55)
## child5 -181.97 *** -223.51 ***
## (41.04) (36.97)
## mortgage:child5 66.43 -102.56 *
## (69.83) (49.07)
## -----------------------------------------
## R^2 0.05 0.07
## Adj. R^2 0.04 0.06
## Num. obs. 1000 2382
## RMSE 860.13 869.13
## =========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
w34nonwhite<- lm(hours ~ mortgage*child13, data = nonwhite)
w34white <- lm(hours ~ mortgage*child13, data = white)
screenreg(list(w34nonwhite, w34white))
##
## ==========================================
## Model 1 Model 2
## ------------------------------------------
## (Intercept) 1080.97 *** 1034.88 ***
## (43.06) (31.72)
## mortgage 302.18 *** 247.03 ***
## (70.48) (43.17)
## child13 -61.32 -36.08
## (37.47) (37.31)
## mortgage:child13 -35.17 -88.23
## (60.25) (46.92)
## ------------------------------------------
## R^2 0.03 0.02
## Adj. R^2 0.03 0.02
## Num. obs. 1000 2382
## RMSE 867.38 890.36
## ==========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
w35nonwhite<- lm(hours ~ mortgage*child13, data = nonwhite)
w35white <- lm(hours ~ mortgage*child13, data = white)
screenreg(list(w35nonwhite, w35white))
##
## ==========================================
## Model 1 Model 2
## ------------------------------------------
## (Intercept) 1080.97 *** 1034.88 ***
## (43.06) (31.72)
## mortgage 302.18 *** 247.03 ***
## (70.48) (43.17)
## child13 -61.32 -36.08
## (37.47) (37.31)
## mortgage:child13 -35.17 -88.23
## (60.25) (46.92)
## ------------------------------------------
## R^2 0.03 0.02
## Adj. R^2 0.03 0.02
## Num. obs. 1000 2382
## RMSE 867.38 890.36
## ==========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Significant negative relationship was found between number of children aged 0-5 years and working hours of both white and non-white wife. The relationship was not significant in case of nonwhite wife whose houses were in the mortgage.
w36nonwhite<- lm(hours ~ mortgage*unemp, data = nonwhite)
w36white <- lm(hours ~ mortgage*unemp, data = white)
screenreg(list(w36nonwhite, w36white))
##
## ========================================
## Model 1 Model 2
## ----------------------------------------
## (Intercept) 1333.98 *** 1070.63 ***
## (91.01) (74.06)
## mortgage 372.68 * 247.85 *
## (152.42) (98.51)
## unemp -47.85 *** -8.72
## (13.71) (11.98)
## mortgage:unemp -19.97 -12.01
## (23.95) (16.49)
## ----------------------------------------
## R^2 0.05 0.01
## Adj. R^2 0.04 0.01
## Num. obs. 1000 2382
## RMSE 860.02 893.38
## ========================================
## *** p < 0.001, ** p < 0.01, * p < 0.05
Local unemployment was significantly related only in case of nonwhite wife whose houses were not in the mortgage.
Conclusion: Interaction model can provide useful complex and in depth understanding of data.