Research Question 1: Is there correlation between the age of women in the labor force and household income other than wifes income?


Research Question 2: Is there association between the college attendance of wives and husbands within families?


Data

options(width=70)
data()
data(package = .packages(all.available=TRUE))
library(carData)
mydata <- force(Mroz)

head(mydata)
##   lfp k5 k618 age  wc hc       lwg    inc
## 1 yes  1    0  32  no no 1.2101647 10.910
## 2 yes  0    2  30  no no 0.3285041 19.500
## 3 yes  1    3  35  no no 1.5141279 12.040
## 4 yes  0    3  34  no no 0.0921151  6.800
## 5 yes  1    2  31 yes no 1.5242802 20.100
## 6 yes  0    0  54  no no 1.5564855  9.859


Data explanation

  • Unit of observation: One married women

  • Sample size: 753

  • Definition of all variables:

    • fp: labor-force participation; a factor with levels: no; yes.

    • k5: number of children 5 years old or younger.

    • k618: number of children 6 to 18 years old.

    • age: in years.

    • wc: wife’s college attendance; a factor with levels: no; yes.

    • hc: husband’s college attendance; a factor with levels: no; yes.

    • lwg: log expected wage rate; for women in the labor force, the actual wage rate; for women not in the labor force, an imputed value based on the regression of lwg on the other variables.

    • inc: family income exclusive of wife’s income.

  • Source: Mroz, T. A. (1987) The sensitivity of an empirical model of married women’s hours of work to economic and statistical assumptions. Econometrica 55, 765–799.


Data manipulation and descriptive statistics

  • Converting categorical variables to factors

I wont use first variable since the only value shown is “yes”.

mydata$wcF <- factor(mydata$wc,
                       levels = c ("no", "yes"),
                       labels = c ("no", "yes"))
mydata$hcF <- factor(mydata$hc,
                       levels = c ("no", "yes"),
                       labels = c ("no", "yes"))


Descriptive statistics for the variables used in RESEARCH QUESTION 1
summary(mydata)
##   lfp            k5              k618            age          wc     
##  no :325   Min.   :0.0000   Min.   :0.000   Min.   :30.00   no :541  
##  yes:428   1st Qu.:0.0000   1st Qu.:0.000   1st Qu.:36.00   yes:212  
##            Median :0.0000   Median :1.000   Median :43.00            
##            Mean   :0.2377   Mean   :1.353   Mean   :42.54            
##            3rd Qu.:0.0000   3rd Qu.:2.000   3rd Qu.:49.00            
##            Max.   :3.0000   Max.   :8.000   Max.   :60.00            
##    hc           lwg               inc          wcF       hcF     
##  no :458   Min.   :-2.0541   Min.   :-0.029   no :541   no :458  
##  yes:295   1st Qu.: 0.8181   1st Qu.:13.025   yes:212   yes:295  
##            Median : 1.0684   Median :17.700                      
##            Mean   : 1.0971   Mean   :20.129                      
##            3rd Qu.: 1.3997   3rd Qu.:24.466                      
##            Max.   : 3.2189   Max.   :96.000
  • Min: 30.00 for variable age: The variable “age” has a minimum value of 30, suggesting that the dataset includes individuals with ages starting from 30 years and older, with no values below this threshold.
library (psych)
psych:: describe(mydata[ , c("age", "inc")])
##     vars   n  mean    sd median trimmed   mad   min max range skew
## age    1 753 42.54  8.07   43.0   42.32 10.38 30.00  60 30.00 0.15
## inc    2 753 20.13 11.63   17.7   18.62  8.24 -0.03  96 96.03 2.21
##     kurtosis   se
## age    -1.02 0.29
## inc     8.35 0.42
  • Sd: 8.07 for variabale age: On average, individual values in the dataset deviate from the mean by approximately 8.07 units, reflecting a moderate level of variability or dispersion among the data points.
  • Median: 17.7 for variable income: The median income, excluding the wife’s income, is 17.7, suggesting that half of the incomes in the dataset are below 17.7, and half are above, serving as a measure of the central value in the income distribution.


Descriptive statistics for the variables used in RESEARCH QUESTION 2
summary(mydata[, c("wcF","hcF")])
##   wcF       hcF     
##  no :541   no :458  
##  yes:212   yes:295
  • Among the observed cases, 212 wives have attended college (“yes”), while 541 wives have not attended college (“no”), illustrating the count or frequency of each category and giving a sense of the prevalence of wife’s college attendance in the dataset.

  • Among the observed cases, 295 husbands have attended college (“yes”), while 458 husbands have not attended college (“no”), illustrating the count or frequency of each category and providing insights into the prevalence of husband’s college attendance in the dataset.


Correlation analysis

To compute the Pearson correlation coefficient for a correlation analysis, it’s essential to ensure that certain assumptions are met beforehand.

Assumptions
  • Both variables are numeric. This assumption is met.
  • Errors are normally distributed. We assume this is also met, because the sample is big enough.
  • Linear relationship between the variables.

Reducing the size of the sample

set.seed(1) 
mydatasample <- mydata[sample(nrow(mydata), 250), ]
head(mydata)
##   lfp k5 k618 age  wc hc       lwg    inc wcF hcF
## 1 yes  1    0  32  no no 1.2101647 10.910  no  no
## 2 yes  0    2  30  no no 0.3285041 19.500  no  no
## 3 yes  1    3  35  no no 1.5141279 12.040  no  no
## 4 yes  0    3  34  no no 0.0921151  6.800  no  no
## 5 yes  1    2  31 yes no 1.5242802 20.100 yes  no
## 6 yes  0    0  54  no no 1.5564855  9.859  no  no
library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplotMatrix(mydatasample[ , c(-1, -2, -3, -5, -6, -7, -9, -10)], smooth= FALSE)

  • The scatter plot indicates a non-linear relationship between age and income (inc). Data points are widely scattered, deviating from a clear straight line. However, for this homework, we will assume linearity and calculate Pearson correlation coefficient.


