janitor, dplyr, gtsummary, rstatix, and base

Evans <- read_csv("Evans.csv")

Se convierten variables

Evans <- read_csv("Evans.csv")
Evans$chd = as.character(Evans$chd)
Evans$chd = factor(Evans$chd)
Evans$chd = if_else(Evans$chd == "1", "y", "n")

Pruebas de normalidad

shapiro.test(Evans$age) 
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$age
## W = 0.94475, p-value = 2.765e-14
shapiro.test(Evans$chl)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$chl
## W = 0.98575, p-value = 1.153e-05
shapiro.test(Evans$sbp)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$sbp
## W = 0.91819, p-value < 2.2e-16
shapiro.test(Evans$dbp)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$dbp
## W = 0.95458, p-value = 9.367e-13

Prueba de normalidad para la presiĂ³n arterial diastĂ³lica

shapiro.test(Evans$dbp)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$dbp
## W = 0.95458, p-value = 9.367e-13

Prueba de normalidad para la presiĂ³n arterial sistĂ³lica

shapiro.test(Evans$sbp)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$sbp
## W = 0.91819, p-value < 2.2e-16

Primer cuartil, mediana y tercer cuartil de PresiĂ³n arterial sistĂ³lica

Evans %>% 
  group_by(chd) %>% 
  summarise(
    p25 = quantile(sbp, probs = 0.25, na.rm=T),
    p50 = quantile(sbp, probs = 0.5, na.rm=T),
    p75 = quantile(sbp, probs = 0.75, na.rm=T)
        )
## # A tibble: 2 Ă— 4
##   chd     p25   p50   p75
##   <chr> <dbl> <dbl> <dbl>
## 1 n      124    140   158
## 2 y      136.   152   164

Ho: la presiĂ³n arterial sistĂ³lica no estĂ¡ asociada a IAM

wilcox.test(sbp ~ chd, data = Evans)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  sbp by chd
## W = 14260, p-value = 0.0005143
## alternative hypothesis: true location shift is not equal to 0

Primer cuartil, mediana y tercer cuartil de PresiĂ³n arterial diastĂ³lica

Evans %>% 
  group_by(chd) %>% 
  summarise(
    p25 = quantile(dbp, probs = 0.25, na.rm=T),
    p50 = quantile(dbp, probs = 0.5, na.rm=T),
    p75 = quantile(dbp, probs = 0.75, na.rm=T)
        )
## # A tibble: 2 Ă— 4
##   chd     p25   p50   p75
##   <chr> <dbl> <dbl> <dbl>
## 1 n        80    90   98 
## 2 y        85    94  104.

Ho: la presiĂ³n arterial diastĂ³lica no estĂ¡ asociada a IAM

wilcox.test(dbp ~ chd, data = Evans)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  dbp by chd
## W = 15172, p-value = 0.004786
## alternative hypothesis: true location shift is not equal to 0

La edad tiene una distribuciĂ³n normal

shapiro.test(Evans$chl)
## 
##  Shapiro-Wilk normality test
## 
## data:  Evans$chl
## W = 0.98575, p-value = 1.153e-05
kruskal.test(age ~chd, Evans)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  age by chd
## Kruskal-Wallis chi-squared = 10.096, df = 1, p-value = 0.001486
kruskal.test(sbp ~chd, Evans)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  sbp by chd
## Kruskal-Wallis chi-squared = 12.065, df = 1, p-value = 0.0005136
kruskal.test(dbp ~chd, Evans)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  dbp by chd
## Kruskal-Wallis chi-squared = 7.9606, df = 1, p-value = 0.004781
kruskal.test(chl ~chd, Evans) 
## 
##  Kruskal-Wallis rank sum test
## 
## data:  chl by chd
## Kruskal-Wallis chi-squared = 5.4504, df = 1, p-value = 0.01956

Ho ExposiciĂ³n no estĂ¡ asociada al desenlace

fisher.test(Evans$cat, Evans$chd)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  Evans$cat and Evans$chd
## p-value = 0.0002049
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.614783 4.985252
## sample estimates:
## odds ratio 
##    2.85516
chisq.test(Evans$smk, Evans$chd)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  Evans$smk and Evans$chd
## X-squared = 4.8353, df = 1, p-value = 0.02788
fisher.test(Evans$ecg, Evans$chd)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  Evans$ecg and Evans$chd
## p-value = 0.01012
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.164222 3.463796
## sample estimates:
## odds ratio 
##   2.018467
chisq.test(Evans$sescat3, Evans$chd)
## 
##  Pearson's Chi-squared test
## 
## data:  Evans$sescat3 and Evans$chd
## X-squared = 1.7422, df = 2, p-value = 0.4185

Ho: las catecolaminas altas no estĂ¡n asociadas al IAM

infarto = cs(Evans$chd, Evans$cat)
## 
##           Exposure
## Outcome    Non-exposed Exposed Total
##   Negative 443         95      538  
##   Positive 44          27      71   
##   Total    487         122     609  
##                                     
##            Rne         Re      Rt   
##   Risk     0.09        0.22    0.12 
## 
##                                          Estimate Lower95ci Upper95ci
##  Risk difference (attributable risk)     0.13     0.06      0.19     
##  Risk ratio                              2.45     1.56      3.86     
##  Attr. frac. exp. -- (Re-Rne)/Re         0.59                        
##  Attr. frac. pop. -- (Rt-Rne)/Rt*100 %   22.5                        
##  Number needed to harm (NNH)             7.64     5.37      17.21    
##    or 1/(risk difference)
print(infarto)
## NULL

