options nocenter nodate nonumber linesize=100 pagesize=500; title;
/* Velicer's Minimum Average Partial (MAP) Test
There are two ways of running this program:
Method 1: You can enter a correlation matrix directly
into the program (i.e., without having SAS save and then
read a matrix file), as in the example below for
Harman's data. Simply call the data matrix "cr",
as in the example.
Method 2: You can have the program read a correlation
matrix that was saved by the PROC CORR procedure, as in:
proc corr data = trial outp = work.filename; run;
You must then use the same filename (e.g., 'work.filename')
in the USE command within the MAP program itself. These
commands are now merely comments and will not run unless
the "/*"s in the first and last collumns are removed.
Any other "CR =" statements must also be removed from the
program (e.g., remove Harman's data in the example below). */
proc iml;
reset noname;
cr = {
1.00000 0.67286 0.60676 0.68446 0.70347 0.61349 0.54715 0.61545,
0.67286 1.00000 0.60871 0.74068 0.69020 0.66866 0.56444 0.60951,
0.60676 0.60871 1.00000 0.60293 0.56569 0.58218 0.67120 0.57813,
0.68446 0.74068 0.60293 1.00000 0.63845 0.65602 0.63191 0.67328,
0.70347 0.69020 0.56569 0.63845 1.00000 0.73925 0.65713 0.73686,
0.61349 0.66866 0.58218 0.65602 0.73925 1.00000 0.70310 0.77624,
0.54715 0.56444 0.67120 0.63191 0.65713 0.70310 1.00000 0.70370,
0.61545 0.60951 0.57813 0.67328 0.73686 0.77624 0.70370 1.00000 };
nvars = ncol(cr);
call eigen (eigval,eigvect,cr);
loadings = eigvect * sqrt(diag(eigval));
fm = j(nvars,2,-9999);
fm[1,2] = (ssq(cr) - nvars)/(nvars*(nvars-1));
fm4 = fm;
fm4[1,2] = (sum(cr##4)-nvars)/(nvars*(nvars-1));
do m = 1 to nvars - 1;
a = loadings[,1:m];
partcov = cr - (a * t(a));
d = diag( 1 / (sqrt(vecdiag(partcov))) );
pr = d * partcov * d;
fm[m+1,2] = (ssq(pr)-nvars) / (nvars*(nvars-1));
fm4[m+1,2] = (sum(pr##4)-nvars)/(nvars*(nvars-1));
end;
/* identifying the smallest fm value & its location (= the of factors) */
minfm = fm[1,2];
nfacts = 0;
minfm4 = fm4[1,2];
nfacts4 = 0;
do s = 1 to nrow(fm);
fm[s,1] = s - 1;
if ( fm[s,2] < minfm ) then do;
minfm = fm[s,2];
nfacts = s - 1;
end;
if ( fm4[s,2] < minfm4 ) then do;
minfm4 = fm4[s,2];
nfacts4 = s - 1;
end;end;
print, "Velicer's Minimum Average Partial (MAP) Test:";
print, "Eigenvalues", eigval[format=12.4];
labels = (" "||"squared"||"power4");
print,, "Average Partial Correlations", (fm || fm4[,2]) [colname=labels format=f12.4];
print, "The smallest average squared partial correlation is", minfm[format=f12.4];
print, "The smallest average 4rth power partial correlation is", minfm4[format=f12.4];
print, "The Number of Components According to the Original (1976) MAP Test is", nfacts[format=f12.4];
print, "The Number of Components According to the Revised (2000) MAP Test is", nfacts4[format=f12.4];
quit;
/* References.
the original MAP test:
Velicer, W. F. (1976). Determining the number of components
from the matrix of partial correlations. Psychometrika, 41, 321-327.
the revised (2000) MAP test i.e., with the partial correlations
raised to the 4rth power (rather than squared):
Velicer, W. F., Eaton, C. A., and Fava, J. L. (2000). Construct
explication through factor or component analysis: A review and
evaluation of alternative procedures for determining the number
of factors or components. Pp. 41-71 in R. D. Goffin and
E. Helmes, eds., Problems and solutions in human assessment
Boston: Kluwer.
the present programs:
O'Connor, B. P. (2000). SPSS and SAS programs for determining
the number of components using parallel analysis and Velicer's
MAP test. Behavior Research Methods, Instrumentation, and
Computers, 32, 396-402. */