EFA Procedure
Example 10.1 Estimating the Number of Factors or Components
(View the complete code for this example.)
This example shows how to use the EFA procedure to estimate either the number of common factors or the number of principal components that are likely to explain the observed correlations in a data set. It uses the simulated testdata data set that is described in the examples for the Principal Component Analysis action set in SAS Visual Statistics software. The data table is the result of multiplying two low-rank matrices, and
, and adding random noise.
To create the data table testdata, you can modify the DATA step that is used in the Principal Component Analysis action set documentation. For this example, it is assumed that your libref is named mylib, but you can substitute any appropriately defined libref.
In this example, you want to determine how many latent factors are needed to explain the variation in the input data. The following statements perform this analysis:
proc efa data=mylib.testdata method=none;
nfactors type=eigenvalue;
nfactors type=proportion threshold=0.9;
run;
When you use PROC EFA to suggest the number of latent dimensions, you specify one or more NFACTORS statements. Each NFACTORS statement describes a criterion that is used to determine the number of factors to retain.
In this example, you specify two criteria. The first criterion is the eigenvalue criterion. This criterion is based on the eigenvalues of the reduced correlation matrix (that is, the correlation matrix of the input data, but with the diagonal elements replaced by the prior communality estimates). By default, any eigenvalue greater than 1 is assumed to indicate the existence of a latent factor. You can use the THRESHOLD= option to specify a threshold value to use instead of the default value.
The second criterion that you specify is the proportion criterion. This criterion is based on the cumulative fraction of the common variance of the input data set that is explained by the latent factors that correspond to each eigenvalue. In this example, you use the THRESHOLD= option to specify a threshold value of 0.9. At this threshold, the number of factors that the proportion criterion suggests is the smallest number of factors that are necessary to explain 90% of the common variance of the input data set.
By default, PROC EFA uses squared multiple correlations (SMC) for the prior communality estimates. This means that the prior communality estimate for each variable is the squared multiple correlation of that variable with all other variables. The prior communalities are placed on the diagonal of the data correlation matrix before the eigenvalues of that matrix are computed. You can use the PRIORS= option to specify different prior communality estimates.
The "Number of Observations" table in Output 10.1.1 summarizes the number of observations that are read from the input data table and the number of observations that are used for the analysis. For this analysis, these two numbers are the same. These numbers would be different if some observations were discarded from the analysis. PROC EFA uses only complete cases for analysis, so a record is discarded if any field contains a missing value.
Output 10.1.1: Number of Observations
| Number of Observations Read | 1000000 |
|---|---|
| Number of Observations Used | 1000000 |
The "Simple Statistics" table in Output 10.1.2 summarizes the means and standard deviations of the variables that are included in the analysis.
Output 10.1.2: Simple Statistics
| Simple Statistics | ||
|---|---|---|
| Variable | Mean | Standard Deviation |
| x1 | 0.00051958 | 2.03642 |
| x2 | 0.00171 | 3.04429 |
| x3 | -0.00036170 | 1.25872 |
| x4 | 0.00194 | 1.79332 |
| x5 | 0.00058028 | 1.47249 |
| x6 | -0.00083852 | 1.52032 |
| x7 | 0.00230 | 1.83223 |
| x8 | -0.00357 | 2.30643 |
| x9 | -0.00022835 | 2.13378 |
| x10 | 0.00160 | 3.40267 |
The primary output of the analysis is shown in the "Determination of Number of Factors" table in Output 10.1.3. In this analysis, the results for both specified criteria suggest that three latent factors are sufficient to describe the input data.
In general, when you specify multiple criteria, PROC EFA must combine the results from all the active criteria to form a final estimate for the number of factors. By default, PROC EFA uses the minimum number of factors among all the active criteria. You can use the NFACTORS= option to specify a different method to obtain a final estimate. You can use the STATUS= option to change a criterion from active to inactive.
A footnote at the bottom of the table summarizes the minimum and maximum number of factors that are determined by the active criteria. It also summarizes the mean and median values of these numbers. In this analysis, the two criteria suggest the same number of latent factors, so all four summary values are the same. Thus the final result of this analysis is that three factors should be retained.
Output 10.1.3: Number of Factors
| Determination of Number of Factors | ||
|---|---|---|
| Criterion | Description | Factors |
| 1 | Minimum Eigenvalue (Eigenvalue > 1.00) | 3 |
| 2 | Total Proportion (Threshold = 0.90) | 3 |
| Min = 3, Max = 3, Mean = 3, Median = 3 | ||
Additional information about the eigenvalue and proportion criteria is presented in the "Eigenvalues of the Reduced Correlation Matrix" table in Output 10.1.4. For the proportion criteria, the number of factors is the minimum number that is required in order for the cumulative common variance to meet or exceed the user-specified threshold. The table shows that three factors are sufficient to explain approximately 93% of the cumulative common variance in the original data. Thus the proportion criterion with the option value THRESHOLD=0.90 produces an estimate of three factors. For the eigenvalue criterion, the third-largest eigenvalue is larger than 1.5, whereas the fourth-largest eigenvalue is much smaller than 1.0. For this reason, the eigenvalue criterion that is specified in this analysis suggests that three factors should be retained.
Output 10.1.4: Eigenvalues and Variance Explained
| Eigenvalues of the Reduced Correlation Matrix | ||||
|---|---|---|---|---|
| Eigenvalue | Difference | Proportion | Cumulative | |
| 1 | 5.822573 | 3.924604 | 0.5850 | 0.5850 |
| 2 | 1.897969 | 0.333507 | 0.1907 | 0.7757 |
| 3 | 1.564462 | 0.886826 | 0.1572 | 0.9329 |
| 4 | 0.677636 | 0.678439 | 0.0681 | 1.0009 |
| 5 | -0.000804 | 0.000258 | -0.0001 | 1.0009 |
| 6 | -0.001062 | 0.000542 | -0.0001 | 1.0008 |
| 7 | -0.001604 | 0.000082164 | -0.0002 | 1.0006 |
| 8 | -0.001686 | 0.000107 | -0.0002 | 1.0004 |
| 9 | -0.001794 | 0.000669 | -0.0002 | 1.0002 |
| 10 | -0.002462 | -0.0002 | 1.0000 | |
In addition to estimating the number of latent factors, you can also use PROC EFA to estimate the number of principal components that are needed to approximate an input data set. For example, you might want to determine how many components you need to retain to approximate a prespecified proportion of the total variance in the original data set. The following statements perform this analysis:
proc efa data=mylib.testdata method=none priors=one;
nfactors type=proportion threshold=0.90;
nfactors type=proportion threshold=0.95;
nfactors type=proportion threshold=0.99;
run;
These statements demonstrate how you can specify three different threshold values for the proportion criterion. Each of these threshold values is applied separately to estimate the number of factors in the input data set. The specification of multiple threshold values is a useful technique to assess the degree to which the analysis results are robust to different threshold values.
In this analysis, the PRIORS=ONE option is used to specify that the prior communality estimates for all variables should be set to 1. When you specify this option value, PROC EFA estimates the number of principal components that are needed to approximate the input data set.
The "Number of Observations" and "Simple Statistics" tables for this analysis are identical to those in the previous analysis. The "Determination of Number of Factors" table is shown in Output 10.1.5. Of the three specified threshold values, the first value produces an estimate that three factors should be retained, and the remaining two criteria produce estimates that four factors should be retained.
Output 10.1.5: Number of Factors
| Determination of Number of Factors | ||
|---|---|---|
| Criterion | Description | Factors |
| 1 | Total Proportion (Threshold = 0.90) | 3 |
| 2 | Total Proportion (Threshold = 0.95) | 4 |
| 3 | Total Proportion (Threshold = 0.99) | 4 |
| Min = 3, Max = 4, Mean = 4, Median = 4 | ||
Additional information about the number of components that are suggested by these three criteria is presented in the "Eigenvalues of the Correlation Matrix" table in Output 10.1.6. As in the previous analysis, the proportion criterion examines the cumulative variance explained by eigenvalues and corresponding principal components. For this analysis, the principal components that correspond to the three largest eigenvalues explain just under 93% of the total variance of the input data set. Thus, an estimate of three components is obtained when you set the threshold value to 0.9. When you add a fourth component, the cumulative variance explained exceeds 99%, so that four components are estimated when you set the THRESHOLD= option to 0.95 or 0.99.
Output 10.1.6: Eigenvalues and Variance Explained
| Eigenvalues of the Correlation Matrix | ||||
|---|---|---|---|---|
| Eigenvalue | Difference | Proportion | Cumulative | |
| 1 | 5.827238 | 3.924651 | 0.5827 | 0.5827 |
| 2 | 1.902587 | 0.333170 | 0.1903 | 0.7730 |
| 3 | 1.569417 | 0.887490 | 0.1569 | 0.9299 |
| 4 | 0.681927 | 0.676456 | 0.0682 | 0.9981 |
| 5 | 0.005471 | 0.001057 | 0.0005 | 0.9987 |
| 6 | 0.004414 | 0.001209 | 0.0004 | 0.9991 |
| 7 | 0.003205 | 0.000800 | 0.0003 | 0.9994 |
| 8 | 0.002405 | 0.000628 | 0.0002 | 0.9997 |
| 9 | 0.001777 | 0.000218 | 0.0002 | 0.9998 |
| 10 | 0.001559 | 0.0002 | 1.0000 | |