Factor Analysis Action Set

Iterative Factor Extraction

This section contains PROC CAS code.

Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts. A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.

This example uses the socioeconomics data set that is described in the examples for the FACTOR procedure in SAS/STAT software. These are the same data that are described and analyzed in Example 10.3: Principal Factor Analysis.

To create the socioeconomics data table in your CAS session, you can modify the DATA step that is used to create the data set to create the data table in your CAS engine libref. For this example, it is assumed that your CAS engine libref is named mycas, but you can substitute any appropriately defined CAS engine libref.

In Example 10.3, the socioeconomics data set is used in a principal factor analysis. In that analysis, squared multiple correlations are used for prior communality estimates. After two factors are extracted, the factor pattern is used to compute updated estimates of the communalities. You might wonder whether this process can be repeated. That is, can you use the final communalities as prior communalities in a subsequent analysis? This is a motivation behind iterative methods of factor extraction.

The following code uses the faExtract action to perform an iterative principal factor analysis with squared multiple correlations for the prior communality estimates:

proc cas;
factorAnalysis.faExtract /
    method={heywood="bound", name="prinit"},
    nFactors={2},
    table="socioeconomics";
run;

This code is very similar to the code that is used in Example 10.3. The major difference here is the use of the method parameter to request an iterative principal factor extraction. This means that the prior communalities are used to compute an initial factor pattern, which is then used to compute new communalities, which is then used to compute a new factor pattern, and so on. This process continues until the change in the estimated communalities is sufficiently small. You can use the convergence subparameter of the method parameter to set a specific value for the convergence threshold. The default value is 0.001.

Practically speaking, communalities are squared correlations and so must be bounded above by 1.0. However, during the iterative process of factor extraction, it is possible for a communality to meet or exceed this upper bound. When a communality reaches this bound, it is called a Heywood case. When a communality exceeds this bound, it is called an ultra-Heywood case. (For more information about communalities and Heywood cases, see the section Heywood Cases and Other Anomalies of Communality Estimates.) In this analysis, you use the heywood subparameter to request that the communalities be bounded above by 1.0 during the iterative process. This means that if a communality exceeds 1.0 during the iterations, it is replaced by a value of 1.0. If you omit the heywood subparameter, then by default the faExtract action terminates with an error when it encounters a Heywood or ultra-Heywood case.

Note that no rotation is requested in the current analysis. This is simply for clarity of exposition, so that the current example can focus on iterative extraction methods. You can use the rotate parameter to request a rotation for a factor pattern that is extracted using an iterative procedure in the same manner that you would for a noniterative extraction method.

The initial outputs that are produced by the faExtract action are shown in Output 10.4.1 through Output 10.4.4. These are identical to the outputs that are produced when you request a noniterative principal factor analysis. For a discussion of these outputs, see Example 10.3.

Output 10.4.1: Model Information and Number of Observations

Results from factorAnalysis.faExtract

Model Information
Data SourceSOCIOECONOMICS
Data TypeRaw
Prior CommunalitiesSquared Multiple Correlations
Factor ExtractionIterative Principal Factor Method
Factor RotationNone

Number of Observations Read12
Number of Observations Used12


Output 10.4.2: Simple Statistics

Simple Statistics
VariableMeanStandard
Deviation
Population6241.666673439.99427
School11.441671.78654
Employment2333.333331241.21153
Services120.83333114.92751
HouseValue170006367.53128


Output 10.4.3: Prior Communalities

Results from factorAnalysis.faExtract

Prior Communality Estimates
PopulationSchoolEmploymentServicesHouseValue
0.968591600.822285140.969180820.785724400.84701921


Output 10.4.4: Preliminary Eigenvalues

Preliminary Eigenvalues: Total = 4.39280116 Average = 0.87856023
 EigenvalueDifferenceProportionCumulative
12.7343011.0182320.62250.6225
21.7160691.6765060.39071.0131
30.0395630.0640860.00901.0221
4-0.0245230.048084-0.00561.0165
5-0.072608 -0.01651.0000


The iterative factor extraction process is summarized in Output 10.4.5. You can see that a Heywood case is encountered in the eighth iteration of the algorithm and remains in place until the algorithm converges.

Output 10.4.5: Iteration History

