/* Parallel Analysis program */ options nocenter nodate nonumber linesize=90; title; proc iml; reset noname; /* enter your specifications here */ Ncases = 305; Nvars = 8; Ndatsets = 10; percent = 95; /* Specify the desired kind of parellel analysis, where: 1 = principal components analysis 2 = principal axis/common factor analysis */ kind = 1 ; /* When seed = 0, the clock is used as the seed for the random number generations. This produces different random numbers on different runs of the program. To use the same random numbers on different runs of the program, set seed to a value other than 0 */ seed = 0; /************* End of user specifications ***********************/ /* set diagonal to a column vector module */ start setdiag(matname,vector); do i = 1 to nrow(matname); do j = 1 to ncol(matname); if (i = j) then; matname[i,j] = vector[i,1]; end;end; finish; /* row sums module */ start rsum(matname); rsums =j(nrow(matname),1); do rows = 1 to nrow(matname); dumr = matname[rows,]; rsums[rows,1]=sum(dumr); end; return(rsums); finish; /* principal components analysis */ if kind = 1 then do; /* computing random data correlation matrices & eigenvalues */ evals = j(nvars,ndatsets,-9999); nm1 = 1 / (ncases-1); do nds = 1 to ndatsets; x = normal(j(ncases,nvars,seed)) ; vcv = nm1 * (t(x)*x - ((t(x[+,])*x[+,])/ncases)); d = inv(diag(sqrt(vecdiag(vcv)))); evals[,nds] = eigval(d * vcv * d); end; end; /* principal axis/common factor analysis with SMCs on the diagonal */ if kind = 2 then do; /* computing random data correlation matrices & eigenvalues */ evals = j(nvars,ndatsets,-9999); nm1 = 1 / (ncases-1); do nds = 1 to ndatsets; x = normal(j(ncases,nvars,seed)) ; vcv = nm1 * (t(x)*x - ((t(x[+,])*x[+,])/ncases)); d = inv(diag(sqrt(vecdiag(vcv)))); r = d * vcv * d; smc = 1 - (1 / vecdiag(inv(r)) ); run setdiag(r,smc); evals[,nds] = eigval(r); end; end; /* identifying the eigenvalues corresponding to the desired percentile */ num = round((percent*ndatsets)/100); results = j(nvars,3,-9999); s = 1:nvars; results[,1] = t(s); do root = 1 to nvars; ranks = rank(evals[root,]); do col = 1 to ndatsets; if (ranks[1,col] = num) then do; results[root,3] = evals[root,col]; col = ndatsets; end; end; end; results[,2] = evals[,+] / ndatsets; print, "Parallel Analysis:"; if (kind = 1) then; print, "Principal Components"; if (kind = 2) then; print, "Principal Axis / Common Factor Analysis"; specifs = (ncases // nvars // ndatsets // percent); rlabels = {"Ncases" "Nvars" "Ndatsets" "Percent"}; print, "Specifications for this Run:", specifs[rowname=rlabels]; clabels={"Root" "Means" "Prcntyle"}; print, "Random Data Eigenvalues", results[colname=clabels format=12.6]; if (kind = 2) then do; print, "Compare the random data eigenvalues to the"; print, "real-data eigenvalues that are obtained from a"; print, "Common Factor Analysis in which the # of factors"; print, "extracted equals the # of variables/items, and the"; print, "number of iterations is fixed at zero (maxiter=0), as in:"; print, "proc factor data=trial priors=smc maxiter = 0; run; "; print, "Or use the 'rawpar.sas program' to obtain the "; print, "baseline real-data eigenvalues."; print,,, "Warning: Parallel analyses of adjusted correlation matrices"; print, "eg, with SMCs on the diagonal, tend to indicate more factors"; print, "than warranted (Buja, A., & Eyuboglu, N., 1992, Remarks on parallel"; print, "analysis. Multivariate Behavioral Research, 27, 509-540.)."; print, "The eigenvalues for trivial, negligible factors in the real"; print, "data commonly surpass corresponding random data eigenvalues"; print, "for the same roots. The eigenvalues from parallel analyses"; print, "can be used to determine the real data eigenvalues that are"; print, "beyond chance, but additional procedures should then be used"; print, "to trim trivial factors."; print,,, "Principal components eigenvalues are often used to determine"; print, "the number of common factors. This is the default in most"; print, "statistical software packages, and it is the primary practice"; print, "in the literature. It is also the method used by many factor"; print, "analysis experts, including Cattell, who often examined"; print, "principal components eigenvalues in his scree plots to determine"; print, "the number of common factors. But others believe this common"; print, "practice is wrong. Principal components eigenvalues are based"; print, "on all of the variance in correlation matrices, including both"; print, "the variance that is shared among variables and the variances"; print, "that are unique to the variables. In contrast, principal"; print, "axis eigenvalues are based solely on the shared variance"; print, "among the variables. The two procedures are qualitatively"; print, "different. Some therefore claim that the eigenvalues from one"; print, "extraction method should not be used to determine"; print, "the number of factors for the other extraction method."; print, "The issue remains neglected and unsettled."; end; quit;