This question is related to chi square test for each row in data frame which was solved (but flagged incorrect stats. method thanks to @CathG). I have changed by approach - so the setup is rather different now. I have a data frame looking like this:
df <- data.frame(
item = c("red", "blue", "green", "orange", "yellow", "black", "purple"),
obs.1 = c(2,10,53,13,12,15,5),
obs.1expt = c(3,12,48,9,11,15,5),
obs.2 = c(3,12,45,2,7,17,5),
obs.2expt = c(3,14,40,3,9,20,5))
I now want to compare the numbers of observed and expected (expected = numbers expected to have been seen if each observer had spend the same time observing the process) between the two observers. Using a chi square I hope to answer if the two observers are equally efficient in detecting "items" of different color.
My question is how do I conduct a chisq() on each of the rows in the data frame and append the results (ch.sq and p) to the table. From what I understand I need I would need to input a matrix into chisq() - for the first row this would be (and than applied to all rows):
count | expt.count
obs.1 | 2 | 3
obs.2 | 3 | 3
This would than feed into chisq().