Function Repository Resource:

IntraclassCorrelation

Source Notebook

Find the intraclass correlation coefficient (ICC) of a list of lists

Contributed by: Katja Della Libera

ResourceFunction["IntraclassCorrelation"][lst]

returns the intraclass correlation coefficient (ICC) of the list of lists lst.

Details

The intraclass correlation is a measure of repeatability when a number of measurements are performed over time or by different observers.
The ICC r can be calculated as the group-level variance VG (variance in each of the subgroups) over the sum of group- and data-level (residual) variance VR. It is given by the formula .
Low intraclass correlation indicates that the value measured within each group is not significantly correlated and therefore has low repeatability.

Examples

Basic Examples (1) 

Calculate the repeatability of a list of three different quantities, where for each we have 4 measurements:

In[1]:=
ResourceFunction[
 "IntraclassCorrelation"][{{1, 0, 3, 10}, {100, 89, 102, 7}, {90, 400,
    380, 232}}]
Out[1]=

Scope (2) 

An example of a data set with high intraclass correlation:

In[2]:=
high = Table[# + RandomReal[{-1, 1}], RandomInteger[{3, 6}]] & /@ RandomReal[{-3, 3}, 20];
ResourceFunction["IntraclassCorrelation"][high]
Out[2]=

A plot of the highly repeatable values:

In[3]:=
ListPlot[Catenate[MapIndexed[{#2[[1]], #1} &, high, {2}]], Frame -> True, FrameLabel -> {"x", "y"}, PlotLabel -> StringJoin["ICC: ", ToString[ResourceFunction["IntraclassCorrelation"][high]]]]
Out[3]=

An example of data with low intraclass correlation:

In[4]:=
low = Table[# + RandomReal[{-3, 3}], RandomInteger[{3, 6}]] & /@ RandomReal[{-1, 1}, 20];
In[5]:=
ResourceFunction["IntraclassCorrelation"][low]
Out[5]=

A plot of the data:

In[6]:=
ListPlot[Catenate[MapIndexed[{#2[[1]], #1} &, low, {2}]], Frame -> True, FrameLabel -> {"x", "y"}, PlotLabel -> StringJoin["ICC: ", ToString[ResourceFunction["IntraclassCorrelation"][low]]]]
Out[6]=

Publisher

Katja Della Libera

Version History

  • 1.0.0 – 20 January 2021

License Information