Ho: El consumo de tabaco o cigarrillo no estĂ¡ asociado al IAM

infarto2 = cs(Evans$chd, Evans$smk)
## 
##           Exposure
## Outcome    Non-exposed Exposed Total
##   Negative 205         333     538  
##   Positive 17          54      71   
##   Total    222         387     609  
##                                     
##            Rne         Re      Rt   
##   Risk     0.08        0.14    0.12 
## 
##                                          Estimate Lower95ci Upper95ci
##  Risk difference (attributable risk)     0.06     0.01      0.12     
##  Risk ratio                              1.82     1.07      3.1      
##  Attr. frac. exp. -- (Re-Rne)/Re         0.45                        
##  Attr. frac. pop. -- (Rt-Rne)/Rt*100 %   34.32                       
##  Number needed to harm (NNH)             15.88    8.38      77.77    
##    or 1/(risk difference)
print(infarto2)
## NULL

Ho: El electrocardiograma alterado no estĂ¡ asociado al IAM

infarto3 = cs(Evans$chd, Evans$ecg)
## 
##           Exposure
## Outcome    Non-exposed Exposed Total
##   Negative 401         137     538  
##   Positive 42          29      71   
##   Total    443         166     609  
##                                     
##            Rne         Re      Rt   
##   Risk     0.09        0.17    0.12 
## 
##                                          Estimate Lower95ci Upper95ci
##  Risk difference (attributable risk)     0.08     0.02      0.13     
##  Risk ratio                              1.84     1.16      2.92     
##  Attr. frac. exp. -- (Re-Rne)/Re         0.46                        
##  Attr. frac. pop. -- (Rt-Rne)/Rt*100 %   18.68                       
##  Number needed to harm (NNH)             12.52    7.56      59.83    
##    or 1/(risk difference)
print(infarto3)
## NULL

Ho: La presiĂ³n aerterial sistĂ³lica no estĂ¡ asociada al IAM

wilcox.test(sbp ~ chd, data = Evans)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  sbp by chd
## W = 14260, p-value = 0.0005143
## alternative hypothesis: true location shift is not equal to 0

`

Ho: La presiĂ³n arterial diastĂ³lica no estĂ¡ asociada al IAM

wilcox.test(dbp ~ chd, data = Evans)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  dbp by chd
## W = 15172, p-value = 0.004786
## alternative hypothesis: true location shift is not equal to 0

Ho: El infarto es independiente del consumo de cigarrillo cuando ajusto por electrocardiograma anormal

infarto2 = mhor(Evans$chd, Evans$smk, Evans$ecg)
## 
## Stratified analysis by  Var3 
##                OR lower lim. upper lim. P value
## Var3 0       3.65      1.478      10.86 0.00203
## Var3 1       1.03      0.423       2.62 1.00000
## M-H combined 2.02      1.133       3.62 0.01595
## 
## M-H Chi2(1) = 5.81 , P value = 0.016 
## Homogeneity test, chi-squared 1 d.f. = 4.26 , P value = 0.039

## Ho: El infarto es independiente del nivel de catecolaminas cuando ajusto por electrocardiograma anormal

infarto3 = mhor(Evans$chd, Evans$cat, Evans$ecg)
## 
## Stratified analysis by  Var3 
##                OR lower lim. upper lim. P value
## Var3 0       3.06      1.242       7.04 0.00749
## Var3 1       1.92      0.795       4.78 0.14999
## M-H combined 2.38      1.333       4.23 0.00228
## 
## M-H Chi2(1) = 9.31 , P value = 0.002 
## Homogeneity test, chi-squared 1 d.f. = 0.66 , P value = 0.416

Ho: El infarto es independiente del nivel de catecolaminas cuando ajusto por la condiciĂ³n social

infarto4 = mhor(Evans$chd, Evans$cat, Evans$sescat3)
## 
## Stratified analysis by  Var3 
##                OR lower lim. upper lim.  P value
## Var3 1       9.32      3.531      25.11 1.41e-06
## Var3 2       1.17      0.421       2.95 8.19e-01
## Var3 3       2.29      0.557       8.33 1.72e-01
## M-H combined 2.74      1.632       4.61 5.70e-05
## 
## M-H Chi2(1) = 16.2 , P value = 0 
## Homogeneity test, chi-squared 2 d.f. = 11.1 , P value = 0.004

cc(Evans$chd, Evans$smk)

## 
##          Evans$smk
## Evans$chd   0   1 Total
##     n     205 333   538
##     y      17  54    71
##     Total 222 387   609
## 
## OR =  1.96 
## 95% CI =  1.1, 3.47  
## Chi-squared = 5.43, 1 d.f., P value = 0.02
## Fisher's exact test (2-sided) P value = 0.025
cc(Evans$chd, Evans$ecg)

## 
##          Evans$ecg
## Evans$chd   0   1 Total
##     n     401 137   538
##     y      42  29    71
##     Total 443 166   609
## 
## OR =  2.02 
## 95% CI =  1.21, 3.37  
## Chi-squared = 7.48, 1 d.f., P value = 0.006
## Fisher's exact test (2-sided) P value = 0.01