% c10p6.m
%
% factor analysis exercise

nu=500;   % number of data points

randn('state',100); % to make the same as in the text
gtrue=[1 ; 1 ; 1];  % since the underlying factor is identical in
                    % each observable component

vtrue=randn(1,nu);      
u1=gtrue*vtrue + 0.5*randn(3,nu); % data for 10.4A and B
u2=u1;
u2(2,:)=vtrue+3*randn(1,nu);      % corrupt u_2 by more noise

C1=cov(u1');        % covariance matrix for u1
C2=cov(u2');        % covariance matrix for u2
                    % the means are not very important since there
                    % are so many data points.

rot=[cos(pi/3) sin(pi/3) 0 ; -sin(pi/3) cos(pi/3) 0 ; 0 0 1] * ...
    [cos(pi/6) 0 sin(pi/6) ; 0 1 0 ; -sin(pi/6) 0 cos(pi/6)];

