PART I: FUNDAMENTALS
Chapter 1 General introduction
TABLE 1.3 Four-Latent-Class Model of Past-Year Delinquency (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 1.3;
proc lca data=delinq2;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941622;
run;
TABLE 1.4 Five-Latent-Status Model of Past-Year Delinquency (Add Health Public-Use Data, Waves I and II; N = 2,087)
*Syntax for Table 1.4;
proc lta data=delinq2;
ntimes 2;
nstatus 5;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
Chapter 2 The latent class model
TABLE 2.5 Four-Latent-Class Model of Female Pubertal Development in Seventh Grade (Add Health Public-Use Data, Wave I; N = 469)
*Syntax for Table 2.5;
proc lca data=female7;
nclass 4;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
TABLE 2.7 Five-Latent-Class Model of Health Risk Behaviors (Youth Risk Behavior Surveillance System Data; N = 13,840)
*Syntax for Table 2.7;
proc lca data=bygrade;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 416586;
run;
Chapter 3 The relation between the latent variable and its indicators
Chapter 4 Parameter estimation and model selection
Table 4.2 Summary of Information for Selecting Number of Latent Classes of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 4.2;
*note: response categories coded 1=unhealthy, 2=average, 3=healthy;
proc lca data= mtf_complete;
id caseid;
nclass 1;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861551;
run;
proc lca data= mtf_complete;
id caseid;
nclass 2;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861551;
run;
proc lca data= mtf_complete;
id caseid;
nclass 3;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861551;
run;
proc lca data= mtf_complete;
id caseid;
nclass 4;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861551;
run;
proc lca data=mtf_complete;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861552;
run;
Table 4.3 Summary of Information for Selecting Number of Latent Classes of Past-Year Delinquency (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 4.3;
proc lca data=delinq2;
nclass 1;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2;
nclass 2;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2;
nclass 3;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2 outest=temp;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941622;
run;
Table 4.4 Summary of Information for Selecting Number of Latent Classes of Female Pubertal Development (Add Health Public-Use Data, Wave I; N = 469)
*Syntax for Table 4.4;
proc lca data=female7;
nclass 1;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
proc lca data=female7;
nclass 2;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
proc lca data=female7;
nclass 3;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
proc lca data=female7;
nclass 4;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
proc lca data=female7;
nclass 5;
items period older breast curvy;
categories 2 3 3 3;
seed 845219;
run;
Table 4.5 Summary of Information for Selecting Number of Latent Classes of Health Risk Behaviors (Youth Risk Behavior Survey, 2005; N = 13,840)
*Syntax for Table 4.5;
proc lca data=bygrade;
nclass 1;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
proc lca data=bygrade;
nclass 2;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
proc lca data=bygrade;
nclass 3;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
proc lca data=bygrade;
nclass 4;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
proc lca data=bygrade;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 416586;
run;
proc lca data=bygrade;
nclass 6;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
proc lca data=bygrade;
nclass 7;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 984163;
run;
PART II: ADVANCED LCA
Chapter 5 Multiple-group LCA
Table 5.2 Selecting Number of Latent Classes in Multiple-Group Delinquency Example (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 5.2;
*ENTIRE SAMPLE;
proc lca data=delinq2;
nclass 1;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2;
nclass 2;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2;
nclass 3;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2 outest=temp;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941622;
run;
*GRADE 10 ONLY;
data delinq2_grade10;
set delinq2;
if h1gi20=10;
run;
proc lca data=delinq2_grade10;
nclass 1;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade10;
nclass 2;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade10;
nclass 3;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade10;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 108;
run;
*GRADE 11 ONLY;
data delinq2_grade11;
set delinq2;
if h1gi20=11;
run;
proc lca data=delinq2_grade11;
nclass 1;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade11;
nclass 2;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade11;
nclass 3;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 941623;
run;
proc lca data=delinq2_grade11;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
seed 483;
run;
TABLE 5.5 Fit Statistics for Test of Measurement Invariance for Adolescent Delinquency Example (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 5.5;
*note: parameter estimates from following model saved to dataset, to be read in as starting values for model without measurement invariance;
proc lca data=delinq2 outparam=lca_groups_param;
title2 ‘Grade as grouping variable – measurement invariance’;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
groups grade;
groupnames tenth eleventh;
measurement groups;
seed 941622;
run;
proc lca data=delinq2 start=lca_groups_param;
title2 ‘Grade as grouping variable – no measurement invariance’;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
groups grade;
groupnames tenth eleventh;
run;
TABLE 5.11 Five Latent Classes of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.11;
proc lca data=book_mtf.mtf_complete outparam=start;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861552;
run;
TABLE 5.12 Fit Statistics for Test of Measurement Invariance Across Genders for Latent Class Model of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.12;
*note: parameter estimates from following model saved to dataset, to be read in as starting values for model without measurement invariance;
proc lca data=book_mtf.mtf_complete outparam=start_group;
title2 ‘Gender as grouping variable – measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861552;
groups gender;
groupnames male female;
measurement groups;
run;
proc lca data=book_mtf.mtf_complete start=start_group;
title2 ‘Gender as grouping variable – no measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
run;
TABLE 5.13 Latent Class Prevalences for Model of Positive Health Behaviors with Item-Response Probabilities Allowed to Vary Across Genders (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.13;
proc lca data=book_mtf.mtf_complete start=start_group;
title2 ‘Gender as grouping variable – no measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
run;
TABLE 5.14 Item-Response Probabilities Allowed to Vary Across Genders for Model of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.14;
proc lca data=book_mtf.mtf_complete start=start_group;
title2 ‘Gender as grouping variable – no measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
run;
TABLE 5.15 Latent Class Model of Positive Health Behaviors with Item-Response Probabilities Constrained Equal Across Genders (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.15;
proc lca data=book_mtf.mtf_complete outparam=start_group;
title2 ‘Gender as grouping variable – measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861552;
groups gender;
groupnames male female;
measurement groups;
run;
TABLE 5.16 Fit Statistics for Test of Gender Differences in Latent Class Prevalences for Latent Class Model of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
*Syntax for Table 5.16;
*Model with equal measurement, all gammas estimated freely;
proc lca data=book_mtf.mtf_complete outparam=start_group;
title2 ‘Gender as grouping variable – measurement invariance’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
seed 861552;
groups gender;
groupnames male female;
measurement groups;
run;
*Parameter restrictions file to test for gamma differences;
data restrict_group;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 2 3 4 5 6
GAMMA 2 . . 2 3 4 5 6
RHO 1 brkfast3 1 1 1 1 1 1
RHO 1 veggies3 1 1 1 1 1 1
RHO 1 fruit3 1 1 1 1 1 1
RHO 1 exer3 1 1 1 1 1 1
RHO 1 sleep3 1 1 1 1 1 1
RHO 1 brkfast3 2 1 1 1 1 1
RHO 1 veggies3 2 1 1 1 1 1
RHO 1 fruit3 2 1 1 1 1 1
RHO 1 exer3 2 1 1 1 1 1
RHO 1 sleep3 2 1 1 1 1 1
RHO 1 brkfast3 3 1 1 1 1 1
RHO 1 veggies3 3 1 1 1 1 1
RHO 1 fruit3 3 1 1 1 1 1
RHO 1 exer3 3 1 1 1 1 1
RHO 1 sleep3 3 1 1 1 1 1
RHO 2 brkfast3 1 1 1 1 1 1
RHO 2 veggies3 1 1 1 1 1 1
RHO 2 fruit3 1 1 1 1 1 1
RHO 2 exer3 1 1 1 1 1 1
RHO 2 sleep3 1 1 1 1 1 1
RHO 2 brkfast3 2 1 1 1 1 1
RHO 2 veggies3 2 1 1 1 1 1
RHO 2 fruit3 2 1 1 1 1 1
RHO 2 exer3 2 1 1 1 1 1
RHO 2 sleep3 2 1 1 1 1 1
RHO 2 brkfast3 3 1 1 1 1 1
RHO 2 veggies3 3 1 1 1 1 1
RHO 2 fruit3 3 1 1 1 1 1
RHO 2 exer3 3 1 1 1 1 1
RHO 2 sleep3 3 1 1 1 1 1
;
run;
*Model with equal measurement, gammas constrained to be equal across groups;
proc lca data=book_mtf.mtf_complete start=start_group restrict=restrict_group;
title2 ‘Gender as grouping variable – measurement invariance – test of gamma differences’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
measurement groups;
run;
TABLE 5.17 Latent Class Prevalences Across Cohorts in Four-Latent-Class Model of Past-Year Delinquency (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 5.17;
proc lca data=delinq2 outparam=lca_groups_param;
title2 ‘Grade as grouping variable – measurement invariance’;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
groups grade;
groupnames tenth eleventh;
measurement groups;
seed 941622;
run;
TABLE 5.19 Fit Statistics for Test of Cohort Differences in Latent Class Prevalences for Adolescent Delinquency Example (Add Health Public-Use Data, Wave I; N = 2,087)
*Syntax for Table 5.19;
*Model with equal measurement, all gammas estimated freely;
proc lca data=delinq2 outparam=lca_groups_param;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
groups grade;
groupnames tenth eleventh;
measurement groups;
seed 941622;
run;
*Parameter restrictions file to test for gamma differences;
data restrict_gammas;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4;
datalines;
GAMMA 1 . . 2 3 4 5
GAMMA 2 . . 2 3 4 5
RHO 1 lie1 1 1 1 1 1
RHO 1 rowdy1 1 1 1 1 1
RHO 1 damage1 1 1 1 1 1
RHO 1 stl_str1 1 1 1 1 1
RHO 1 stl_sm1 1 1 1 1 1
RHO 1 fghtgrp1 1 1 1 1 1
RHO 1 lie1 2 1 1 1 1
RHO 1 rowdy1 2 1 1 1 1
RHO 1 damage1 2 1 1 1 1
RHO 1 stl_str1 2 1 1 1 1
RHO 1 stl_sm1 2 1 1 1 1
RHO 1 fghtgrp1 2 1 1 1 1
RHO 2 lie1 1 1 1 1 1
RHO 2 rowdy1 1 1 1 1 1
RHO 2 damage1 1 1 1 1 1
RHO 2 stl_str1 1 1 1 1 1
RHO 2 stl_sm1 1 1 1 1 1
RHO 2 fghtgrp1 1 1 1 1 1
RHO 2 lie1 2 1 1 1 1
RHO 2 rowdy1 2 1 1 1 1
RHO 2 damage1 2 1 1 1 1
RHO 2 stl_str1 2 1 1 1 1
RHO 2 stl_sm1 2 1 1 1 1
RHO 2 fghtgrp1 2 1 1 1 1
;
run;
*Model with equal measurement, gammas constrained to be equal across groups;
proc lca data=delinq2 start=lca_groups_param restrict=restrict_gammas;
title2 ‘Cohort as grouping variable – measurement invariance – test of gamma differences’;
nclass 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1;
categories 2 2 2 2 2 2;
groups grade;
groupnames tenth eleventh;
measurement groups;
run;
TABLE 5.20 Proportion of Students in Each Cohort Reporting Each Health Risk Behavior (Youth Risk Behavior Survey, 2005; N = 13,840)
*Syntax for Table 5.20;
*Five-class model of health risk behaviors (grades 9-12);
proc lca data=bygrade;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 416586;
run;
TABLE 5.21 Latent Class Prevalences Across Grades in Five Latent Class Model of Health Risk Behaviors (Youth Risk Behavior Survey, 2005; N = 13,840)
*Syntax for Table 5.21;
proc lca data=bygrade outparam=bygrade_start;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 941864;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
TABLE 5.22 Freely Estimated and Restricted Latent Class Prevalences for Models of Health Risk Behaviors (Youth Risk Behavior Survey, 2005; N = 13,840)
*Syntax for Table 5.22;
*Restrict latent class 1 prevalences to be equal across groups;
data restrictLC1;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 2 1 1 1 1
GAMMA 2 . . 2 1 1 1 1
GAMMA 3 . . 2 1 1 1 1
GAMMA 4 . . 2 1 1 1 1
RHO 1 qn11 1 1 1 1 1 1
RHO 1 qn29 1 1 1 1 1 1
RHO 1 qn34 1 1 1 1 1 1
RHO 1 qn40 1 1 1 1 1 1
RHO 1 qn42 1 1 1 1 1 1
RHO 1 qn45 1 1 1 1 1 1
RHO 1 qn48 1 1 1 1 1 1
RHO 1 qn50 1 1 1 1 1 1
RHO 1 qn52 1 1 1 1 1 1
RHO 1 qn53 1 1 1 1 1 1
RHO 1 qn58 1 1 1 1 1 1
RHO 1 qn59 1 1 1 1 1 1
RHO 1 qn11 2 1 1 1 1 1
RHO 1 qn29 2 1 1 1 1 1
RHO 1 qn34 2 1 1 1 1 1
RHO 1 qn40 2 1 1 1 1 1
RHO 1 qn42 2 1 1 1 1 1
RHO 1 qn45 2 1 1 1 1 1
RHO 1 qn48 2 1 1 1 1 1
RHO 1 qn50 2 1 1 1 1 1
RHO 1 qn52 2 1 1 1 1 1
RHO 1 qn53 2 1 1 1 1 1
RHO 1 qn58 2 1 1 1 1 1
RHO 1 qn59 2 1 1 1 1 1
RHO 2 qn11 1 1 1 1 1 1
RHO 2 qn29 1 1 1 1 1 1
RHO 2 qn34 1 1 1 1 1 1
RHO 2 qn40 1 1 1 1 1 1
RHO 2 qn42 1 1 1 1 1 1
RHO 2 qn45 1 1 1 1 1 1
RHO 2 qn48 1 1 1 1 1 1
RHO 2 qn50 1 1 1 1 1 1
RHO 2 qn52 1 1 1 1 1 1
RHO 2 qn53 1 1 1 1 1 1
RHO 2 qn58 1 1 1 1 1 1
RHO 2 qn59 1 1 1 1 1 1
RHO 2 qn11 2 1 1 1 1 1
RHO 2 qn29 2 1 1 1 1 1
RHO 2 qn34 2 1 1 1 1 1
RHO 2 qn40 2 1 1 1 1 1
RHO 2 qn42 2 1 1 1 1 1
RHO 2 qn45 2 1 1 1 1 1
RHO 2 qn48 2 1 1 1 1 1
RHO 2 qn50 2 1 1 1 1 1
RHO 2 qn52 2 1 1 1 1 1
RHO 2 qn53 2 1 1 1 1 1
RHO 2 qn58 2 1 1 1 1 1
RHO 2 qn59 2 1 1 1 1 1
RHO 3 qn11 1 1 1 1 1 1
RHO 3 qn29 1 1 1 1 1 1
RHO 3 qn34 1 1 1 1 1 1
RHO 3 qn40 1 1 1 1 1 1
RHO 3 qn42 1 1 1 1 1 1
RHO 3 qn45 1 1 1 1 1 1
RHO 3 qn48 1 1 1 1 1 1
RHO 3 qn50 1 1 1 1 1 1
RHO 3 qn52 1 1 1 1 1 1
RHO 3 qn53 1 1 1 1 1 1
RHO 3 qn58 1 1 1 1 1 1
RHO 3 qn59 1 1 1 1 1 1
RHO 3 qn11 2 1 1 1 1 1
RHO 3 qn29 2 1 1 1 1 1
RHO 3 qn34 2 1 1 1 1 1
RHO 3 qn40 2 1 1 1 1 1
RHO 3 qn42 2 1 1 1 1 1
RHO 3 qn45 2 1 1 1 1 1
RHO 3 qn48 2 1 1 1 1 1
RHO 3 qn50 2 1 1 1 1 1
RHO 3 qn52 2 1 1 1 1 1
RHO 3 qn53 2 1 1 1 1 1
RHO 3 qn58 2 1 1 1 1 1
RHO 3 qn59 2 1 1 1 1 1
RHO 4 qn11 1 1 1 1 1 1
RHO 4 qn29 1 1 1 1 1 1
RHO 4 qn34 1 1 1 1 1 1
RHO 4 qn40 1 1 1 1 1 1
RHO 4 qn42 1 1 1 1 1 1
RHO 4 qn45 1 1 1 1 1 1
RHO 4 qn48 1 1 1 1 1 1
RHO 4 qn50 1 1 1 1 1 1
RHO 4 qn52 1 1 1 1 1 1
RHO 4 qn53 1 1 1 1 1 1
RHO 4 qn58 1 1 1 1 1 1
RHO 4 qn59 1 1 1 1 1 1
RHO 4 qn11 2 1 1 1 1 1
RHO 4 qn29 2 1 1 1 1 1
RHO 4 qn34 2 1 1 1 1 1
RHO 4 qn40 2 1 1 1 1 1
RHO 4 qn42 2 1 1 1 1 1
RHO 4 qn45 2 1 1 1 1 1
RHO 4 qn48 2 1 1 1 1 1
RHO 4 qn50 2 1 1 1 1 1
RHO 4 qn52 2 1 1 1 1 1
RHO 4 qn53 2 1 1 1 1 1
RHO 4 qn58 2 1 1 1 1 1
RHO 4 qn59 2 1 1 1 1 1
;
run;
*Restrict latent class 2 prevalences to be equal across groups;
data restrictLC2;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 1 2 1 1 1
GAMMA 2 . . 1 2 1 1 1
GAMMA 3 . . 1 2 1 1 1
GAMMA 4 . . 1 2 1 1 1
RHO 1 qn11 1 1 1 1 1 1
.
.
.
RHO 4 qn59 2 1 1 1 1 1
;
run;
*Restrict latent class 3 prevalences to be equal across groups;
data restrictLC3;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 1 1 2 1 1
GAMMA 2 . . 1 1 2 1 1
GAMMA 3 . . 1 1 2 1 1
GAMMA 4 . . 1 1 2 1 1
RHO 1 qn11 1 1 1 1 1 1
.
.
.
RHO 4 qn59 2 1 1 1 1 1
;
run;
*Restrict latent class 4 prevalences to be equal across groups;
data restrictLC4;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 1 1 1 2 1
GAMMA 2 . . 1 1 1 2 1
GAMMA 3 . . 1 1 1 2 1
GAMMA 4 . . 1 1 1 2 1
RHO 1 qn11 1 1 1 1 1 1
.
.
.
RHO 4 qn59 2 1 1 1 1 1
;
run;
*Restrict latent class 5 prevalences to be equal across groups;
data restrictLC5;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 1 1 1 1 2
GAMMA 2 . . 1 1 1 1 2
GAMMA 3 . . 1 1 1 1 2
GAMMA 4 . . 1 1 1 1 2
RHO 1 qn11 1 1 1 1 1 1
.
.
.
RHO 4 qn59 2 1 1 1 1 1
;
run;
*Restrict all latent class prevalences to be equal across groups;
data restrict_all;
input PARAM $ GROUP VARIABLE $ RESPCAT ESTLC1 ESTLC2 ESTLC3 ESTLC4 ESTLC5;
datalines;
GAMMA 1 . . 2 3 4 5 6
GAMMA 2 . . 2 3 4 5 6
GAMMA 3 . . 2 3 4 5 6
GAMMA 4 . . 2 3 4 5 6
RHO 1 qn11 1 1 1 1 1 1
.
.
.
RHO 4 qn59 2 1 1 1 1 1
;
run;
proc lca data=bygrade outparam=bygrade_start;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
seed 941864;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrictLC1;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrictLC2;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrictLC3;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrictLC4;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrictLC5;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
proc lca data=bygrade start=bygrade_start restrict=restrict_all;
nclass 5;
items qn11 qn29 qn34 qn40 qn42 qn45 qn48 qn50 qn52 qn53 qn58 qn59;
categories 2 2 2 2 2 2 2 2 2 2 2 2;
groups grade;
groupnames ninth tenth eleventh twelfth;
measurement groups;
run;
Chapter 6 LCA with covariates
Table 6.3 Gender as a Predictor of Membership in Latent Classes of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start;
title2 ‘Covariate: male’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
covariates male;
reference 3;
run;
Table 6.4 Maternal Education as a Predictor of Membership in Latent Classes of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start;
title2 ‘Covariate: momed’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
covariates momed;
reference 3;
run;
Table 6.5 Gender and Maternal Education as Predictors of Membership in Latent Classes of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start;
title2 ‘Covariates: male, momed, male X momed’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
covariates male momed maleXed;
reference 3;
run;
Table 6.7 Maternal Education as a Predictor of Membership in Latent Classes of Positive Health Behaviors, with Gender as a Grouping Variable (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start_group;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
measurement groups;
covariates momed;
reference 3;
run;
Table 6.8 Binomial Logistic Regression with Gender as a Covariate in Model of Positive Health Behaviors (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start;
title2 ‘Covariate: male (binary): Healthy v. other classes’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
covariates male;
binary 4;
run;
Table 6.9 Binomial Logistic Regression Model with Gender and Maternal Education as Covariates (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start;
title2 ‘Covariate: male, momed (binary): Healthy v. other classes’;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
covariates male momed maleXed;
binary 4;
run;
Table 6.11 Binomial Logistic Regression with Gender as a Grouping Variable and Maternal Education as a Covariate in Model of Positive Health Behavior (Monitoring the Future Data, 2004; N = 2,065)
proc lca data=book_mtf.mtf_complete start=start_group;
id caseid;
nclass 5;
items brkfast3 veggies3 fruit3 exer3 sleep3;
categories 3 3 3 3 3;
groups gender;
groupnames male female;
measurement groups;
covariates momed;
binary 4;
run;
PART III: LATENT CLASS MODELS FOR LONGITUDINAL DATA
Chapter 7 RMLCA and LTA
Table 7.6 Summary of Information for Selecting Number of Latent Statuses of Adolescent Delinquency at Two Times (Add Health Public Use Data, Waves I and II, N = 2,087)
proc lta data=delinq2;
ntimes 2;
nstatus 2;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
proc lta data=delinq2;
ntimes 2;
nstatus 3;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
proc lta data=delinq2;
ntimes 2;
nstatus 4;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
proc lta data=delinq2;
ntimes 2;
nstatus 5;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
proc lta data=delinq2;
ntimes 2;
nstatus 6;
items lie1 rowdy1 damage1 stl_str1 stl_sm1 fghtgrp1
lie2 rowdy2 damage2 stl_str2 stl_sm2 fghtgrp2;
categories 2 2 2 2 2 2;
measurement times;
seed 741620;
run;
Table 7.9 Summary of Information for Selecting Number of Latent Statuses of Adolescent Depression (Add Health Public Use Data, Waves I and II; N = 2,061)
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 2;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 3;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 4;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 6;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 7;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
Table 7.10 Five Latent Status Model of Adolescent Depression (Add Health Public Use Data, Waves I and II; N = 2,061)
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
Table 7.11 Summary of Information for Selecting Number of Latent Statuses of Dating and Sexual Risk Behavior (NLSY, Rounds 2–4, N = 2,937)
proc lta data=pgm.sex_recoded;
title1 ‘Overall: LTA model, 2 statuses’;
nstatus 2;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded;
title1 ‘Overall: LTA model, 3 statuses’;
nstatus 3;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded;
title1 ‘Overall: LTA model, 4 statuses’;
nstatus 4;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded;
title1 ‘Model 1. Five-status Model for Dating and Sexual Behavior’;
nstatus 5;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded start=lta5_start;
title1 ‘Overall: LTA model, 5 statuses, starting values provided’;
nstatus 5;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded;
title1 ‘Overall: LTA model, 6 statuses’;
nstatus 6;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
proc lta data=pgm.sex_recoded;
title1 ‘Overall: LTA model, 6 statuses, starting values provided (2 times)’;
nstatus 6;
ntimes 2;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
Table 7.12 Five Latent Status Model of Dating and Sexual Risk Behavior (NLSY, Rounds 2–4, N = 2,937)
proc lta data=pgm.sex_recoded;
title1 ‘Model 1. Five-status Model for Dating and Sexual Behavior’;
nstatus 5;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
seed 592667;
run;
Table 7.14 Fit Statistics for Test of Measurement Invariance Across Times for Adolescent Depression Example (Add Health Public Use Data, Waves I and II; N = 2,061)
*Model 1. Measurement invariance across times;
proc lta data=depress2 outparam=lta_param;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
*Model 2. Measurement allowed to vary across times;
proc lta data=depress2 start=lta_param;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
run;
Table 7.16 Fit Statistics for Test of Hypothesis That Latent Status Membership Is Identical at Times 1 and 2 for Adolescent Depression Example (Add Health Public Use Data, Waves I and II; N = 2,061)
*Model 1: All transition probabilities estimated;
proc lta data=depress2;
title ‘Test 1, Model 1. All free transitions’;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
seed 941623;
run;
*Provide starting values (based on results from above model) with off-diagonal transition probabilities set to zero;
data diagonal_start;
input PARAM $ GROUP VARIABLE $ TIME STATUS RESPCAT ESTLS1 ESTLS2 ESTLS3 ESTLS4 ESTLS5;
datalines;
DELTA 1 . 1 . . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 1 . 1.0 0.0 0.0 0.0 0.0
TAU 1 . 1 2 . 0.0 1.0 0.0 0.0 0.0
TAU 1 . 1 3 . 0.0 0.0 1.0 0.0 0.0
TAU 1 . 1 4 . 0.0 0.0 0.0 1.0 0.0
TAU 1 . 1 5 . 0.0 0.0 0.0 0.0 1.0
RHO 1 w1fs3 1 . 1 0.485027 0.306962 0.965828 0.881622 0.188155
RHO 1 w1fs6 1 . 1 0.320137 0.159889 0.943201 0.817362 0.060703
RHO 1 w1fs13 1 . 1 0.454149 0.161459 0.935968 0.729633 0.152794
RHO 1 w1fs16 1 . 1 0.205187 0.080217 0.893252 0.659350 0.057685
RHO 1 w1fs9 1 . 1 0.870280 0.873970 0.986355 0.923322 0.111456
RHO 1 w1fs19 1 . 1 0.944607 0.942407 0.996598 0.952488 0.303881
RHO 1 w1fs14 1 . 1 0.839734 0.235905 0.908822 0.319105 0.350937
RHO 1 w1fs17 1 . 1 0.874677 0.117322 0.972950 0.329525 0.207397
RHO 1 w1fs3 1 . 2 0.514973 0.693038 0.034172 0.118378 0.811845
RHO 1 w1fs6 1 . 2 0.679863 0.840111 0.056799 0.182638 0.939297
RHO 1 w1fs13 1 . 2 0.545851 0.838541 0.064032 0.270367 0.847206
RHO 1 w1fs16 1 . 2 0.794813 0.919783 0.106748 0.340650 0.942315
RHO 1 w1fs9 1 . 2 0.129720 0.126030 0.013645 0.076678 0.888544
RHO 1 w1fs19 1 . 2 0.055393 0.057593 0.003402 0.047512 0.696119
RHO 1 w1fs14 1 . 2 0.160266 0.764095 0.091178 0.680895 0.649063
RHO 1 w1fs17 1 . 2 0.125323 0.882678 0.027050 0.670475 0.792603
RHO 1 w2fs3 2 . 1 0.485027 0.306962 0.965828 0.881622 0.188155
RHO 1 w2fs6 2 . 1 0.320137 0.159889 0.943201 0.817362 0.060703
RHO 1 w2fs13 2 . 1 0.454149 0.161459 0.935968 0.729633 0.152794
RHO 1 w2fs16 2 . 1 0.205187 0.080217 0.893252 0.659350 0.057685
RHO 1 w2fs9 2 . 1 0.870280 0.873970 0.986355 0.923322 0.111456
RHO 1 w2fs19 2 . 1 0.944607 0.942407 0.996598 0.952488 0.303881
RHO 1 w2fs14 2 . 1 0.839734 0.235905 0.908822 0.319105 0.350937
RHO 1 w2fs17 2 . 1 0.874677 0.117322 0.972950 0.329525 0.207397
RHO 1 w2fs3 2 . 2 0.514973 0.693038 0.034172 0.118378 0.811845
RHO 1 w2fs6 2 . 2 0.679863 0.840111 0.056799 0.182638 0.939297
RHO 1 w2fs13 2 . 2 0.545851 0.838541 0.064032 0.270367 0.847206
RHO 1 w2fs16 2 . 2 0.794813 0.919783 0.106748 0.340650 0.942315
RHO 1 w2fs9 2 . 2 0.129720 0.126030 0.013645 0.076678 0.888544
RHO 1 w2fs19 2 . 2 0.055393 0.057593 0.003402 0.047512 0.696119
RHO 1 w2fs14 2 . 2 0.160266 0.764095 0.091178 0.680895 0.649063
RHO 1 w2fs17 2 . 2 0.125323 0.882678 0.027050 0.670475 0.792603
;
run;
*Provide parameter restrictions (1 indicates freely estimated; 0 indicates fixed to starting value) to specify that off-diagonal transition probabilities are fixed to zero;
data diagonal_restrict;
input PARAM $ GROUP VARIABLE $ TIME STATUS RESPCAT ESTLS1 ESTLS2 ESTLS3 ESTLS4 ESTLS5;
datalines;
DELTA 1 . 1 . . 1 1 1 1 1
TAU 1 . 1 1 . 1 0 0 0 0
TAU 1 . 1 2 . 0 1 0 0 0
TAU 1 . 1 3 . 0 0 1 0 0
TAU 1 . 1 4 . 0 0 0 1 0
TAU 1 . 1 5 . 0 0 0 0 1
RHO 1 w1fs3 1 . 1 1 1 1 1 1
RHO 1 w1fs6 1 . 1 1 1 1 1 1
RHO 1 w1fs13 1 . 1 1 1 1 1 1
RHO 1 w1fs16 1 . 1 1 1 1 1 1
RHO 1 w1fs9 1 . 1 1 1 1 1 1
RHO 1 w1fs19 1 . 1 1 1 1 1 1
RHO 1 w1fs14 1 . 1 1 1 1 1 1
RHO 1 w1fs17 1 . 1 1 1 1 1 1
RHO 1 w1fs3 1 . 2 1 1 1 1 1
RHO 1 w1fs6 1 . 2 1 1 1 1 1
RHO 1 w1fs13 1 . 2 1 1 1 1 1
RHO 1 w1fs16 1 . 2 1 1 1 1 1
RHO 1 w1fs9 1 . 2 1 1 1 1 1
RHO 1 w1fs19 1 . 2 1 1 1 1 1
RHO 1 w1fs14 1 . 2 1 1 1 1 1
RHO 1 w1fs17 1 . 2 1 1 1 1 1
RHO 1 w2fs3 2 . 1 1 1 1 1 1
RHO 1 w2fs6 2 . 1 1 1 1 1 1
RHO 1 w2fs13 2 . 1 1 1 1 1 1
RHO 1 w2fs16 2 . 1 1 1 1 1 1
RHO 1 w2fs9 2 . 1 1 1 1 1 1
RHO 1 w2fs19 2 . 1 1 1 1 1 1
RHO 1 w2fs14 2 . 1 1 1 1 1 1
RHO 1 w2fs17 2 . 1 1 1 1 1 1
RHO 1 w2fs3 2 . 2 1 1 1 1 1
RHO 1 w2fs6 2 . 2 1 1 1 1 1
RHO 1 w2fs13 2 . 2 1 1 1 1 1
RHO 1 w2fs16 2 . 2 1 1 1 1 1
RHO 1 w2fs9 2 . 2 1 1 1 1 1
RHO 1 w2fs19 2 . 2 1 1 1 1 1
RHO 1 w2fs14 2 . 2 1 1 1 1 1
RHO 1 w2fs17 2 . 2 1 1 1 1 1
;
run;
*Model 2: Of-diagonal transition probabilities fixed to zero;
proc lta data=depress2 start=diagonal_start restrict=diagonal_restrict;
title ‘Test 1, Model 2. No transitions allowed’;
ntimes 2;
nstatus 5;
items w1fs3 w1fs6 w1fs13 w1fs16 w1fs9 w1fs19 w1fs14 w1fs17
w2fs3 w2fs6 w2fs13 w2fs16 w2fs9 w2fs19 w2fs14 w2fs17;
categories 2 2 2 2 2 2 2 2;
measurement times;
run;
Table 7.20 Five Latent Status Model of Dating and Sexual Risk Behavior with Transition Probability Matrices Constrained Equal Across Three Times (NLSY, Rounds 2–4, N = 2,937)
*Starting values for baseline model;
DATA LTA5_START;
INPUT PARAM $ GROUP VARIABLE $ TIME STATUS RESPCAT ESTSTATUS1 ESTSTATUS2 ESTSTATUS3 ESTSTATUS4 ESTSTATUS5;
DATALINES;
DELTA 1 . 1 . . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 1 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 2 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 3 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 4 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 1 5 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 2 1 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 2 2 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 2 3 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 2 4 . 0.2 0.2 0.2 0.2 0.2
TAU 1 . 2 5 . 0.2 0.2 0.2 0.2 0.2
RHO 1 datepar_alt_98 1 . 1 0.6 0.2 0.2 0.2 0.2
RHO 1 sex_yr_98 1 . 1 0.6 0.6 0.4 0.4 0.4
RHO 1 part_98 1 . 1 0.6 0.6 0.2 0.2 0.2
RHO 1 expos_98 1 . 1 0.6 0.6 0.4 0.6 0.4
RHO 1 datepar_alt_98 1 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 sex_yr_98 1 . 2 0.4 0.4 0.6 0.6 0.6
RHO 1 part_98 1 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 expos_98 1 . 2 0.4 0.4 0.6 0.4 0.6
RHO 1 datepar_alt_98 1 . 3 0.2 0.6 0.2 0.6 0.6
RHO 1 part_98 1 . 3 0.2 0.2 0.2 0.6 0.6
RHO 1 datepar_alt_98 2 . 1 0.6 0.2 0.2 0.2 0.2
RHO 1 sex_yr_98 2 . 1 0.6 0.6 0.4 0.4 0.4
RHO 1 part_98 2 . 1 0.6 0.6 0.2 0.2 0.2
RHO 1 expos_98 2 . 1 0.6 0.6 0.4 0.6 0.4
RHO 1 datepar_alt_98 2 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 sex_yr_98 2 . 2 0.4 0.4 0.6 0.6 0.6
RHO 1 part_98 2 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 expos_98 2 . 2 0.4 0.4 0.6 0.4 0.6
RHO 1 datepar_alt_98 2 . 3 0.2 0.6 0.2 0.6 0.6
RHO 1 part_98 2 . 3 0.2 0.2 0.2 0.6 0.6
RHO 1 datepar_alt_98 3 . 1 0.6 0.2 0.2 0.2 0.2
RHO 1 sex_yr_98 3 . 1 0.6 0.6 0.4 0.4 0.4
RHO 1 part_98 3 . 1 0.6 0.6 0.2 0.2 0.2
RHO 1 expos_98 3 . 1 0.6 0.6 0.4 0.6 0.4
RHO 1 datepar_alt_98 3 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 sex_yr_98 3 . 2 0.4 0.4 0.6 0.6 0.6
RHO 1 part_98 3 . 2 0.2 0.2 0.6 0.2 0.2
RHO 1 expos_98 3 . 2 0.4 0.4 0.6 0.4 0.6
RHO 1 datepar_alt_98 3 . 3 0.2 0.6 0.2 0.6 0.6
RHO 1 part_98 3 . 3 0.2 0.2 0.2 0.6 0.6
;
*Apply parameter restrictions such that transitions from Time 1 to Time 2 equal those from Time 2 to Time 3;
DATA LTA5_TAUSTABILITY_REST;
INPUT PARAM $ GROUP VARIABLE $ TIME STATUS RESPCAT ESTSTATUS1 ESTSTATUS2 ESTSTATUS3 ESTSTATUS4 ESTSTATUS5;
DATALINES;
DELTA 1 . 1 . . 1 1 1 1 1
TAU 1 . 1 1 . 10 11 12 13 14
TAU 1 . 1 2 . 15 16 17 18 19
TAU 1 . 1 3 . 20 21 22 23 24
TAU 1 . 1 4 . 25 26 27 28 29
TAU 1 . 1 5 . 30 31 32 33 34
TAU 1 . 2 1 . 10 11 12 13 14
TAU 1 . 2 2 . 15 16 17 18 19
TAU 1 . 2 3 . 20 21 22 23 24
TAU 1 . 2 4 . 25 26 27 28 29
TAU 1 . 2 5 . 30 31 32 33 34
RHO 1 datepar_alt_98 1 . 1 1 1 1 1 1
RHO 1 sex_yr_98 1 . 1 1 1 1 1 1
RHO 1 part_98 1 . 1 1 1 1 1 1
RHO 1 expos_98 1 . 1 1 1 1 1 1
RHO 1 datepar_alt_98 1 . 2 1 1 1 1 1
RHO 1 sex_yr_98 1 . 2 1 1 1 1 1
RHO 1 part_98 1 . 2 1 1 1 1 1
RHO 1 expos_98 1 . 2 1 1 1 1 1
RHO 1 datepar_alt_98 1 . 3 1 1 1 1 1
RHO 1 part_98 1 . 3 1 1 1 1 1
RHO 1 datepar_alt_98 2 . 1 1 1 1 1 1
RHO 1 sex_yr_98 2 . 1 1 1 1 1 1
RHO 1 part_98 2 . 1 1 1 1 1 1
RHO 1 expos_98 2 . 1 1 1 1 1 1
RHO 1 datepar_alt_98 2 . 2 1 1 1 1 1
RHO 1 sex_yr_98 2 . 2 1 1 1 1 1
RHO 1 part_98 2 . 2 1 1 1 1 1
RHO 1 expos_98 2 . 2 1 1 1 1 1
RHO 1 datepar_alt_98 2 . 3 1 1 1 1 1
RHO 1 part_98 2 . 3 1 1 1 1 1
RHO 1 datepar_alt_98 3 . 1 1 1 1 1 1
RHO 1 sex_yr_98 3 . 1 1 1 1 1 1
RHO 1 part_98 3 . 1 1 1 1 1 1
RHO 1 expos_98 3 . 1 1 1 1 1 1
RHO 1 datepar_alt_98 3 . 2 1 1 1 1 1
RHO 1 sex_yr_98 3 . 2 1 1 1 1 1
RHO 1 part_98 3 . 2 1 1 1 1 1
RHO 1 expos_98 3 . 2 1 1 1 1 1
RHO 1 datepar_alt_98 3 . 3 1 1 1 1 1
RHO 1 part_98 3 . 3 1 1 1 1 1
;
*Model 1. Taus freely estimated across all times;
proc lta data=pgm.sex_recoded start=lta5_start;
title1 ‘Overall: LTA model, 5 statuses, starting values provided’;
nstatus 5;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
run;
*Model 2. Stationarity in taus imposed;
proc lta data=pgm.sex_recoded start=lta5_start restrict=lta5_taustability_rest;
title1 ‘Overall: LTA model, 5 statuses, stationarity of taus’;
nstatus 5;
ntimes 3;
items datepar_alt_98 sex_yr_98 part_98 expos_98
datepar_alt_99 sex_yr_99 part_99 expos_99
datepar_alt_00 sex_yr_00 part_00 expos_00;
categories 3 2 3 2;
measurement time;
run;
Let’s stay in touch.
We are in this together. Receive an email whenever a new model or resource is added to the Knowledge Base.