rStats.js v1.3.0
    Preparing search index...

    Function ICC

    • The six intraclass correlations of Shrout and Fleiss (1979), with their F tests and confidence intervals. Equivalent to psych::ICC(x, alpha, lmer) in R. Only complete data are accepted.

      x is an n × k matrix (an array of rows): the ratings of the k raters for each of the n subjects. The forms are ICC1 = (MSB − MSW)/(MSB + (k − 1)MSW) (one-way), ICC2 = (MSB − MSE)/(MSB + (k − 1)MSE + k(MSJ − MSE)/n) (two-way random raters, absolute agreement), ICC3 = (MSB − MSE)/(MSB + (k − 1)MSE) (two-way fixed raters, consistency), and their averages over k raters ICC1k, ICC2k, ICC3k. With lmer: true (the default, as psych) the mean squares are rebuilt from the REML estimates of the variance components of the two-way random model, which are not negative; where both ANOVA components are not negative they equal the ANOVA mean squares. psych fits that model with lme4, whose optimiser stops early (results about 1e-5 relative off); here the REML estimates are computed exactly, in closed form.

      ICC1, ICC3, ICC1k and ICC3k agree with icc (irr's forms); the interval of ICC2k is psych's (ICC2's bounds transformed by Spearman-Brown), not irr's (McGraw and Wong's average-agreement interval).

      Where the residual mean square is 0 (ratings that differ between raters by constants), the F statistics of ICC2 and ICC3 are Infinity with p-value 0, and ICC3, ICC3k and their bounds are 1.

      Parameters

      • x: readonly (readonly number[])[]

        An n × k matrix of ratings (array of rows), without missing values.

      • options: ICCOptions = {}

      Returns ICCResult

      See ICCResult.

      TypeError if x is not a matrix of numbers; RangeError for missing or infinite ratings (psych's REML path accepts missing ratings; here they are an error), fewer than 2 subjects or raters, ratings that are all equal or identical for every subject, or a level out of range.

      const r = ICC([[9, 2, 5, 8], [6, 1, 3, 2], [8, 4, 6, 8], [7, 1, 2, 6], [10, 5, 6, 9], [6, 2, 4, 7]]);
      r.results[1]!.ICC; // 0.28976377952755905 (ICC2)
      r.results[4]!.lower; // 0.07113681530250335 (ICC2k)