IterationChangeCommunalities
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


The eigenvalues of the reduced correlation matrix, the factor pattern, and the variance explained by the extracted factors are summarized in Output 10.4.6, Output 10.4.7, and Output 10.4.8, respectively. The final communality estimates are displayed in Output 10.4.9. In that table, you can see that the final communality estimate for Population is an ultra-Heywood case. Although the "bound" value of the heywood subparameter replaces out-of-bound communality estimates with ones during the iterative steps, this is not sufficient to effectively constrain the final community estimates after factoring the reduced correlation matrix. Consequently, ultra-Heywood cases might still be observed for the iterative principal factor method even if you specify this subparameter value. The ultra-Heywood case implies that some unique factor has negative variance—a clear indication that the factor solution in this case is problematic, if not invalid.

Output 10.4.6: Final Eigenvalues

Eigenvalues of the Reduced Correlation Matrix: Total = 4.49264739 Average = 0.89852948
 EigenvalueDifferenceProportionCumulative
12.7559161.0163280.61340.6134
21.7395881.7084790.38721.0006
30.0311090.0336200.00691.0076
4-0.0025110.028943-0.00061.0070
5-0.031455 -0.00701.0000


Output 10.4.7: Factor Pattern

Factor Pattern
 Factor1Factor2
Population0.622540.78441
School0.70213-0.52371
Employment0.701440.68130
Services0.88116-0.14526
HouseValue0.77905-0.60395


Output 10.4.8: Variance Explained

Variance Explained by Each
Factor
Factor1Factor2
2.75591581.7395881


Output 10.4.9: Final Communalities

Final Communality Estimates: Total = 4.495504
PopulationSchoolEmploymentServicesHouseValue
1.002851060.767256120.956184810.797535410.97167647


You might instead consider an alternative factor extraction method to see if a different factor solution can be obtained. The following code uses maximum likelihood estimation for factor extraction:

proc cas;
factorAnalysis.faExtract /
    method={heywood="bound", name="ml"},
    nFactors={2},
    table="socioeconomics";
run;

Like iterative principal factor extraction, the maximum likelihood method is an iterative method. The iteration history is summarized in Output 10.4.10. The maximum likelihood method converges in only 6 iterations, compared to the 14 iterations that are required for the iterative principal factor extraction method. Both methods encounter a Heywood case; the maximum likelihood method encounters the Heywood case in the very first iteration.

Output 10.4.10: Maximum Likelihood Iteration History

Results from factorAnalysis.faExtract

IterationCriterionRidgeChangeCommunalities
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


In maximum likelihood factor analysis, the eigenvalues of the weighted reduced correlation matrix are computed. The weights that are used are the reciprocals of the unique error variances (that is, one minus the communalities). When a Heywood case is encountered, the weight for that variable is not defined. For this reason, one of the eigenvalues in the "Eigenvalues of the Weighted Reduced Correlation Matrix" table in Output 10.4.11 is missing.

Output 10.4.11: Maximum Likelihood Final Eigenvalues

Eigenvalues of the Weighted Reduced Correlation Matrix: Total = 19.8268757 Average = 4.95671892
 EigenvalueDifferenceProportionCumulative
1....
219.82687519.2837281.00001.0000
30.5431480.5828690.02741.0274
4-0.0397210.463706-0.00201.0254
5-0.503427 -0.02541.0000


As with iterative principal factor extraction, the maximum likelihood method encounters a Heywood case. However, unlike the iterative principal factor results, the converged solution for the maximum likelihood method has only a Heywood case rather than an ultra-Heywood case. You can see this in the "Final Communality Estimates" table in Output 10.4.13. Although a Heywood case does not necessarily invalidate a factor solution, it should raise some suspicion and requires further investigation.

Output 10.4.12: Maximum Likelihood Solution

Eigenvalues of the Weighted Reduced Correlation Matrix: Total = 19.8268757 Average = 4.95671892
 EigenvalueDifferenceProportionCumulative
1....
219.82687519.2837281.00001.0000
30.5431480.5828690.02741.0274
4-0.0397210.463706-0.00201.0254
5-0.503427 -0.02541.0000

Factor Pattern
 Factor1Factor2
