Firstly, let’s look at, how alcohol and cigarette consumption increases the risk of encountering cancer risk. For the sake of this purpose, I will find the probability of encountering cancer by dividing number of cases to number of controls.
esoph2 <- esoph %>% group_by(alcgp) %>% summarise(probability=sum(ncases)/sum(ncontrols))
ggplot(data = esoph2, aes(x = alcgp, y = probability, fill= alcgp)) + geom_bar(stat = "identity") +labs(x="alcohol consumption", y= "probability")
As it can be seen on the bar chart, probability of encountering with cancer increases with inclining alcohol consumption.
Then let’s figure out how does the probability change with cigarette usage.
esoph1 <- esoph %>% group_by(tobgp) %>% summarise(probability=sum(ncases)/sum(ncontrols))
ggplot(data = esoph1, aes(x = tobgp, y = probability, fill= tobgp)) + geom_bar(stat = "identity") +labs(x="tobacco consumption", y= "probability")
Both alcohol and tobacco consumption increases the risk of cancer.