Bước 1 Nhập data

library(readxl)
Raw_data= read_excel("/Users/hien/Library/CloudStorage/OneDrive-UGent/Rstudio/Raw_data.xlsx", 
     sheet = "Categorical", col_types = c("text", 
        "numeric", "numeric", "numeric", 
        "numeric"))
require(gmodels)
## Loading required package: gmodels

Bước 2

CrossTable(Raw_data$Gender)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  60 
## 
##  
##           |    Female |      Male | 
##           |-----------|-----------|
##           |        30 |        30 | 
##           |     0.500 |     0.500 | 
##           |-----------|-----------|
## 
## 
## 
## 
CrossTable(Raw_data$Hemorrhage)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  60 
## 
##  
##           |         0 |         1 | 
##           |-----------|-----------|
##           |        26 |        34 | 
##           |     0.433 |     0.567 | 
##           |-----------|-----------|
## 
## 
## 
## 
CrossTable(Raw_data$Gender,Raw_data$Hemorrhage,digits = 3)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## | Chi-square contribution |
## |           N / Row Total |
## |           N / Col Total |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  60 
## 
##  
##                 | Raw_data$Hemorrhage 
## Raw_data$Gender |         0 |         1 | Row Total | 
## ----------------|-----------|-----------|-----------|
##          Female |        11 |        19 |        30 | 
##                 |     0.308 |     0.235 |           | 
##                 |     0.367 |     0.633 |     0.500 | 
##                 |     0.423 |     0.559 |           | 
##                 |     0.183 |     0.317 |           | 
## ----------------|-----------|-----------|-----------|
##            Male |        15 |        15 |        30 | 
##                 |     0.308 |     0.235 |           | 
##                 |     0.500 |     0.500 |     0.500 | 
##                 |     0.577 |     0.441 |           | 
##                 |     0.250 |     0.250 |           | 
## ----------------|-----------|-----------|-----------|
##    Column Total |        26 |        34 |        60 | 
##                 |     0.433 |     0.567 |           | 
## ----------------|-----------|-----------|-----------|
## 
## 
CrossTable(Raw_data$Gender,Raw_data$Hemorrhage, chisq = T, fisher = T, digits = 3)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## | Chi-square contribution |
## |           N / Row Total |
## |           N / Col Total |
## |         N / Table Total |
## |-------------------------|
## 
##  
## Total Observations in Table:  60 
## 
##  
##                 | Raw_data$Hemorrhage 
## Raw_data$Gender |         0 |         1 | Row Total | 
## ----------------|-----------|-----------|-----------|
##          Female |        11 |        19 |        30 | 
##                 |     0.308 |     0.235 |           | 
##                 |     0.367 |     0.633 |     0.500 | 
##                 |     0.423 |     0.559 |           | 
##                 |     0.183 |     0.317 |           | 
## ----------------|-----------|-----------|-----------|
##            Male |        15 |        15 |        30 | 
##                 |     0.308 |     0.235 |           | 
##                 |     0.500 |     0.500 |     0.500 | 
##                 |     0.577 |     0.441 |           | 
##                 |     0.250 |     0.250 |           | 
## ----------------|-----------|-----------|-----------|
##    Column Total |        26 |        34 |        60 | 
##                 |     0.433 |     0.567 |           | 
## ----------------|-----------|-----------|-----------|
## 
##  
## Statistics for All Table Factors
## 
## 
## Pearson's Chi-squared test 
## ------------------------------------------------------------
## Chi^2 =  1.085973     d.f. =  1     p =  0.2973652 
## 
## Pearson's Chi-squared test with Yates' continuity correction 
## ------------------------------------------------------------
## Chi^2 =  0.6108597     d.f. =  1     p =  0.4344643 
## 
##  
## Fisher's Exact Test for Count Data
## ------------------------------------------------------------
## Sample estimate odds ratio:  0.5842966 
## 
## Alternative hypothesis: true odds ratio is not equal to 1
## p =  0.4348156 
## 95% confidence interval:  0.1817485 1.826674 
## 
## Alternative hypothesis: true odds ratio is less than 1
## p =  0.2174078 
## 95% confidence interval:  0 1.554517 
## 
## Alternative hypothesis: true odds ratio is greater than 1
## p =  0.9038416 
## 95% confidence interval:  0.2154139 Inf 
## 
## 
##