Population1.000000.00000
School0.009750.89992
Employment0.972450.11791
Services0.438870.78926
HouseValue0.022410.96004

Variance Explained by Each Factor
FactorWeightedUnweighted
Factor124.4363812.138861
Factor219.8268752.368369


Output 10.4.13: Maximum Likelihood Final Communalities

Final Communality Estimates and Variable
Weights
Total Communality: Weighted = . Unweighted
= 4.507229
VariableCommunalityWeight
Population1.00000000.
School0.809951155.26102907
Employment0.9595590924.7292489
Services0.815539305.42072311
HouseValue0.9221798912.8522557


Iterative Factor Extraction

This section contains Lua code that creates the same socioeconomics table and performs the same analysis as shown in the CASL version of this example. For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.

Because this example uses simulated data that are produced from DATA step code, you can submit the runCode action on your Lua client to create the simulated data in your CAS session.

This example uses the socioeconomics data set that is described in the examples for the FACTOR procedure in SAS/STAT software. These are the same data that are described and analyzed in Example 10.3: Principal Factor Analysis.

To run this example code, you must make the socioeconomics data accessible to the CAS server. One way to do this is to convert the socioeconomics data set from the PROC FACTOR documentation to a comma-separated-value (CSV) file and then load the CSV file into CAS.

In Example 10.3, the socioeconomics data set is used in a principal factor analysis. In that analysis, squared multiple correlations are used for prior communality estimates. After two factors are extracted, the factor pattern is used to compute updated estimates of the communalities. You might wonder whether this process can be repeated. That is, can you use the final communalities as prior communalities in a subsequent analysis? This is a motivation behind iterative methods of factor extraction.

The following code uses the faExtract action to perform an iterative principal factor analysis with squared multiple correlations for the prior communality estimates:

s:loadactionset{actionset="factorAnalysis"}
s:factorAnalysis_faExtract{
table='socioeconomics',
nFactors={2},
method={name='prinit', heywood='bound'},
}

This code is very similar to the code that is used in Example 10.3. The major difference here is the use of the method parameter to request an iterative principal factor extraction. This means that the prior communalities are used to compute an initial factor pattern, which is then used to compute new communalities, which is then used to compute a new factor pattern, and so on. This process continues until the change in the estimated communalities is sufficiently small. You can use the convergence subparameter of the method parameter to set a specific value for the convergence threshold. The default value is 0.001.

Practically speaking, communalities are squared correlations and so must be bounded above by 1.0. However, during the iterative process of factor extraction, it is possible for a communality to meet or exceed this upper bound. When a communality reaches this bound, it is called a Heywood case. When a communality exceeds this bound, it is called an ultra-Heywood case. (For more information about communalities and Heywood cases, see the section Heywood Cases and Other Anomalies of Communality Estimates.) In this analysis, you use the heywood subparameter to request that the communalities be bounded above by 1.0 during the iterative process. This means that if a communality exceeds 1.0 during the iterations, it is replaced by a value of 1.0. If you omit the heywood subparameter, then by default the faExtract action terminates with an error when it encounters a Heywood or ultra-Heywood case.

Note that no rotation is requested in the current analysis. This is simply for clarity of exposition, so that the current example can focus on iterative extraction methods. You can use the rotate parameter to request a rotation for a factor pattern that is extracted using an iterative procedure in the same manner that you would for a noniterative extraction method.

The initial outputs that are produced by the faExtract action are shown in Output 10.4.14 through Output 10.4.17. These are identical to the outputs that are produced when you request a noniterative principal factor analysis. For a discussion of these outputs, see Example 10.3.

Output 10.4.14: Model Information and Number of Observations

RowIdDescriptioncValueValue
TABLEData SourceSOCIOECONOMICS.
TYPEData TypeRaw.
PRIORSPrior CommunalitiesSquared Multiple Correlations.
EXTRACTFactor ExtractionIterative Principal Factor Method.
ROTATEFactor RotationNone.

RowIdDescriptionValue
NREADNumber of Observations Read12
NUSEDNumber of Observations Used12


Output 10.4.15: Simple Statistics

VariableMeanStdDev
Population6241.666673439.99427
School11.441671.78654
Employment2333.333331241.21153
Services120.83333114.92751
HouseValue170006367.53128


Output 10.4.16: Prior Communalities

