STATISTICA







STATISTICA BASIC Icc.stb

{ This program will calculate intraclass correlation coefficients for estimating interrater reliability, following methods outlined in the following article:
Shrout, P.E. & Fleiss, J.L. (1979). Intraclass correlations: Uses in assessing rater reliability.
Psychological Bulletin, 86,420-428.

On execution, a variable selection dialog will appear. Two or more variables (i.e., two or more raters' ratings) from the currently active Statistica data file must be selected or an error message is displayed and the program terminates. If case selection conditions are currently in effect, they will be recognized by this program and reported along with the other results. After variables are selected and the user clicks on OK, the program builds a data matrix using only cases with no missing data on the selected variables, and calculates some intermediate variables. If there are many cases or many variables selected this phase can take some time (the Statistica status bar in the lower left will show "processing"). Then another dialog appears asking the user to specify which of three models (described in the article) to use. Models can be selected individually, or all three can be selected for the report.

Output from the program is a simple text report, which will be directed to the currently selected output device. If output is turned off, a new text window will open to receive the results. The first part of the report will include the status of case selection conditions, the number of cases used in the analysis, and a list of the selected variables. Following that will be values for the intermediate terms that are common to all three ICC models. Finally, the selected intraclass correlations are shown, along with the F statistic and significance level for the ANOVA model on which the ICC is based.

This program was written by Richard A. McLellan, Personnel Decisions International}


randomaccess;
NoDataFileVariableNames;

redim varids(nvars);

beep;
SelectVariables1 ('Select Variables', 2,nvars,varids, numvars, 'Variables to submit to ICC routine...');

if numvars < 2 then
	if DisplayMessageBox(MB_OK,'No Variables Selected','No variables were selected. Program will terminate.') =
IDOK then abort;

redim varids(numvars);

for i := 1 to ncases do
begin
if SelectionConditions (i) then

	begin
		for j := 1 to numvars do
		begin
			if valid(data(i,varids(j))) then hasvars := hasvars + 1;
		end;
		if ((hasvars / numvars) = 1) then valcases := valcases + 1;
		hasvars := 0;
	end;
end;


{beep;}

if valcases < 2 then
	if DisplayMessageBox(MB_OK,'Data Problem','Less than 2 cases with complete data. Program will terminate.') =
IDOK then abort;

WriteLn('------------------------------------------------------------------------');
WriteLn ('Total Cases in data file:  ',ncases);

{report on selection conditions...}
selon := SelectionConditionsGet (include, seltext$);
if selon then
begin
	Write ('Selection Conditions: ');
	if include then
		Write ('Included if ')
	else
		Write ('Excluded if ');
	WriteLn (seltext$,".");
end
else
	WriteLn ('Selection conditions are not in effect for this analysis.');

WriteLn ( valcases,'  Cases had complete data & will be used in the analysis.');
WriteLn ('The following ',numvars,' variables were selected for analysis:');
for i := 1 to numvars do
	WriteLn ('     ',varids(i),'  ',VarName(varids(i)));

{dimension array to contain valid data for the analysis}
redim iccdata(valcases,numvars);

{k is the case index for array iccdata}
k := 0;

{load the data array from the active data file}
for i := 1 to ncases do
	if SelectionConditions(i) then
	begin
		for j := 1 to numvars do
		begin
			if valid(data(i,varids(j))) then hasvars := hasvars + 1;
		end;
		if ((hasvars / numvars) = 1)  then
			begin
				k := k + 1;
				for j := 1 to numvars do
					iccdata(k,j) := data(i,varids(j));
			end;
	hasvars := 0;
	end;

{the following bit of code, when uncommented, just prints out the array iccdata
 so you can see the data the program selected...}
{WriteLn;
WriteLn ("Data Matrix:");
for i := 1 to valcases do
	begin
	for j := 1 to numvars do
		Write (iccdata(i,j),",");
		WriteLn;
	end;
WriteLn ("End of data matrix");}

{beep and ask user which type of ICC analysis to do...}
beep;

iccmodel := DisplayListBox('Select ICC Model','Shrout & Fleiss model 1|Shrout & Fleiss model 2|Shrout & Fleiss model
3|All 3 Models',1);
if iccmodel = 0 then
	if DisplayMessageBox(MB_OK,'Analysis Canceled','No ICC model was selected. Program will terminate.') = IDOK
then abort;

{compute terms needed for ICC analyses of all types}

MatrixSumOfSquares(iccdata,ssqtot);
for i := 1 to valcases do
	begin
		for j := 1 to numvars do
		begin
			rawsum := rawsum + iccdata(i,j);
		end;
	end;

cm := (rawsum^2) / (valcases * numvars);

ssbtwj := 0;
for j := 1 to numvars do
	begin
		for i := 1 to valcases do
			begin
				temp1 := temp1 + iccdata(i,j);
			end;
			temp2 := temp2 + (temp1^2 / valcases);
		temp1 := 0;
		end;

ssbtwj := temp2 - cm;
temp1 := 0;
temp2 := 0;

ssbtwt := 0;
for i := 1 to valcases do
	begin
		for j := 1 to numvars do
			begin
				temp1 := temp1 + iccdata(i,j);
			end;
		temp2 := temp2 + (temp1^2 / numvars);
		temp1 := 0;
	end;

ssbtwt := temp2 - cm;
temp1 := 0;
temp2 := 0;

msresid := (ssqtot - ssbtwj - ssbtwt - cm)/((valcases - 1)*(numvars - 1));
msbtwj := ssbtwj / (numvars - 1);
msbtwt := ssbtwt / (valcases - 1);
mswithint := ((msbtwj*(numvars-1)) + (msresid*(numvars-1)*(valcases - 1)))/(valcases * (numvars-1));

WriteLn;
WriteLn('Raw Sum = ',rawsum);
WriteLn ('Matrix sum of squares = ',ssqtot);
WriteLn('Correction for mean = ',cm);
WriteLn('Sum of squares between judges = ',ssbtwj);
WriteLn('Sum of squares between targets = ',ssbtwt);
WriteLn('Mean square - residual = ',msresid);
WriteLn('Mean square - between judges = ',msbtwj);
WriteLn('Mean square - between targets = ',msbtwt);
WriteLn('Mean square - within targets = ',mswithint);

if iccmodel = 1 then
	begin
		icc11 := (msbtwt - mswithint) / (msbtwt + (numvars - 1)*mswithint);
		icc1k := (msbtwt - mswithint) / msbtwt;
		f := msbtwt / mswithint;
		sig := 1 - ifdistr(f,(valcases-1),(valcases*(numvars-1)));
		WriteLn;
		WriteLn('ICC1,1 (single rater) = ',icc11);
		WriteLn('ICC1,k (mean of k raters) = ',icc1k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
		WriteLn('     -----END OF ANALYSIS-----');
	end;

if iccmodel = 2 then
	begin
		icc21 := (msbtwt - msresid)/(msbtwt+(numvars-1)*msresid+numvars*(msbtwj-msresid)/valcases);
		icc2k := (msbtwt - msresid)/(msbtwt+(msbtwj-msresid)/valcases);
		f := msbtwt / msresid;
		sig := 1 - ifdistr(f,(valcases-1),((valcases-1)*(numvars-1)));
		WriteLn;
		WriteLn('ICC2,1 (single rater) = ',icc21);
		WriteLn('ICC2,k (mean of k raters) = ',icc2k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
		WriteLn('     -----END OF ANALYSIS-----');
	end;

if iccmodel = 3 then
	begin
		icc31 := (msbtwt - msresid) / (msbtwt + (numvars - 1)*msresid);
		icc3k := (msbtwt - msresid) / msbtwt;
		f := msbtwt / msresid;
		sig := 1 - ifdistr(f,(valcases-1),((valcases-1)*(numvars-1)));
		WriteLn;
		WriteLn('ICC3,1 (single rater) = ',icc31);
		WriteLn('ICC3,k (mean of k raters) = ',icc3k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
		WriteLn('     -----END OF ANALYSIS-----');
	end;

if iccmodel = 4 then
begin
	begin
		icc11 := (msbtwt - mswithint) / (msbtwt + (numvars - 1)*mswithint);
		icc1k := (msbtwt - mswithint) / msbtwt;
		f := msbtwt / mswithint;
		sig := 1 - ifdistr(f,(valcases-1),(valcases*(numvars-1)));
		WriteLn;
		WriteLn('ICC1,1 (single rater) = ',icc11);
		WriteLn('ICC1,k (mean of k raters) = ',icc1k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
	end;

	begin
		icc21 := (msbtwt - msresid)/(msbtwt+(numvars-1)*msresid+numvars*(msbtwj-msresid)/valcases);
		icc2k := (msbtwt - msresid)/(msbtwt+(msbtwj-msresid)/valcases);
		f := msbtwt / msresid;
		sig := 1 - ifdistr(f,(valcases-1),((valcases-1)*(numvars-1)));
		WriteLn;
		WriteLn('ICC2,1 (single rater) = ',icc21);
		WriteLn('ICC2,k (mean of k raters) = ',icc2k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
	end;

	begin
		icc31 := (msbtwt - msresid) / (msbtwt + (numvars - 1)*msresid);
		icc3k := (msbtwt - msresid) / msbtwt;
		f := msbtwt / msresid;
		sig := 1 - ifdistr(f,(valcases-1),((valcases-1)*(numvars-1)));
		WriteLn;
		WriteLn('ICC3,1 (single rater) = ',icc31);
		WriteLn('ICC3,k (mean of k raters) = ',icc3k);
		WriteLn;
		WriteLn('F = ',f,'    Sig. of F = ',sig);
		WriteLn;
		WriteLn('     -----END OF ANALYSIS-----');
	end;
end;

beep;
Back to List of Programs



[StatSoft]
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217

[StatSoft]e-mail: info@statsoft.com

©Copyright StatSoft, Inc., 1984-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.