I'm trying to use SAS to replicate a principal component analysis in SPSS, but I get different results.
The data come from Task 18.4 in Chapter 18 of this website:
http://milton-the-cat.rocks/home/dsus_alex.html
I have attached both the SPSS and the SAS data files for this analysis.
I used the following code in SAS:
proc factor
data = z1
n = 3;
ods output FactorPattern = z2;
run;
Here is the Factor Pattern matrix that I get. I sorted the results by Factor1 in descending order.
Label | Factor1 | Factor2 | Factor3 |
Dramatic | 0.83152 | -0.00401 | 0.20573 |
Manipulative | 0.75924 | 0.15946 | 0.15446 |
Arrogant | 0.66808 | 0.14868 | -0.05109 |
Eccentric | 0.47807 | 0.41197 | 0.12763 |
Mistrustful | 0.13197 | 0.70229 | 0.29149 |
Passive-Agressive | -0.11345 | 0.52411 | -0.35355 |
Volatile | -0.24119 | 0.57074 | 0.50051 |
Perfectionist | -0.31997 | 0.00441 | -0.06086 |
Detached | -0.34426 | 0.59224 | -0.47549 |
Dependent | -0.40245 | -0.2419 | 0.6669 |
Cautious | -0.73911 | 0.27281 | 0.25414 |
Here is the rotated component matrix from SPSS.
As you can see, there is no exact match. Furthermore, some of the values are entirely different. Why is that?
PROC FACTOR documentation:
Use the ROTATE= option
Although at that point, I don't know if the rotated factors from SAS will match the rotated factors from SPSS.
That is factor analysis ,NOT principal component analysis, Try PRINCOMP Procedure .
1) Doesn't PROC FACTOR perform PCA?
2) I searched "PROC PRINCOMP vs PROC PCA" on Google, but I don't see any results. How do they differ?
That is factor analysis ,NOT principal component analysis, Try PRINCOMP Procedure
I think PROC FACTOR defaults to principal components analysis when you use it that way.
You can't compare rotated components to un-rotated components.
Ah - thanks, Paige. How, then, do I get the rotated components?
PROC FACTOR documentation:
Use the ROTATE= option
Although at that point, I don't know if the rotated factors from SAS will match the rotated factors from SPSS.
That worked! Thanks, Paige!
ods exclude all;
proc factor
data = z1
n = 3
rotate = varimax;
ods output OrthRotFactPat = z2;
run;
ods exclude none;
proc sort
data = z2
out = z3 (drop = variable);
by descending
factor1;
run;
proc print
data = z3 noobs;
run;
Label | Factor1 | Factor2 | Factor3 |
Dramatic | 0.83344 | -0.01713 | -0.19708 |
Manipulative | 0.78543 | 0.08145 | -0.04691 |
Arrogant | 0.67687 | -0.04548 | 0.10403 |
Eccentric | 0.54909 | 0.2988 | 0.1542 |
Mistrustful | 0.27123 | 0.68113 | 0.24104 |
Passive-Agressive | -0.05357 | 0.17009 | 0.61706 |
Volatile | -0.09984 | 0.79007 | 0.0159 |
Detached | -0.27916 | 0.18104 | 0.76462 |
Perfectionist | -0.3187 | 0.02075 | 0.06406 |
Dependent | -0.37995 | 0.33545 | -0.63903 |
Cautious | -0.65933 | 0.49985 | 0.02697 |
And depending on the particular procedure you can get slightly different results inside the same system by changing the order of variables on model statements.
When I worked in an SPSS shop we had on process that we worked with to identify key elements. After we got a candidate list the approach had us change the order of variables several times because several of the variables would usually change levels of "importance" depending on which position in the code they occupied
(not role but position:
model y = a b c d e ; would yield different results for the variables than model y= c d e a b; to use SAS generic code)
@ballardw wrote:
And depending on the particular procedure you can get slightly different results inside the same system by changing the order of variables on model statements.
This is not true for Principal Components Analysis in SAS. Although I have never done PCA in SPSS, there is nothing the PCA algorithm that was would cause an order of variable dependency, so I can't imagine any correctly programmed PCA algorithm to produce order effects, other than perhaps round-off error in the last decimal places.
Example:
title "ORDER OF VARIABLES: Age Height Weight";
proc princomp data=sashelp.class;
var age height weight;
run;
title "ORDER OF VARIABLES: Weight Height Age";
proc princomp data=sashelp.class;
var weight height age;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.