PopulationSchoolEmploymentServicesHouseValue
0.968591600.822285140.969180820.785724400.84701921


Output 10.4.17: Preliminary Eigenvalues

NumberEigenvalueDifferenceProportionCumulative
12.7343011.0182320.62250.6225
21.7160691.6765060.39071.0131
30.0395630.0640860.00901.0221
4-0.0245230.048084-0.00561.0165
5-0.072608_-0.01651.0000


The iterative factor extraction process is summarized in Output 10.4.18. You can see that a Heywood case is encountered in the eighth iteration of the algorithm and remains in place until the algorithm converges.

Output 10.4.18: Iteration History

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


The eigenvalues of the reduced correlation matrix, the factor pattern, and the variance explained by the extracted factors are summarized in Output 10.4.19, Output 10.4.20, and Output 10.4.21, respectively. The final communality estimates are displayed in Output 10.4.22. In that table, you can see that the final communality estimate for Population is an ultra-Heywood case. Although the "bound" value of the heywood subparameter replaces out-of-bound communality estimates with ones during the iterative steps, this is not sufficient to effectively constrain the final community estimates after factoring the reduced correlation matrix. Consequently, ultra-Heywood cases might still be observed for the iterative principal factor method even if you specify this subparameter value. The ultra-Heywood case implies that some unique factor has negative variance—a clear indication that the factor solution in this case is problematic, if not invalid.

Output 10.4.19: Final Eigenvalues

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


Output 10.4.20: Factor Pattern

VariableFactor1Factor2
Population0.622540.78441
School0.70213-0.52371
Employment0.701440.68130
Services0.88116-0.14526
HouseValue0.77905-0.60395


Output 10.4.21: Variance Explained

Factor1Factor2Solution
2.75591581.7395881Initial


Output 10.4.22: Final Communalities

PopulationSchoolEmploymentServicesHouseValueSolution
1.002851060.767256120.956184810.797535410.97167647Initial


You might instead consider an alternative factor extraction method to see if a different factor solution can be obtained. The following code uses maximum likelihood estimation for factor extraction:

s:factorAnalysis_faExtract{
table='socioeconomics',
nFactors={2},
method={name='ml', heywood='bound'},
}

Like iterative principal factor extraction, the maximum likelihood method is an iterative method. The iteration history is summarized in Output 10.4.23. The maximum likelihood method converges in only 6 iterations, compared to the 14 iterations that are required for the iterative principal factor extraction method. Both methods encounter a Heywood case; the maximum likelihood method encounters the Heywood case in the very first iteration.

Output 10.4.23: Maximum Likelihood Iteration History

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


In maximum likelihood factor analysis, the eigenvalues of the weighted reduced correlation matrix are computed. The weights that are used are the reciprocals of the unique error variances (that is, one minus the communalities). When a Heywood case is encountered, the weight for that variable is not defined. For this reason, one of the eigenvalues in the "Eigenvalues of the Weighted Reduced Correlation Matrix" table in Output 10.4.24 is missing.

Output 10.4.24: Maximum Likelihood Final Eigenvalues

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


As with iterative principal factor extraction, the maximum likelihood method encounters a Heywood case. However, unlike the iterative principal factor results, the converged solution for the maximum likelihood method has only a Heywood case rather than an ultra-Heywood case. You can see this in the "Final Communality Estimates" table in Output 10.4.26. Although a Heywood case does not necessarily invalidate a factor solution, it should raise some suspicion and requires further investigation.

Output 10.4.25: Maximum Likelihood Solution

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219

VariableFactor1Factor2
Population1.000000.00000
School0.009750.89992
Employment0.972450.11791
Services0.438870.78926
HouseValue0.022410.96004

FactorWeightedUnweightedSolution
Factor124.4363812.138861Initial
Factor219.8268752.368369Initial


Output 10.4.26: Maximum Likelihood Final Communalities

VariableCommunalityWeightSolution
Population1.00000000.Initial
School0.809951155.26102907Initial
Employment0.9595590924.7292489Initial
Services0.815539305.42072311Initial
HouseValue0.9221798912.8522557Initial


Iterative Factor Extraction

This section contains Python code that creates the same socioeconomics table and performs the same analysis as shown in the CASL version of this example. For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.

