Contingency Table Question

#1

Novice user. I have 3 types of responses based on the device and treatment. If only two responses from the treatment with the particular device was recorded of the three, how do I get R to exclude the response?

For instance:
Responses are NF, AA, AD
only NF and AD were a response, AA was not. Out of 20 replicates, 2 of AA did not occur.

mosaicplot(Flight_Activation)

chisq.test(Flight_Activation,correct=FALSE)
Error in chisq.test(Flight_Activation, correct = FALSE) : invalid 'x'
chisq.test(flight$Response)
Error in if (any(x < 0) || anyNA(x)) stop("all entries of 'x' must be nonnegative and finite") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In Ops.factor(x, 0) : ‘<’ not meaningful for factors

0 Likes

#2

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

0 Likes

#3
(df<-data.frame(
  Batch.Label = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
  Device = as.factor(c("SVC", "SVC", "SVC", "GO", "GO", "GO", "40WI",
                       "40WI", "40WI", "15WFL", "15WFL",
                       "15WFL")),
  Screen = as.factor(c("c", "D", "E", "c", "D", "E", "c", "D", "E", "c",
                       "D", "E")),
  Response = as.factor(c("NF", "AD", "AD", "AD", "AA", "AA", "AD", "AA",
                         "AA", "AD", "AA", "AA"))
)
mytable<- table(df$Device,df$Screen,df$Response)
mytable
chisq.test(df,correct=FALSE))
0 Likes

closed #4

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes