У меня есть следующий набор данных
library(car)
library(ez)
dat <- structure(list(numbers = c(4, 4, 2, 2, 2, 2, 2, 4, 4, 2, 2, 2,
2, 4, 4, 2, 4, 2, 2, 2, 2, 2, 4, 2, 1, 1, 1, 3, 3, 3, 1, 3, 1,
1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 3, 3, 3, 3, 3, 1, 1, 3, 1,
3, 1, 3, 3, 3, 1, 3, 8, 6, 6, 6, 8, 8, 6, 6, 8, 8, 8, 6, 8, 8,
8, 6, 8, 8, 8, 6, 8, 8, 8, 8, 8, 8, 6, 8, 6, 8, 8, 6, 6, 6, 7,
7, 7, 7, 7, 7, 7, 9, 9, 7, 9, 9, 9, 9, 9, 7, 9, 9, 7, 9, 7, 9,
9, 9, 9, 9, 7, 9, 9, 7, 9, 9, 9, 7, 9, 9), condition = c("controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue", "controltrue", "controltrue", "controltrue", "controltrue",
"controltrue"), key = c("a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "g", "g", "g", "g", "g", "g", "g", "g",
"g", "g", "g", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "g", "g", "g", "g", "g", "g", "g",
"g", "g", "g", "g", "g", "g", "g", "g", "g", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "g", "g", "g", "g", "g",
"g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g",
"g", "g", "g", "g", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "g", "g", "g", "g",
"g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g", "g",
"g"), accuracy = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), RTs = c(0.433440075489,
0.584262928925, 0.900921091321, 0.650958113838, 0.384471354773,
0.484353395877, 0.367676318623, 0.80092431698, 0.600955694448,
0.417601027526, 0.416974943597, 0.334586234763, 0.351031572558,
0.450530192116, 0.916829419206, 0.333611185662, 0.517596335616,
0.384416737361, 0.684295259416, 0.750973949209, 0.767682843842,
0.450949169695, 0.466901118401, 0.334349070676, 0.450331150103,
0.650875638006, 0.767181023373, 0.516833524685, 0.317576028174,
0.434385433211, 1.43416476424, 0.984174514655, 0.684317253064,
0.484326637001, 0.550981133827, 0.551001294749, 0.500949389767,
1.33413536614, 0.384293939918, 0.416949284263, 0.384314100724,
0.484288514825, 0.450997555861, 0.550951809157, 0.617581746541,
0.650942718377, 0.767599268118, 0.53431109502, 0.451014050981,
1.11751613207, 1.08416322456, 0.667607259005, 0.567603520118,
0.567682696972, 0.634281843435, 0.334355668398, 0.334310948383,
0.417710262351, 0.784255377483, 0.550962439273, 0.750906869303,
0.434287562035, 0.417775876354, 0.384364685975, 0.434299658053,
0.484298411757, 0.483843877792, 0.666952216734, 0.417631818564,
0.434350610012, 0.350977688329, 0.501701937057, 0.434329716023,
0.401814764133, 0.517609531758, 0.3343586009, 0.500969551038,
0.46698616026, 0.484318206087, 0.6168882153, 0.416916294023,
0.401016396936, 0.634216595774, 0.400972409756, 0.81760022114,
0.417864584015, 0.501075852895, 0.484331035754, 0.467665028758,
0.867562685395, 0.43438396696, 0.467593549751, 0.517631158698,
0.367689514998, 0.450537156698, 0.716814610176, 0.467556160642,
0.400933554512, 0.417823895928, 0.900883702328, 0.834234703798,
0.36768218386, 0.40100246761, 0.450967864366, 0.550976368599,
0.45093743992, 0.484216302633, 0.500258058077, 0.61761400383,
1.11749157286, 0.501043595839, 0.484376122709, 0.500976148527,
0.351031939033, 0.517575074919, 0.784278837498, 0.867508801108,
1.01678257284, 0.51763152529, 0.5509294488, 0.617823675973, 0.767636657227,
0.450994256651, 0.734270920046, 0.734351563035, 0.800978201441,
0.517633358482, 0.450958700385, 0.400935020763, 0.484300611075,
0.417713195086, 0.584306549281, 0.367692081258, 0.384340859484,
0.600864421227, 0.367676685564, 0.351042935858, 0.317690394819,
0.384351123241, 0.450992057449, 0.484310508356, 0.816703982418,
0.916879637865, 0.516891807551, 0.417754616123, 0.501040663105,
0.451032012235, 0.384372383589, 0.550228953362, 0.567485487787,
0.484277151525, 0.500982380006), participant = c(5, 6, 10, 17,
21, 22, 27, 29, 29, 30, 32, 35, 38, 5, 10, 18, 18, 20, 20, 20,
22, 35, 37, 38, 1, 2, 4, 5, 7, 9, 10, 10, 11, 11, 11, 13, 13,
14, 14, 15, 15, 15, 15, 17, 19, 19, 20, 20, 20, 20, 20, 21, 23,
23, 24, 25, 25, 27, 28, 31, 31, 36, 37, 37, 37, 38, 1, 1, 11,
15, 18, 19, 21, 22, 23, 27, 28, 32, 33, 34, 37, 37, 1, 9, 11,
11, 19, 19, 22, 24, 26, 27, 34, 37, 1, 3, 5, 6, 8, 10, 10, 15,
15, 15, 15, 15, 16, 19, 19, 20, 22, 23, 31, 37, 38, 38, 2, 5,
7, 12, 17, 20, 22, 26, 26, 29, 29, 35, 35, 35, 36, 37, 37, 38,
4, 7, 7, 8, 8, 8, 10, 12, 12, 16, 18, 20, 21, 23, 24, 24, 24,
29), hand = c("left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "right",
"right", "right", "right", "right", "right", "right", "right",
"right", "right", "right", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "right", "right", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "right",
"right", "right", "right", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "left", "left", "left",
"left", "left", "left", "left", "left", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "right",
"right", "right", "right", "right", "right", "right", "right",
"right"), parity = c("even", "even", "even", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"even", "even", "even", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"even", "even", "even", "even", "even", "even", "even", "even",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd",
"odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd", "odd"
), magnitude = c("small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"small", "small", "small", "small", "small", "small", "small",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large",
"large", "large", "large", "large", "large", "large", "large"
)), row.names = c(NA, 152L), class = "data.frame")
Моя цель - выполнить факторный ANOVA 2x2. Мои два фактора будут hand и parity , а моя зависимая переменная будет точность , где 1 = правильно и 0 = ошибка. Я сосредотачиваюсь на ошибках для моей ANOVA, поэтому я отфильтровал так, чтобы остались только ошибки (0).
Кто-нибудь знает, как выполнить ANOVA для различий в количестве ошибок для моих факторов? Моя первая попытка вызвала ошибку:
ezANOVA(dat, dv = accuracy, wid = participant, within = .(parity, hand), type = 3, detailed = TRUE, return_aov = TRUE)
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within, :
One or more cells is missing data. Try using ezDesign() to check your data.
Я думаю, это потому, что все значения точности равны 0, тогда как я хочу проанализировать число из 0 (количество ошибок) для моего факториала ANOVA. Поэтому я попытался усреднить каждое условие и повторно запустить ANOVA, однако столкнулся с большим количеством проблем.
Я усредняю по предметам, поэтому я теряю переменную внутри предметов (поэтому я не могу использовать функцию ezANOVA) , Затем я пытаюсь использовать функции aov () и Anova (), но генерирую новую ошибку:
dat <- dat %>%
dplyr::group_by(parity, hand) %>%
dplyr::summarise(acc_num = n())
result <- aov(acc_num ~ parity * hand, data = dat)
Anova(result, type = 3)
Error in Anova.lm(mod, ...) : residual df = 0
Кто-нибудь знает, как я буду анализировать эти данные, используя ANOVA в R? Любая помощь наиболее ценится!