Because this example uses simulated data that are produced from DATA step code, you can submit the runCode action on your Python client to create the simulated data in your CAS session.

This example uses the socioeconomics data set that is described in the examples for the FACTOR procedure in SAS/STAT software. These are the same data that are described and analyzed in Example 10.3: Principal Factor Analysis.

To run this example code, you must make the socioeconomics data accessible to the CAS server. One way to do this is to convert the socioeconomics data set from the PROC FACTOR documentation to a comma-separated-value (CSV) file and then load the CSV file into CAS.

In Example 10.3, the socioeconomics data set is used in a principal factor analysis. In that analysis, squared multiple correlations are used for prior communality estimates. After two factors are extracted, the factor pattern is used to compute updated estimates of the communalities. You might wonder whether this process can be repeated. That is, can you use the final communalities as prior communalities in a subsequent analysis? This is a motivation behind iterative methods of factor extraction.

The following code uses the faExtract action to perform an iterative principal factor analysis with squared multiple correlations for the prior communality estimates:

s.loadactionset(actionset='factorAnalysis')
s.factoranalysis.faextract(
    method=dict(heywood='bound', name='prinit'),
    nFactors=[2],
    table='socioeconomics')

This code is very similar to the code that is used in Example 10.3. The major difference here is the use of the method parameter to request an iterative principal factor extraction. This means that the prior communalities are used to compute an initial factor pattern, which is then used to compute new communalities, which is then used to compute a new factor pattern, and so on. This process continues until the change in the estimated communalities is sufficiently small. You can use the convergence subparameter of the method parameter to set a specific value for the convergence threshold. The default value is 0.001.

Practically speaking, communalities are squared correlations and so must be bounded above by 1.0. However, during the iterative process of factor extraction, it is possible for a communality to meet or exceed this upper bound. When a communality reaches this bound, it is called a Heywood case. When a communality exceeds this bound, it is called an ultra-Heywood case. (For more information about communalities and Heywood cases, see the section Heywood Cases and Other Anomalies of Communality Estimates.) In this analysis, you use the heywood subparameter to request that the communalities be bounded above by 1.0 during the iterative process. This means that if a communality exceeds 1.0 during the iterations, it is replaced by a value of 1.0. If you omit the heywood subparameter, then by default the faExtract action terminates with an error when it encounters a Heywood or ultra-Heywood case.

Note that no rotation is requested in the current analysis. This is simply for clarity of exposition, so that the current example can focus on iterative extraction methods. You can use the rotate parameter to request a rotation for a factor pattern that is extracted using an iterative procedure in the same manner that you would for a noniterative extraction method.

The initial outputs that are produced by the faExtract action are shown in Output 10.4.27 through Output 10.4.30. These are identical to the outputs that are produced when you request a noniterative principal factor analysis. For a discussion of these outputs, see Example 10.3.

Output 10.4.27: Model Information and Number of Observations

RowIdDescriptioncValueValue
TABLEData SourceSOCIOECONOMICS.
TYPEData TypeRaw.
PRIORSPrior CommunalitiesSquared Multiple Correlations.
EXTRACTFactor ExtractionIterative Principal Factor Method.
ROTATEFactor RotationNone.

RowIdDescriptionValue
NREADNumber of Observations Read12
NUSEDNumber of Observations Used12


Output 10.4.28: Simple Statistics

VariableMeanStdDev
Population6241.666673439.99427
School11.441671.78654
Employment2333.333331241.21153
Services120.83333114.92751
HouseValue170006367.53128


Output 10.4.29: Prior Communalities

PopulationSchoolEmploymentServicesHouseValue
0.968591600.822285140.969180820.785724400.84701921


Output 10.4.30: Preliminary Eigenvalues

NumberEigenvalueDifferenceProportionCumulative
12.7343011.0182320.62250.6225
21.7160691.6765060.39071.0131
30.0395630.0640860.00901.0221
4-0.0245230.048084-0.00561.0165
5-0.072608_-0.01651.0000


The iterative factor extraction process is summarized in Output 10.4.31. You can see that a Heywood case is encountered in the eighth iteration of the algorithm and remains in place until the algorithm converges.

Output 10.4.31: Iteration History

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


