/* -------------------------------------------------------- File: cfa.wisc.sas Purpose: Fitting a two factor hypothesized factor solution. First factor = Verbal, Second Factor = Performance Data: from Tabachnick & Fidell, 3rd edition -------------------------------------------------------- */ /* -------------------------------------------------------- this code creates a temporary data set that is used for the duration of the SAS session. this is recommended practice to avoid messing up the original data set -------------------------------------------------------- */ *NOTE: LIBNAME p7291 must be assigned; *LIBNAME p7291 ''; /* -------------------------------------------------------- this code creates a temporary data set that is used for the duration of the SAS session. this is recommended practice to avoid messing up the original data set -------------------------------------------------------- */ DATA temp; set p7291.wiscsem; RUN; /* ------------------------------------------------------------ the CALIS statements the CORR option specifies that the correlation (and not not the covariance matrix) is analyzed the RESIDUAL option prints the residual correlation matrix. this is useful to inspect to assess the fit of the model. sometimes chi square may be large because of a large sample size, but the residuals are small. other times, the residuals are large and indicate those correlations that are very discrepant from the model. ------------------------------------------------------------- */ OPTIONS NOCENTER NODATE PAGENO=1; TITLE "T & F WISC Data Set: Confirmatory Factor Analysis"; TITLE2 "General Model: Two factor solution"; PROC CALIS DATA=temp CORR RESIDUAL; VAR info -- coding; /* --- In a confirmatory factor analysis: (1) set at least one loading on the first factor to 0 (2) set at least one loading on the second factor to 0, making sure it is not the same variable as the one set to 0 on the first factor (3) same for third, fourth, fifth, etc hypothesized factors NOTE WELL: If the factors are correlated, then you may have to set more than one loading on some factors to 0. Here we set Block Design to 0 for factor 1 and Vocabulary to 0 for factor 2. Hence, factor 1 should be equivalent to the Verbal factor of the WISC and factor 2 to the Performance factor of the WISC. --- */ LINEQS info = binfo1 f1 + binfo2 f2 + e_info , comp = bcomp1 f1 + bcomp2 f2 + e_comp , arith = barith1 f1 + barith2 f2 + e_arith , simil = bsimil1 f1 + bsimul2 f2 + e_simul , vocab = bvocab1 f1 + 0 f2 + e_vocab , digit = bdigit1 f1 + bdigit2 f2 + e_digit , pictcomp = bpictc1 f1 + bpictc2 f2 + e_pictc , parang = bparang1 f1 + bparang2 f2 + e_parang, block = 0 f1 + bblock2 f2 + e_block , object = bonject1 f1 + bobject2 f2 + e_object, coding = bcoding1 f1 + bcoding2 f2 + e_coding; /* --- note that the variances of the two latent factors are constrainted to equal 1. this is one of several different ways to scale the problem --- */ STD f1 = 1.0, f2 = 1.0, e_info = ve_info , e_comp = ve_comp , e_arith = ve_arith , e_simul = ve_simul , e_vocab = ve_vocab , e_digit = ve_digit , e_pictc = ve_pictc , e_parang = ve_paran , e_block = ve_block , e_object = ve_objec , e_coding = ve_codin ; COV f1 f2 = COV_F1_F2; RUN;