The Chi Square Test for Independence literally tests whether P(AB) is “close enough” to being equal to P(A) x P(B). For problem 6.9 in OpenStats, evaluate whether P(AB)=P(A)xP(B) strictly holds by calculating the marginal probabilities for each outcome and multiplying them together then comparing them to the joint probabilities. Should you expect strict equality to hold? Why or why not? Then conduct the Chi Square test using R. Post your solutions and code.

pj<- 348/400 ##Probability of finding a job within one year
pnj<- 1-pj ##Probabibility of not paj
pc<- 400/400 ##Probability of graduating college
pnc<- 1-pc ##Probability not pc
pj
## [1] 0.87
pnj
## [1] 0.13
pc
## [1] 1
pnc
## [1] 0
mp<- matrix(c(348,52,3915,585),2,2)
colnames(mp) <- c("Sample", "Assumption") ##Assuming that the percentage stays the same accross all population
rownames(mp) <- c("Found within year","Did not find within year") 
mp <-as.table(mp)
mp
##                          Sample Assumption
## Found within year           348       3915
## Did not find within year     52        585
chisq.test(mp)
## 
##  Pearson's Chi-squared test
## 
## data:  mp
## X-squared = 0, df = 1, p-value = 1

I believe I made an error in terms of the chi-squared calculation but I am unsure where/how