Write an R function to produce a confidence interval for the log odds ratio for a 2 by 2 table. Write it so it adds 1 to each cell by default if the cell frequencies are too small using the criterion in the textbook from table 2.3. Post the code for the function followed with a few illustrative examples. Include comments in the function that explain the arguments and how to specify them.
## Using R software
> ####
>
> Input =("
+ Injection.area Yes No
+ Placebo 189 10845
+ Aspirin 104 10933
+ ")
>
> Matriz = as.matrix(read.table(textConnection(Input),
+ header=TRUE,
+ row.names=1))
>
> Matriz
Yes No
Placebo 189 10845
Aspirin 104 10933
>
> ### Chi-square test
> chisq.test(Matriz)
Pearson's Chi-squared test with Yates' continuity correction
data: Matriz
X-squared = 24.429, df = 1, p-value = 7.71e-07
>
> ### G-test
>
> library(DescTools)
>
> GTest(Matriz,
+ correct="none") # "none" "williams" "yates"
Log likelihood ratio (G-test) test of independence without correction
data: Matriz
G = 25.372, X-squared df = 1, p-value = 4.727e-07
Comment: The estimated p-values form the Chi-square test and G-test is less than 0.05 level of significance. Hence, we can conclude that there is a significant association between the incidence of heart attacks and aspirin intake at 0.05 level of significance.
Write an R function to produce a confidence interval for the log odds ratio for a...