Example 3: Calculate icc for an average unit
In this example, we are going to create a dataframe with 4 columns and calculate icc for two-way model with an average unit.
R
# load the library library (irr) # create dataframe with 4 columns data = data.frame (col1 = c (1:10), col2 = c (34:43), col3 = c (20:29), col4 = c (56:65)) # calculate icc for twoway model with average unit icc (data, model = "twoway" , type = "agreement" , unit = "average" ) |
Output:
In this output, As mentioned in the code, The model is oneway and Type is agreement
As there are four columns in the dataframe , so the Raters=4
In each column, the number of rows are 10 , so the Subjects = 10
The Intra correlation Coefficient (ICC) is 0.0639
The F-test value we got is -5.44 exp and the p value is 1
Finally, we got the 95% Confidence Interval level is in between 0.005 to 0.257
How to Calculate Intraclass Correlation Coefficient in R?
In this article, we will discuss how to calculate the intraclass correlation coefficient in R Programming Language. Correlation is used to get the relationship between two variables.
- If the value is 1, then the relationship is a positive correlation
- If the value is -1, then the relationship is a negative correlation
- If the value is 0, then the relationship has no correlation
An intraclass correlation coefficient is used to get if elements can be rated reliably by different raters. The range starts from 0 and ends in 1.
we can use icc() method, It is available in irr package stands for interrater reliability
Syntax: icc(data, model, type, unit)
where,
- data is the input dataframe
- model is the type of model to use. there are two types oneway and twoway.
- type is the relationship to calculate between raters. Options include “consistency” or “agreement”
- unit is for analysis , which is a single or average
Return: It will return the following:
- model – The type of model – oneway or twoway
- type – The type of model which is agreement
- Subjects- Total number of data in each column of the dataframe
- Raters – The number of columns of the dataframe
- ICC value – Intra correlation coefficient value
- Ftest – F value and P value
- CI – Confidence Interval of the Correlated values.