Hi RStudio Community. I am wrestling with a problem that was previously raised here but never seemed to actually get answered. It's also been posted on several other sites but none have been able to get to the root of my issue.
I am trying to run a repeated measures anova and I keep getting this error about NA's despite not having any NAs in my sample. Have tried to debug to no avail. Thank you in advance.
# Here is a segment of my dataset to recreate the example:
structure(list(record_id = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L), .Label = c("1", "2", "3", "4", "5",
"6", "7", "8", "9", "11", "13", "14", "15", "16", "17", "19",
"20", "21", "22", "23", "24", "25", "26", "27", "29", "30", "31",
"32", "34", "36", "37", "38", "39", "41", "42", "43", "44", "45",
"46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56",
"57", "59", "60", "62", "63", "64", "65", "66", "69", "70", "71",
"72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82",
"83", "84", "85", "86", "87", "88", "89", "90", "91", "93", "94",
"96", "97", "98", "99", "100", "101", "103", "104", "105", "106",
"107", "108", "109", "110", "111", "112", "113", "114", "115",
"116", "117", "118", "121", "122", "123", "124", "125", "126",
"127", "128", "129", "130", "131", "132", "133", "134", "136",
"137", "138", "139", "141", "142", "143", "144", "145", "146",
"147", "148", "149", "150", "151", "152", "153", "154", "156",
"158", "159", "161", "162", "163", "164", "165", "166", "167",
"168", "169", "171", "172"), class = "factor"), redcap_event_name = structure(c(2L,
3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L,
3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L), .Label = c("", "baseline_visit_arm_1",
"day_1_arm_1", "day_2_arm_1", "day_3_arm_1"), class = "factor"),
feelings_sum_indiv = c(105L, 94L, 90L, 70L, 69L, 63L, 89L,
69L, 72L, 80L, 52L, 41L, 40L, 39L, 36L, 35L, 43L, 42L, 40L,
54L, 67L, 60L, 59L, 65L, 42L, 50L, 40L, 40L), feelings_sqrt = c(10.2469507659596,
9.69535971483266, 9.48683298050514, 8.36660026534076, 8.30662386291807,
7.93725393319377, 9.4339811320566, 8.30662386291807, 8.48528137423857,
8.94427190999916, 7.21110255092798, 6.40312423743285, 6.32455532033676,
6.2449979983984, 6, 5.91607978309962, 6.557438524302, 6.48074069840786,
6.32455532033676, 7.34846922834953, 8.18535277187245, 7.74596669241483,
7.68114574786861, 8.06225774829855, 6.48074069840786, 7.07106781186548,
6.32455532033676, 6.32455532033676), feelings_recip = c(0.00952380952380952,
0.0106382978723404, 0.0111111111111111, 0.0142857142857143,
0.0144927536231884, 0.0158730158730159, 0.0112359550561798,
0.0144927536231884, 0.0138888888888889, 0.0125, 0.0192307692307692,
0.024390243902439, 0.025, 0.0256410256410256, 0.0277777777777778,
0.0285714285714286, 0.0232558139534884, 0.0238095238095238,
0.025, 0.0185185185185185, 0.0149253731343284, 0.0166666666666667,
0.0169491525423729, 0.0153846153846154, 0.0238095238095238,
0.02, 0.025, 0.025)), row.names = c(NA, 28L), class = "data.frame")
tmp %>% anova_test(dv = feelings_sum_indiv, wid = record_id, within = redcap_event_name)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases