# Reproducing SAS Factor Analysis in R

I need to be able to reproduce some SAS results in R, as far as this is possible (note: I'm very familiar with R and barely used SAS). The original SAS code is as follows:

PROC FACTOR CORR DATA=<data> OUT=FactorScore
SIMPLE
CORR
RES
METHOD=PRINCIPAL
PRIORS=SMC
NFACT=10
MAXITER=100
HEYWOOD
SCREE
ROTATE=PROMAX
ROUND
FLAG=.38;

RUN;


As far as I'm able to understand, this runs FA with these properties

• PCA-based decomposition (METHOD=PRINCIPAL)
• Computing prior communality estimates using squared multiple correlation (PRIORS=SMC)
• 10 factors (NFACT=10)
• Setting any communality $>1$ to be 1 (HEYWOOD)
• Promax rotation (ROTATE=PROMAX)
• As no POWER is noted, Promax will use default power $k=3$
• While printing the results it drops out loadings smaller than 0.38 (FLAG=.38)

The rest of the parameters aren't interesting me (as a matter of fact FLAG doesn't either), at least as far as I can understand.

Using R and the same <data> file, I want to reproduce the exact same results. Using the psych library I've tried principal(r = data, nfactors = 10, rotate = "promax") but it's no match, as it has no option equivalent for SAS's HEYWOOD, MAXITER params; Another shot was

fa(r = data, nfactors = 10, rotate = "promax", SMC = T, max.iter = 100, fm = "pa")


which uses the principal decomposition but I still can't specify the HEYWOOD correction; In addition, I can't see where I set the power parameter for the promax.

Any help would be appreciated.

• the promax option is supplied lower case. R is case sensitive. Recalculate your output, evaluate it, and edit the question or close it if this works. – AdamO Jan 17 '18 at 18:43
• Using psych methods you can use either capital or lower case, both are supported. Anyway, changing the case has yielded a bit different results but didn't bring me any closer. – Spätzle Jan 18 '18 at 7:37

If appears that fa defaults to iterated principal factors. So, to be somewhat careful in this: If you want a principal factors solution with priors based on Squared multiple correlations (and not iterated), you code in SAS would be:

proc factor n=4 method=prin rotate=none;
priors smc;
var your-variables-here;
run;


and the equivalent code in R would be:

principalfactors <- fa(YourData, nfactors = HowManyFactorsYouWant, SMC=TRUE,
rotate = 'none', fm = 'pa', max.iter=1)


(could be that max.iter=0 is really what you want, but it seems that R doesn't accept that)

For principal factors, you need priors of one, so in SAS:

proc factor n=HowManyFactorsYouWant method=prin rotate=none;
priors one;
var your-variables-here;
run;


and in R:

principalcomponents <- principal(yourdata, nfactors = HowManyFactorsYouWant,
rotate = "none")


If you want to iterate these, then in proc Factor, you'd specify method=prinit, (and maxiter if you want to increase the iterations) and in fa, you'd leave the defaults or increase them with max.iter. Hope this helps.