/* --------------------------------------------------------- FILE: cfa.nfactors.nmtwins.sas DATA: National Merit Twin data Purpose: Using CFA and maximum likelihood to estimate the number of factors. NOTE VERY WELL: This code is useful only for checking the number of factors. It is NOT useful for interpreting the loadings. ---------------------------------------------------------- */ * - NOTE: Assign LIBNAME p7291 to the directory/folder containing the Natinoal Merit Twin data; *LIBNAME p7291 ''; OPTIONS NOCENTER NODATE PAGENO=1; /* --- Two very important issue about uncovering the number of factors: (1) No correlations among the factors (2) Set loadings to 0 as shown below: (2a) first factor = all free loadings (2b) second factor = 0 loading on first variable (2c) third factor = 0 loadings on first and second variable (2d) fourth factor = 0 loadings on first, second & third vars (2e) etc. --- */ TITLE National Merit Twins: Confirmatory Factor Analysis; TITLE2 Two Factor Solution; PROC CALIS DATA=nmtdir.nmttest CORR PRINT; VAR English -- Vocab; LINEQS English = lam11 F1 + 0 F2 + e_Eng, Math = lam21 F1 + lam22 F2 + e_Math, SocSci = lam31 F1 + lam32 F2 + e_SS, NatSci = lam41 F1 + lam42 F2 + e_NS, Vocab = lam51 F1 + lam52 F2 + e_Voc; STD F1 = V_F1, F2 = V_F2, e_Eng = V_eEng, e_Math = V_eMath, e_SS = V_eSS, e_NS = V_eNS, e_Voc = V_eVoc; * - constraints: set 1: constraints needed to identify the model; V_F1 = 1; V_F2 = 1; RUN; TITLE2 One Factor Solution; PROC CALIS DATA=nmtdir.nmttest CORR PRINT; VAR English -- Vocab; LINEQS English = lam11 F1 + e_Eng, Math = lam21 F1 + e_Math, SocSci = lam31 F1 + e_SS, NatSci = lam41 F1 + e_NS, Vocab = lam51 F1 + e_Voc; STD F1 = V_F1, e_Eng = V_eEng, e_Math = V_eMath, e_SS = V_eSS, e_NS = V_eNS, e_Voc = V_eVoc; * - constraints: set 1: constraints needed to identify the model; V_F1 = 1; RUN;