Research Question 1

#ISR X CPS 

#These numbers are from the table labeled ISR X CPS 

ISR_CPS <- matrix( 

    c(175470, 17270, 84, 42), 2, 2, # <- Update Numbers inside c() 

    byrow = TRUE,  

    dimnames = list(c("No ISR", "ISR"), c("No CPS", "CPS")) 

  ) 

chisq.test(ISR_CPS, correct = FALSE) 
## 
##  Pearson's Chi-squared test
## 
## data:  ISR_CPS
## X-squared = 91.551, df = 1, p-value < 2.2e-16

Research Question 2

#ISR X Race X CPS 

#These numbers are from the table labeled ISR X CPS X RACE 

ISR_CPS_RACE <- array(c( 

  # Enter Numbers in order of: 

  # No ISR - No CPS, ISR - No CPS, No ISR - CPS, ISR - CPS,    

  66439, 26, 4998, 9,    # White 

  13098, 22, 5479, 18,    # Black 

  52216, 12, 3551, 2,    # Hispanic 

  26486, 3, 725, 0,    # Asian/PI 

  17231, 21, 2517, 13),   # Other/Missing" 

  dim = c(2, 2, 5), 

  dimnames = list( 

    ISR = c("No", "Yes"), 

    CPS = c("None", "History"), 

    Race = c("White", "Black", "Hispanic", "Asian/PI", "Other/Missing") 

  ) 

) 

cmh <- mantelhaen.test(ISR_CPS_RACE) 

cmh 
## 
##  Mantel-Haenszel chi-squared test with continuity correction
## 
## data:  ISR_CPS_RACE
## Mantel-Haenszel X-squared = 31.43, df = 1, p-value = 2.067e-08
## alternative hypothesis: true common odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.961175 4.283476
## sample estimates:
## common odds ratio 
##          2.898387

Breslow Day Test of Assumptions:

DescTools::BreslowDayTest(ISR_CPS_RACE) 
## 
##  Breslow-Day test on Homogeneity of Odds Ratios
## 
## data:  ISR_CPS_RACE
## X-squared = 4.4537, df = 4, p-value = 0.3481

Odds Ratios for ISR and CPS by Race

# Odds ratios 

odds <- vcd::oddsratio(ISR_CPS_RACE, log = FALSE) 

odds 
##  odds ratios for ISR and CPS by Race 
## 
##         White         Black      Hispanic      Asian/PI Other/Missing 
##      4.765016      1.965485      2.940532      5.215418      4.297827
# Confidence Intervals 

confint(odds) 
##                   2.5 %     97.5 %
## White         2.2695447  10.004377
## Black         1.0616319   3.638863
## Hispanic      0.7559821  11.437744
## Asian/PI      0.2691502 101.060973
## Other/Missing 2.1732410   8.499433
# P values 

summary(odds) 
## 
## z test of coefficients:
## 
##               Estimate Std. Error z value Pr(>|z|)   
## White          4.76502    1.80326  2.6425 0.008231 **
## Black          1.96549    0.61767  3.1821 0.001462 **
## Hispanic       2.94053    2.03790  1.4429 0.149042   
## Asian/PI       5.21542    7.88741  0.6612 0.508463   
## Other/Missing  4.29783    1.49525  2.8743 0.004049 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1