cor(mydatasample$age, mydatasample$inc,
    method = "pearson",
    use = "complete.obs")
## [1] 0.1300861


  • The correlation coefficient (0.13) suggests a weak positive relationship between age and income (excluding wives). This means that, to a small extent, as age increases, there is a slight tendency for income (excluding wives) to also increase.


cor.test(mydatasample$age, mydatasample$inc,
         method = "pearson",
         use ="complete.obs")
## 
##  Pearson's product-moment correlation
## 
## data:  mydatasample$age and mydatasample$inc
## t = 2.0662, df = 248, p-value = 0.03985
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.006117819 0.250116365
## sample estimates:
##       cor 
## 0.1300861

H0: ρ = 0

H1: ρ =/=0

  • We reject null hypothesis ( at p=0.04) and conclude that there is correlation between the two variables.


Pearson Chi2 test for association between two categorical variables


The typical correlation coefficient is not suitable for analyzing the association between two categorical variables. Instead, it is more appropriate to analyze frequencies.

However, to conduct a valid Pearson Chi-square test, certain assumptions must be met.


Assumptions
  • Observations must be independent. This assumption is met.
  • All expected frequencies should exceed 1.
  • A maximum of 20% of expected frequencies can fall within the range of 1 to 5; however, it’s important to note that having expected frequencies below 5 may diminish the test’s power.


H0: There is no association between two categorical variables wife’s college attendance and husband’s college attendance.

H1: There is association between two categorical variables wife’s college attendance and husband’s college attendance.


results <- chisq.test (mydata$wcF, mydata$hcF, 
                      correct = TRUE) #Yates' correction 2x2 table

results
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  mydata$wcF and mydata$hcF
## X-squared = 210.69, df = 1, p-value < 2.2e-16
  • p-value is not greater than 5%, meaning that the null hypothesis can be rejected


Observed (empirical) frequency:

addmargins (results$observed)
##           mydata$hcF
## mydata$wcF  no yes Sum
##        no  417 124 541
##        yes  41 171 212
##        Sum 458 295 753


Expected (theoretical) frequency:

round(results$expected, 2)
##           mydata$hcF
## mydata$wcF     no    yes
##        no  329.05 211.95
##        yes 128.95  83.05

329.05 - If there is no association between two categorical variables we would expect to see 329.05 would see that married women did not attend college and have husbands who did not attend collage as well.

  • Since all expected frequencies are greater than 5, second assumption is met.

  • Since all expected frequencies are greater than 5, third assumption is also met.


Standardized residuals help determine if the differences between what actually happened and what was expected are statistically important.

round(results$res, 2)
##           mydata$hcF
## mydata$wcF    no   yes
##        no   4.85 -6.04
##        yes -7.74  9.65
  • 4.85: The actual number of married women who did not attend college and have husband who did not attend college as well is higher than expected. (Alfa= 0.1%)

  • Pearson’s Chi-squared test: Based on the sample data, we can reject the null hypothesis (p<0.001) and conclude that there is association between wife’s college attendance and husband’s college attendance.


addmargins(round(prop.table(results$observed), 3))
##           mydata$hcF
## mydata$wcF    no   yes   Sum
##        no  0.554 0.165 0.719
##        yes 0.054 0.227 0.281
##        Sum 0.608 0.392 1.000
  • 0.554 - Out of 753 married women, there are 55.4% (417/753) married women that did not attend college and have husbands who did not attend collage as well.
  • 0.227- Out of 753 married women, there are 22.7% (171/753) that did attend college and have husbands who did attend college as well.


addmargins(round(prop.table(results$observed, 1), 3), 2)
##           mydata$hcF
## mydata$wcF    no   yes   Sum
##        no  0.771 0.229 1.000
##        yes 0.193 0.807 1.000
  • 0.771 - Out of 541 married women that did not attend college, 77.1% (417/541) of them have husbands who did not attend college as well.
  • 0.193- Out of 212 married women who did attend college, 19.3% (41/212) of the have husbands who did not attend college.


addmargins(round(prop.table(results$observed, 2), 3), 1)
##           mydata$hcF
## mydata$wcF   no  yes
##        no  0.91 0.42
##        yes 0.09 0.58
##        Sum 1.00 1.00
  • 0.91 - Out of 458 married women who have husbands who did not attend college, 91% (417/458) of them did not attend college as well.
  • 0.58- Out of 295 married women who have husbands who did attend collage, 58% (171/295) of them did attend collage as well.


library(effectsize)
## 
## Attaching package: 'effectsize'
## The following object is masked from 'package:psych':
## 
##     phi
effectsize::cramers_v(mydata$wcF, mydata$hcF)
## Cramer's V (adj.) |       95% CI
## --------------------------------
## 0.53              | [0.47, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].


interpret_cramers_v(0.53)
## [1] "very large"
## (Rules: funder2019)
  • We can conclude that there is association between categorical variables wife’s college attendance and husband’s college attendance with very large effect (|r| = 0.53).


oddsratio(mydata$wcF, mydata$hcF)
## Odds ratio |        95% CI
## --------------------------
## 14.03      | [9.44, 20.83]


interpret_oddsratio(14.03)
## [1] "large"
## (Rules: chen2010)
  • The odds ratio of 14.03 indicates a “large” association between women attending college (wcF) and husbands attending college (hcF). In simple terms, women are significantly more likely to attend college when their husbands have also attended college.