Homework # 2

1. Modify the simulation program below by changing the factor model and the number of

of factors and number of observed variables. Give the variables names for interpretation.

2. Compute the cov matrix using proc corr in sas (look into manual).

3. Use the printout from Proc Corr for inputing the cov matrix into matlab

4. Compute the eigenvectors and eigenvalues of the cov matrix in matlab.

5. Run proc princomp in SAS and compare results with matlab.

6. Write short results summarizing the Princomp output using the names from step 1.

7. Run Proc Factor using orthogonal and oblique rotation. Compare this with the answer from step 6.

 

 

DATA SIM;

START: IF SUB>=500 THEN GO TO ENDSIM;

SUB+1;

f1 = NORMAL(0);

f2 = .2*f1 + NORMAL(0) ;

y1 = .3*f1 + .2*f2 + .5*normal(0);

y2 = .7*f1 + .1*f2 + .10*normal(0);

y3 = .1*f1 + .8*f2 + .15*normal(0);

y4 = -.5*f1 + -.3*f2 + .8*normal(0);

y5 = -.8*f1 + .7*f2 + .7*normal(0);

y6 = .5*f1 + -.4*f2 + .3*normal(0);

y7 = -.3*f1 + .2*f2 + .20*normal(0);

y8 = .1*f1 + .1*f2 + .20*normal(0);

y9 = .9*f1 + .2*f2 + normal(0);

y10= .9*f1 + -.9*f2 + .3*normal(0);

OUTPUT;

GO TO START;

ENDSIM:;

proc princomp cov ;

var y1 - y10;

proc factor cov method = principal n = 2 scree priors = smc

rotate=varimax; var y1 - y10;

run;