×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
下のspssのページをもとにした。
http://www.nyu.edu/its/statistics/Docs/intracls.html
下のページも参照。感謝
http://www.hs.hirosaki-u.ac.jp/~pteiki/research/stat/S/icc/
dat <- data.frame(
rater1=c(9,6,8,7,10,6),
rater2=c(2,1,4,1,5,2),
rater3=c(5,3,6,2,6,4),
rater4=c(8,2,8,6,9,7)
)
# psycパッケージのICC関数を使う。psychパッケージはマジ便利
library(psych)
ICC(dat)
## 勉強のため、ICCのコードの一部を貼り付けておく
x <- dat
n.obs <- dim(x)[1]
nj <- dim(x)[2]
x.s <- stack(x)
x.df <- data.frame(x.s, subs = rep(paste("S", 1:n.obs, sep = ""),
nj))
aov.x <- aov(values ~ subs + ind, data = x.df)
s.aov <- summary(aov.x)
stats <- matrix(unlist(s.aov), ncol = 3, byrow = TRUE)
MSB <- stats[3, 1]
MSW <- (stats[2, 2] + stats[2, 3])/(stats[1, 2] + stats[1,
3])
MSJ <- stats[3, 2]
MSE <- stats[3, 3]
(ICC1 <- (MSB - MSW)/(MSB + (nj - 1) * MSW)) # ICC1. Single raters absolute
(ICC2 <- (MSB - MSE)/(MSB + (nj - 1) * MSE + nj * (MSJ - MSE)/n.obs)) # ICC2. Single random raters
(ICC3 <- (MSB - MSE)/(MSB + (nj - 1) * MSE)) # ICC3. Single fixed raters
(ICC12 <- (MSB - MSW)/(MSB)) # ICC1k. Average random raters
(ICC22 <- (MSB - MSE)/(MSB + (MSJ - MSE)/n.obs)) # ICC2k. Average random raters
(ICC32 <- (MSB - MSE)/MSB) # ICC3k. Average fixed raters
head(x.df)
aov.x
s.aov
round(stats, 3)
alpha(dat) # 質問紙の信頼性係数を求めるときと同じだが、列には項目ではなく評定者がならぶ
http://www.nyu.edu/its/statistics/Docs/intracls.html
下のページも参照。感謝
http://www.hs.hirosaki-u.ac.jp/~pteiki/research/stat/S/icc/
dat <- data.frame(
rater1=c(9,6,8,7,10,6),
rater2=c(2,1,4,1,5,2),
rater3=c(5,3,6,2,6,4),
rater4=c(8,2,8,6,9,7)
)
# psycパッケージのICC関数を使う。psychパッケージはマジ便利
library(psych)
ICC(dat)
## 勉強のため、ICCのコードの一部を貼り付けておく
x <- dat
n.obs <- dim(x)[1]
nj <- dim(x)[2]
x.s <- stack(x)
x.df <- data.frame(x.s, subs = rep(paste("S", 1:n.obs, sep = ""),
nj))
aov.x <- aov(values ~ subs + ind, data = x.df)
s.aov <- summary(aov.x)
stats <- matrix(unlist(s.aov), ncol = 3, byrow = TRUE)
MSB <- stats[3, 1]
MSW <- (stats[2, 2] + stats[2, 3])/(stats[1, 2] + stats[1,
3])
MSJ <- stats[3, 2]
MSE <- stats[3, 3]
(ICC1 <- (MSB - MSW)/(MSB + (nj - 1) * MSW)) # ICC1. Single raters absolute
(ICC2 <- (MSB - MSE)/(MSB + (nj - 1) * MSE + nj * (MSJ - MSE)/n.obs)) # ICC2. Single random raters
(ICC3 <- (MSB - MSE)/(MSB + (nj - 1) * MSE)) # ICC3. Single fixed raters
(ICC12 <- (MSB - MSW)/(MSB)) # ICC1k. Average random raters
(ICC22 <- (MSB - MSE)/(MSB + (MSJ - MSE)/n.obs)) # ICC2k. Average random raters
(ICC32 <- (MSB - MSE)/MSB) # ICC3k. Average fixed raters
head(x.df)
aov.x
s.aov
round(stats, 3)
alpha(dat) # 質問紙の信頼性係数を求めるときと同じだが、列には項目ではなく評定者がならぶ
PR
Comment
Trackback
Trackback URL
Comment form