%Candace Metoyer %Stat 135 %Chapter 9 Demos %EXAMPLE 9.9 %Rotated Loadings for the Consumer-Preference Data clear; clc; format compact; format short g; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Example 9.9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% p = 5; %Enter the correlation matrix R1 = [1 .02 .96 .42 .01]; R2 = [.02 1 .13 .71 .85]; R3 = [.96 .13 1 .5 .11]; R4 = [.42 .71 .50 1 .79]; R5 = [.01 .85 .11 .79 1]; R = [R1;R2;R3;R4;R5]; [ellV, psiV] = factoran(R,2,'xtype', 'cov','rotate', 'varimax') %compute the communalities hV = 1 - psiV %obtain the MLEs for the eigenvalues using the fact on page 487 lambdaMLE(1) = (norm(ellV(:,1)))^2; lambdaMLE(2) = (norm(ellV(:,2)))^2; %compute cumulative proportion total standardized sample variance explained cpercentMLE(1) = lambdaMLE(1)/p; cpercentMLE(2) = sum(lambdaMLE(1:2))/p; cpercentMLE