Uses the ICC() function in the psych package to compute the ICC(2,1) on a stable subset of subjects. Note that this is equivalent to the ICC(A,1) See Intraclass correlation – A discussion and demonstration of basic features by Liljequist et al 2019. Also see documentation of the psych package.

compute_icc21(
  dat,
  PRO.score = NULL,
  time.var = NULL,
  subject.id = NULL,
  anchor = NULL,
  stable.score = NULL,
  first.timepoint = NULL,
  second.timepoint = NULL
)

Arguments

dat

dataframe with values

PRO.score

specify the COA/PRO score you want to compute ICC of. Can pass multiple scores, e.g. PRO.score = c('Y_comp', 'Y_mcar', 'Y_mar')

time.var

the time variable, should be an ordered factor

subject.id

the subject ID, should be a character variable

anchor

this is the anchor used to condition on the stable subset of subjects

stable.score

this is the anchor score that indicates the subject is stable. For example, use anchor = 'PGIS_delta' and stable.score = 0 to select the subset of stable sujects. Another example would be anchor = 'anchor.groups' and stable.score = 'Maintained'.

first.timepoint

specify the first timepoint to be used in the TRTR computation; default is the first timepoint in your time.var variable

second.timepoint

specifiy the second timepoint to be used in the TRTR computation; default is the final timepoint in your time.var variable

Value

returns a table icc.21 with the values