Calculating the ICC of a repeated measurements dataframe with missing values I got urinary concentrations from numerous rats with up to four repeated measurements per rat.
I want to compute the intraclass correlation (ICC) in order to assess the high or Low reproductibility of rat urination concentration over time.
I decided to compute ICC (1,1) following Shrout and Fleiss (1979; "Intraclass Correlations : Uses in Assessing Rater Reliability") because only rats are changing over time. For this, I'm using linear mixed models.
My problem is for the estimation of the variance between rats, the formulae is BMS-EMS/k, with k the numbers of judges. However, I don't have the same number of samples for every rats.
How can I calculate ICC using a dataframe where not all rats have the four repeated measurements?
 A: *

*One way to go around your question would be by imputting the missing values. For example, if most rats have 4 repeated measurements, then, you can impute missing values using missMDA::imputeMFA(). That is missing values imputation for a a multilevel factor analysis (MFA)(aka. PCA with repeated measurements), which can handle continuous and categorical data. Having said that, you might take into account that an ICC with only 4 repetitions might not give too much of additional information, but just give you an additional criteria to decide whether or not, the repeated measurements where relatively consistent over time.
Here you can find an example on how to set up a MFA:

http://factominer.free.fr/factomethods/multiple-factor-analysis.html
The dataframe needs to include rows as cases and columns as variables, where repreated measurements are presented as sets of columns. For example, if you measured body weight and urine four times, the dataframe (e.g. df_original) might have a first column of rat ID and eight columns of the repeated measurements, for example, 1_weight, 1_urine, 2_weight, 2_urine, 3_weight, 3_urine, 4_weight and 4_urine. Then, your code should look like:
    dfcompleted <- missMDA::imputeMFA(df_original, ncp=6, group=c(1, 2,2,2,2),
    type=c("n", "s", "s", "s", "s"),
    num.group.sup=c(1))



*Once the dataframe is complete, you can easily calculate ICC for each variable at a time, using the package 'psych'. For example, subset the dataframe with the four columns of weight  into a new dataframe(e.g. weight_1_4) and then, run the following code for not missing values:

results <- psych::ICC(weight_1_4, missing = FALSE)

You can select the outcome from:
results$results [n,]

where n should be replaced by the row number that gives your desired outcome.