The eigenvalues of the reduced correlation matrix, the factor pattern, and the variance explained by the extracted factors are summarized in Output 10.4.32, Output 10.4.33, and Output 10.4.34, respectively. The final communality estimates are displayed in Output 10.4.35. In that table, you can see that the final communality estimate for Population is an ultra-Heywood case. Although the "bound" value of the heywood subparameter replaces out-of-bound communality estimates with ones during the iterative steps, this is not sufficient to effectively constrain the final community estimates after factoring the reduced correlation matrix. Consequently, ultra-Heywood cases might still be observed for the iterative principal factor method even if you specify this subparameter value. The ultra-Heywood case implies that some unique factor has negative variance—a clear indication that the factor solution in this case is problematic, if not invalid.

Output 10.4.32: Final Eigenvalues

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


Output 10.4.33: Factor Pattern

VariableFactor1Factor2
Population0.622540.78441
School0.70213-0.52371
Employment0.701440.68130
Services0.88116-0.14526
HouseValue0.77905-0.60395


Output 10.4.34: Variance Explained

Factor1Factor2Solution
2.75591581.7395881Initial


Output 10.4.35: Final Communalities

PopulationSchoolEmploymentServicesHouseValueSolution
1.002851060.767256120.956184810.797535410.97167647Initial


You might instead consider an alternative factor extraction method to see if a different factor solution can be obtained. The following code uses maximum likelihood estimation for factor extraction:

s.factoranalysis.faextract(
    method=dict(heywood='bound', name='ml'),
    nFactors=[2],
    table='socioeconomics')

Like iterative principal factor extraction, the maximum likelihood method is an iterative method. The iteration history is summarized in Output 10.4.36. The maximum likelihood method converges in only 6 iterations, compared to the 14 iterations that are required for the iterative principal factor extraction method. Both methods encounter a Heywood case; the maximum likelihood method encounters the Heywood case in the very first iteration.

Output 10.4.36: Maximum Likelihood Iteration History

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


In maximum likelihood factor analysis, the eigenvalues of the weighted reduced correlation matrix are computed. The weights that are used are the reciprocals of the unique error variances (that is, one minus the communalities). When a Heywood case is encountered, the weight for that variable is not defined. For this reason, one of the eigenvalues in the "Eigenvalues of the Weighted Reduced Correlation Matrix" table in Output 10.4.37 is missing.

Output 10.4.37: Maximum Likelihood Final Eigenvalues

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


As with iterative principal factor extraction, the maximum likelihood method encounters a Heywood case. However, unlike the iterative principal factor results, the converged solution for the maximum likelihood method has only a Heywood case rather than an ultra-Heywood case. You can see this in the "Final Communality Estimates" table in Output 10.4.39. Although a Heywood case does not necessarily invalidate a factor solution, it should raise some suspicion and requires further investigation.

Output 10.4.38: Maximum Likelihood Solution

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219

VariableFactor1Factor2
Population1.000000.00000
School0.009750.89992
Employment0.972450.11791
Services0.438870.78926
HouseValue0.022410.96004

FactorWeightedUnweightedSolution
Factor124.4363812.138861Initial
Factor219.8268752.368369Initial


Output 10.4.39: Maximum Likelihood Final Communalities

VariableCommunalityWeightSolution
Population1.00000000.Initial
School0.809951155.26102907Initial
Employment0.9595590924.7292489Initial
Services0.815539305.42072311Initial
HouseValue0.9221798912.8522557Initial


Iterative Factor Extraction

This section contains R code that creates the same socioeconomics table and performs the same analysis as shown in the CASL version of this example. For more information about coding in R, see Getting Started with SAS Viya for R and SAS Viya: System Programming Guide.

Because this example uses simulated data that are produced from DATA step code, you can submit the runCode action on your R client to create the simulated data in your CAS session.

This example uses the socioeconomics data set that is described in the examples for the FACTOR procedure in SAS/STAT software. These are the same data that are described and analyzed in Example 10.3: Principal Factor Analysis.

To run this example code, you must make the socioeconomics data accessible to the CAS server. One way to do this is to convert the socioeconomics data set from the PROC FACTOR documentation to a comma-separated-value (CSV) file and then load the CSV file into CAS.

