This is a dummy dataframe resembling my real-life data:
structure(list(cond = c("WT", "WT", "WT", "WT", "WT", "WT", "WT",
"WT", "WT", "WT", "WT", "WT", "WT", "WT", "WT", "WT", "WT", "WT",
"WT", "WT", "WT", "WT", "WT", "WT", "KO", "KO", "KO", "KO", "KO",
"KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO",
"KO", "KO", "KO", "KO"), class = c("N", "N", "N", "N", "N", "N",
"Y", "Y", "Y", "Y", "N", "N", "N", "N", "Y", "Y", "N", "Y", "N",
"N", "Y", "N", "Y", "N", "N", "N", "Y", "Y", "Y", "N", "N", "Y",
"N", "N", "N", "Y", "Y", "N", "N", "N", "N", "N", "N", "N"),
lattice = c(72.4394527831179, 70.1486049154573, 71.2024262282001,
70.095774734531, 73.1687587160835, 73.4725521658284, 71.1213324059112,
69.4426450566097, 67.7407461727878, 67.3598397689386, 69.5170866395342,
68.751790570905, 73.2734806165999, 72.0386374169852, 70.293510845974,
68.9576642114016, 69.4472846093111, 70.8520303262601, 69.967844969872,
69.7957750105144, 76.3165495002798, 70.8237308152673, 70.5087804854601,
70.0768856496865, 49.4569953395058, 52.0898768763027, 44.3112116723351,
53.0069841435797, 49.6755152863985, 50.3014101181505, 49.0856479592249,
48.3511098818039, 50.0812079766985, 50.4035212282794, 54.0992908724316,
43.4055868143946, 50.1834254159389, 54.7298925145524, 55.1516389972744,
51.4685454381875, 52.253317158648, 52.8558395390657, 51.5377616093217,
57.7792154694597)), row.names = c(NA, -44L), class = "data.frame")
Those are two experiment conditions ("WT" & "KO"). In each condition, observations might be classified as "Y" or "N" depending on whether the organism exhibits some measured trait or not.
I would like to compare those 2 groups (experimental conditions) & to infer, whether there is a statistically significant difference in amount of observations regarded as "Y" between the groups (and if it is the case, whether there are more or less "Y"-s in "KO" with respect to "WT" or not).
I do not know what type of statistical test would be more appropriate for this task: Fisher's, Chi-squared, etc.
Info: the "lattice" is another feature of the dataset, I am comparing this parameter between conditions using the Wilcoxon rank test. For this question it might be ignored. I just decided to show an entire structure of df, including this column.
EDITS:
- the experiment does not have fixed marginals.
- there was a time window, in which the data were collected.
- conditions are independent (those were cell-sorting experiments).
- afaik, this cannot be addressed with McNemar's test which is applicable for dependent variables, so the question was incorrectly assigned as duplicate.