First of all, I beg you to excuse my lack of statistical knowledge. I am just a "basic user guy" trying to learn R software. Thus, some of my explanations might be unnacurate.
In order to learn about contrast of proportions I tried the following code (I used iris database for anyone to be able to replicate it easily and accurately):
data <- iris data$Length <- ifelse(data$Petal.Length > 3, "Long", "Short") data$Width <- ifelse(data$Petal.Width > 1, "Large", "Small") data$Sepal <- ifelse(data$Sepal.Length > 6, "Big", ifelse(data$Sepal.Length < 5, "Small", "Medium")) View(data) table_1x2 <- table(data$Length) table_1x2 prop.table(table_1x2) prop.test(table_1x2)$p.value chisq.test(table_1x2)$p.value table_2x2 <- table(data$Length, data$Width) table_2x2 prop.table(table_2x2) prop.test(table_2x2)$p.value chisq.test(table_2x2)$p.value table_3x2 <- table(data$Species, data$Length) table_3x2 prop.table(table_3x2) prop.test(table_3x2)$p.value chisq.test(table_3x2)$p.value table_3x3 <- table(data$Species, data$Sepal) table_3x3 prop.table(table_3x3) prop.test(table_3x3)$p.value chisq.test(table_3x3)$p.value
The result of all test are the same with two exceptions: table_3x3 and table_1x2. I thought that both test might be equivalents (although prop.test would not be suitable in 3x3 or larger tables) but I don't get why I am getting different p-values in the 1x2 table.