In Example 10.3, the socioeconomics data set is used in a principal factor analysis. In that analysis, squared multiple correlations are used for prior communality estimates. After two factors are extracted, the factor pattern is used to compute updated estimates of the communalities. You might wonder whether this process can be repeated. That is, can you use the final communalities as prior communalities in a subsequent analysis? This is a motivation behind iterative methods of factor extraction.

The following code uses the faExtract action to perform an iterative principal factor analysis with squared multiple correlations for the prior communality estimates:

m <- cas.builtins.loadActionSet(s, actionset='factorAnalysis')
cas.factorAnalysis.faExtract(s,
    method=list(heywood='bound', name='prinit'),
    nFactors=c(2),
    table='socioeconomics')

This code is very similar to the code that is used in Example 10.3. The major difference here is the use of the method parameter to request an iterative principal factor extraction. This means that the prior communalities are used to compute an initial factor pattern, which is then used to compute new communalities, which is then used to compute a new factor pattern, and so on. This process continues until the change in the estimated communalities is sufficiently small. You can use the convergence subparameter of the method parameter to set a specific value for the convergence threshold. The default value is 0.001.

Practically speaking, communalities are squared correlations and so must be bounded above by 1.0. However, during the iterative process of factor extraction, it is possible for a communality to meet or exceed this upper bound. When a communality reaches this bound, it is called a Heywood case. When a communality exceeds this bound, it is called an ultra-Heywood case. (For more information about communalities and Heywood cases, see the section Heywood Cases and Other Anomalies of Communality Estimates.) In this analysis, you use the heywood subparameter to request that the communalities be bounded above by 1.0 during the iterative process. This means that if a communality exceeds 1.0 during the iterations, it is replaced by a value of 1.0. If you omit the heywood subparameter, then by default the faExtract action terminates with an error when it encounters a Heywood or ultra-Heywood case.

Note that no rotation is requested in the current analysis. This is simply for clarity of exposition, so that the current example can focus on iterative extraction methods. You can use the rotate parameter to request a rotation for a factor pattern that is extracted using an iterative procedure in the same manner that you would for a noniterative extraction method.

The initial outputs that are produced by the faExtract action are shown in Output 10.4.40 through Output 10.4.43. These are identical to the outputs that are produced when you request a noniterative principal factor analysis. For a discussion of these outputs, see Example 10.3.

Output 10.4.40: Model Information and Number of Observations

RowIdDescriptioncValueValue
TABLEData SourceSOCIOECONOMICS.
TYPEData TypeRaw.
PRIORSPrior CommunalitiesSquared Multiple Correlations.
EXTRACTFactor ExtractionIterative Principal Factor Method.
ROTATEFactor RotationNone.

RowIdDescriptionValue
NREADNumber of Observations Read12
NUSEDNumber of Observations Used12


Output 10.4.41: Simple Statistics

VariableMeanStdDev
Population6241.666673439.99427
School11.441671.78654
Employment2333.333331241.21153
Services120.83333114.92751
HouseValue170006367.53128


Output 10.4.42: Prior Communalities

PopulationSchoolEmploymentServicesHouseValue
0.968591600.822285140.969180820.785724400.84701921


Output 10.4.43: Preliminary Eigenvalues

NumberEigenvalueDifferenceProportionCumulative
12.7343011.0182320.62250.6225
21.7160691.6765060.39071.0131
30.0395630.0640860.00901.0221
4-0.0245230.048084-0.00561.0165
5-0.072608_-0.01651.0000


The iterative factor extraction process is summarized in Output 10.4.44. You can see that a Heywood case is encountered in the eighth iteration of the algorithm and remains in place until the algorithm converges.

Output 10.4.44: Iteration History

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


The eigenvalues of the reduced correlation matrix, the factor pattern, and the variance explained by the extracted factors are summarized in Output 10.4.45, Output 10.4.46, and Output 10.4.47, respectively. The final communality estimates are displayed in Output 10.4.48. In that table, you can see that the final communality estimate for Population is an ultra-Heywood case. Although the "bound" value of the heywood subparameter replaces out-of-bound communality estimates with ones during the iterative steps, this is not sufficient to effectively constrain the final community estimates after factoring the reduced correlation matrix. Consequently, ultra-Heywood cases might still be observed for the iterative principal factor method even if you specify this subparameter value. The ultra-Heywood case implies that some unique factor has negative variance—a clear indication that the factor solution in this case is problematic, if not invalid.

