chi-square test for a test cross 06-11-2014d1815 This test can help determine if observed ratios of discrete outcomes match the expected ratio of outcomes. Table of critical chi-square values here http://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm R code { chisq.test(c(75,29),p = c(3/4,1/4)) } R code { green<-75 white<-29 sum<-green+white ratio_of_green<-3/4 ratiogreen<-3/4 ratiowhite<-1/4 expectedgreen<-ratiogreen*sum cat("Expected number of Green Flowers",expectedgreen,fill=T) Expected number of Green Flowers 78 cat("Expected number of Green Flowers:",expectedgreen,fill=T) Expected number of Green Flowers: 78 cat("Expected number of Green Flowers",expectedgreen,fill = T) Expected number of Green Flowers 78 expectedwhite<-ratiowhite*sum cat("Expected number of Green Flowers:",expectedwhite,fill = T) Expected number of Green Flowers: 26 cat("Expected number of White Flowers:",expectedwhite,fill= T) Expected number of White Flowers: 26 zeroone<-75 zerotwo<-29 e1=expectedgreen e2=expectedwhite chi<-((zeroone-e1)^2/e1)+((zerotwo-e2)^2/e2) cat("Calculated value of Chi-square from data:",chi,fill = T) Calculated value of Chi-square from data: 0.4615385 } > Example 1.3.1 > green<-75 > white<-29 > sum<-green+white > ratio-oi-green<-3/4 > ratiogreen<-3/4 > ratiowhite<-1/4 > expectedgreen<-ratiogreen*sum > cat(“Expected number of Green Flowers:",expectedgreen,fiIl = T) Expected number of Green Flowers: 78 > expectedwhite<-ratiowhite*sum > cat("Expected number of Green o Fl wers:",expectedwhite.fi|l = T) Expected number of Green Flowers: 26 . > cat("Expected number of White Flowers:".9XD9Cl9dWhile.lll| = Tl Expected number of White Flowers: 26 > O1<-75 > O2<-29 > e1 = expectedgreen > e2 = expectedwhite > ohi<-((01-e1)“ 2/e1)+((O2-e2) " 2/e2) > oat(“Calculated value of Chi-square from data:",ohi,?l| = T) Calculated value of Chi-square from data: 0.4615385 It can also be done in the following way. > ohisq.test(o(75,29),p = o(3/4,1/4)) Chi-squared test for given probabilities data: o(75, 29) X—squared = 0.4615, df = 1, p-value = 0.4969