I’m trying to calculate multiple ICCs from a data frame created in R. The data frame contains over 2500 observations from 122 different persons. I need an ICC calculated for each person.
Creating a separate data frame for one person, I am able to calculate the ICC using the package irr in R:
data_edue_icc_212003 <- subset(data_edue, vp_id == 212003 ,
select = c(stress_sad : stress_tense))
icc(data_edue_icc_212003,
model = "twoway",
type = "agreement",
unit = "single")
These are the results:
Single Score Intraclass Correlation
Model: twoway
Type : agreement
Subjects = 19
Raters = 9
ICC(A,1) = 0.214
F-Test, H0: r0 = 0 ; H1: r0 > 0
F(18,89.3) = 4.37 , p = 1.35e-06
95%-Confidence Interval for ICC Population Values:
0.095 < ICC < 0.42
Instead of having to subset the data frame 122 times to isolate the data for one person, I want to apply ICC by row, grouping the data frame by ID.
I guess there is a quicker way to calculate ICCs all at once than calculating 122 ICCs on separate data frames. What I’m looking for is an output that could look like this:
Test ICC
ID1 (icc value)
ID2 (icc value)
...
Tabea Brandt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.