Calculate image intraclass correlation coefficient (I2C2) of balanced/unbalanced data using the trace method

```
I2C2.original(y, id = NULL, visit = NULL, J = NULL, I = NULL,
p = NULL, T = NULL, symmetric = FALSE, trun = FALSE,
twoway = TRUE, demean = TRUE)
```

y | An n by p data matrix containing n vectorized image data with p voxels. Each row contains one observed image data at a particular visit for one subject. Each column contains image values for all subjects and visits at a particular voxel. The rows are organized by subjects and then visits, EX) (Y11, Y12, Y21, Y22, ... , YI1 , YI2) |
---|---|

id | Vector of IDs, EX) c(1, 1, 2, 2, 3, 3, 4, 4, ... , I, I) |

visit | Vector of visits, EX) (1, 2, 1, 2, 1, 2, ... , 1, 2) |

J | Number of repetitions |

I | Number of subjects |

p | dimension of observed vectors Yij (e.g. number of grid points per function), EX) Number of voxels |

T | Vector of distance (in time) of each visit from baseline visit. If the length of time between visits is different for the subjects in the dataset then match visits according to their distance in time as given by T. If T == NULL, match observations from different clusters by visit number |

symmetric | if FALSE then the function uses the method of moments estimator formula; if TRUE, pairwise symmetric sum formula, default is FALSE |

trun | if TRUE, set negative I2C2 to zero |

twoway | a logical argument indicating whether a oneway or twoway mean subtraction is more appropriate for the problem. If FALSE, only the overall sample mean will be removed only; if TRUE, it will also remove visit specific means to avoid scanner or batch effects |

demean | if TRUE, include the demean step and output the demeaned dataset |

The output of the function is a list that contains the following elements. lambda: estimated I2C2 Kx: the trace of between-cluster variance operator Ku: the trace of within-cluster variance operator demean_y: if demean == TRUE, output the demeaned dataset

Shou, H, Eloyan, A, Lee, S, Zipunnikov, V, Crainiceanu, AN, Nebel, NB, Caffo, B, Lindquist, MA, Crainiceanu, CM (2013). Quantifying the reliability of image replication studies: the image intraclass correlation coefficient (I2C2). Cogn Affect Behav Neurosci, 13, 4:714-24.

Haochang Shou, Ani Eloyan, Seonjoo Lee, Vadim Zipunnikov, Adina N. Crainiceanu, Mary Beth Nebel, Brian Caffo, Martin Lindquist, Ciprian M. Crainiceanu