我有一個如下所示的資料集,但包含更多的行和組:
df2 <- data.frame(
"group" = c(1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5),
"R1" = c(1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0),
"R2" = c(1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0),
"R3" = c(1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0))
其中 R1、R2 和 R3 是不同的評分者。我想計算每組內的評分者間可靠性(編碼器間可靠性)。我怎么能回圈組來做到這一點?
我在這里發現了一個類似的問題:每個類別的評分者間可靠性,但沒有答案。我感謝任何幫助,即使它只是關于在沒有計算評估者間可靠性的情況下回圈組。
uj5u.com熱心網友回復:
我最近發現了這個優秀的tidycomm包。計算組上的 icr 尚未實作,但它與group_map.
library(tidyverse)
library(tidycomm)
df2 %>%
# tidycomm expects tidy data so we have to do some reshaping first
mutate(post_id = row_number()) %>%
pivot_longer(R1:R3, names_to = "coder_id", values_to = "code") %>%
# first group by, then apply the function once per group
group_by(group) %>%
group_map(.f = function(.x, .y) {
out <- test_icr(.x, unit_var = post_id, coder_var = coder_id, code)
add_column(out, group = .y$group, .before = 1L)
}) %>%
bind_rows()
#> # A tibble: 5 × 9
#> group Variable n_Units n_Coders n_Categories Level Agreement Holstis_CR
#> <dbl> <chr> <int> <int> <int> <chr> <dbl> <dbl>
#> 1 1 code 4 3 2 nominal 0.5 0.667
#> 2 2 code 3 3 2 nominal 0.667 0.778
#> 3 3 code 4 3 2 nominal 1 1
#> 4 4 code 4 3 2 nominal 0.5 0.667
#> 5 5 code 5 3 2 nominal 0.8 0.867
#> # … with 1 more variable: Krippendorffs_Alpha <dbl>
由reprex 包于 2022-03-23 創建(v2.0.1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/449703.html
上一篇:重構代碼以避免訓練回圈中的回圈?