Output 10.4.45: Final Eigenvalues

IterationChangePopulationSchoolEmploymentServicesHouseValue
10.03790.978110.817560.972000.797740.88495
20.02350.983980.808310.971620.800960.90845
30.01610.988140.799210.970030.801320.92453
40.01170.991430.791550.968040.800850.93622
50.00880.994210.785480.965970.800210.94501
60.00670.996650.780780.963970.799610.95171
70.00520.998860.777170.962070.799090.95687
80.00401.000000.774420.960300.798670.96086
90.00311.000000.772320.958840.798340.96395
100.00241.000000.770720.957850.798100.96635
110.00191.000000.769490.957170.797910.96822
120.00151.000000.768540.956710.797760.96967
130.00111.000000.767820.956400.797640.97080
140.00091.000000.767260.956180.797540.97168


Output 10.4.46: Factor Pattern

VariableFactor1Factor2
Population0.622540.78441
School0.70213-0.52371
Employment0.701440.68130
Services0.88116-0.14526
HouseValue0.77905-0.60395


Output 10.4.47: Variance Explained

Factor1Factor2Solution
2.75591581.7395881Initial


Output 10.4.48: Final Communalities

PopulationSchoolEmploymentServicesHouseValueSolution
1.002851060.767256120.956184810.797535410.97167647Initial


You might instead consider an alternative factor extraction method to see if a different factor solution can be obtained. The following code uses maximum likelihood estimation for factor extraction:

cas.factorAnalysis.faExtract(s,
    method=list(heywood='bound', name='ml'),
    nFactors=c(2),
    table='socioeconomics')

Like iterative principal factor extraction, the maximum likelihood method is an iterative method. The iteration history is summarized in Output 10.4.49. The maximum likelihood method converges in only 6 iterations, compared to the 14 iterations that are required for the iterative principal factor extraction method. Both methods encounter a Heywood case; the maximum likelihood method encounters the Heywood case in the very first iteration.

Output 10.4.49: Maximum Likelihood Iteration History

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


In maximum likelihood factor analysis, the eigenvalues of the weighted reduced correlation matrix are computed. The weights that are used are the reciprocals of the unique error variances (that is, one minus the communalities). When a Heywood case is encountered, the weight for that variable is not defined. For this reason, one of the eigenvalues in the "Eigenvalues of the Weighted Reduced Correlation Matrix" table in Output 10.4.50 is missing.

Output 10.4.50: Maximum Likelihood Final Eigenvalues

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219


As with iterative principal factor extraction, the maximum likelihood method encounters a Heywood case. However, unlike the iterative principal factor results, the converged solution for the maximum likelihood method has only a Heywood case rather than an ultra-Heywood case. You can see this in the "Final Communality Estimates" table in Output 10.4.52. Although a Heywood case does not necessarily invalidate a factor solution, it should raise some suspicion and requires further investigation.

Output 10.4.51: Maximum Likelihood Solution

IterationCriterionRidgeChangePopulationSchoolEmploymentServicesHouseValue
10.40923060.00000.09081.000000.792290.933330.800680.93780
20.30881040.00000.02551.000000.796900.958850.814970.93545
30.30692060.00000.01301.000000.808720.959040.818900.92249
40.30674960.00000.00351.000000.808870.959520.815360.92334
50.30673330.00000.00131.000000.809950.959520.815890.92207
60.30673160.00000.00041.000000.809920.959560.815520.92219

VariableFactor1Factor2
Population1.000000.00000
School0.009750.89992
Employment0.972450.11791
Services0.438870.78926
HouseValue0.022410.96004

FactorWeightedUnweightedSolution
Factor124.4363812.138861Initial
Factor219.8268752.368369Initial


Output 10.4.52: Maximum Likelihood Final Communalities

VariableCommunalityWeightSolution
Population1.00000000.Initial
School0.809951155.26102907Initial
Employment0.9595590924.7292489Initial
Services0.815539305.42072311Initial
HouseValue0.9221798912.8522557Initial


Last updated: May 21, 2026