Added slides, day 4 (powerpoint)

Reading and writing raw data
files:
See previous slides and file examples for
instructions re covariance matrices
Writing from SPSS:
recode v1 to v16 (missing,sysmiss=999).
missing values v1 to v16 (-999).
write outfile = ‘c:\temp\myfile2.dat’ /
v1 v2 v4 v8 to v16 (15F5.0).
3 new slides: see handout
execute.
1
• SAS:
libname sas2 ‘c:\temp’;  location of SAS file
filename out2 ‘c:\temp\rawdata1.dat’;
data; set sas2.mydata;
array a1 v1 -- v16;
do over a1; if a1=. then a1=999;
end;
file out2 ls=150;
put (v1 v2 v4 v5--v16)(15*10.3);
run;
2
STATA
outfile v1 v2 v4 v5-v16 using
c:\temp\rawdata1.dat, nolabel wide
3
Reading raw data into MPlus
Data:
File is c:\temp\rawdata1.dat;
Listwise = ON;
 if required; otherwise uses
FIML estimation for missing data
VARIABLE: Names are v1 v2 v4 v5 v6 v7 v8 v9
V10 v11 v12 v13 v14 v15 v16;
Missing are ALL (999);
Grouping is (1=male 2=female); <- if multiple group problem
4
New slide: also on file Day3(Wrapup)
Two-Tailed
Estimate
S.E.
Est./S.E.
P-Value
Group G1
ALC
ON
AGE
EDUC
PERINC
WORK
-0.116
0.050
0.191
0.266
0.010
0.023
0.041
0.071
-11.346
2.160
4.700
3.741
0.000
0.031
0.000
0.000
Group 2
ALC
ON
AGE
EDUC
PERINC
WORK
-0.116
0.050
0.058
0.266
0.010
0.023
0.032
0.071
-11.346
2.160
1.785
3.741
0.000
0.031
0.074
0.000
Estimate
Intercepts
ALC
MENTHLTH
Males:
Females:
S.E.
Est./S.E.
-0.604
-2.113
P-Value
0.164
0.517
Alc = 0 + .191*Perinc
Alc = -.604 + .058*Perinc
-3.680
-4.085
0.000
0.000
Perinc score ranges from
1 through 6
1.4
1.2
1
0.8
0.6
0.4
Males
0.2
Females
0
-0.2
-0.4
-0.6
-0.8
1
3.5
6
Much trickier if more than 1 X-variable
has non-parallel slope
Males:
Females:
Alc = 0 + .191*Perinc
Alc = -.604 + .058*Perinc
Problem: this estimated difference would now only
apply when the other X-variable(s) has a score of 0
E.g., only applicable when education = 0
Usually, we’ll want to hold other variables constant
at their means.
One solution: mean-centre the variables (not an issue with latent variables, where
means are 0 by default in group 1; only an issue with single-indicator manifest Xvariables).
Or, do some additional calculations:
Males: Alc = 0 + [ed coefficient [males]* mean of educ] + .191*perinc
Females: Alc = -.604 + [ed coffficient[females]* mean of educ] + .058*perinc
Factor of curves
common
intercept
1
lambda3
lambda2
1
1
x2-Intercept
x1-intercept
1
1
x3-intercept
1
1
1
x1-t2 x2-t2 x3-t2 x1-t3 x2-t3 x3-t3
x1-t1 x2-t1 x3-t1
0
1
10
2
x2-slope
x1-slope
2
1
1
1
1
x3-slope
1
lambda3a
lambda2a
common slope
8
see Duncan & al, Introduction to
Latent Variable Growth Curve
Modeling , 1999, chapter 5 for a
brief discussion
alternative, “curve of factors”
parm2,
parm1,
Intercept
1
0, 0 1
zero intercept
one indicator
per factor
1
Slope
0
1
1
2
0
0
0
F1-t2
F1-t1
F1-t3
1
1
1
0
x1t1
1
0,
1
0, 0
1
0
x2t1
1
0,
**This is a new slide
x3t1
1
0,
x1t2
1
0,
0, 0
0
x2t2
1
0,
x3t2
1
0,
x1t3
1
0,
x2t3
1
0,
x3t3
1
0,
9
factor of curves vs. curve of
factors
• factor of curves more parsimonious
• difficult to choose from the 2
• curve of factors probably more common
(for example, it is this approach that we see in Bollen
and Curran, Latent Curve Models: A Structural Equation
Perspective, p. 246ff.)
Exercise #6 used the “curve of factors”
approach, which is more common
**This is a new slide
10
Model:
Disab1 BY move1@1;
Disab2 BY move2@1 ;
Disab3 BY move3@1 ;
Disab1 BY sense1 (1);
Disab2 BY sense2 (1);
Disab3 BY sense3 (1);
Disab1 BY task1 (2);
Disab2 BY task2 (2);
Disab3 BY task3 (2);
[move1@0];
Fix mean of 3 latent variables (one LV
[move2@0];
for each time point) to mean of move
[move3@0]
[task1] (3);
indicator)
[sense1] (4);
[task2] (3);
[sense2] (4);
[task3] (3);
But, with LV means (technically intercepts)
[sense3] (4);
set to zero, values passed on to the int
[Disab1@0] ;
variable.
[Disab2@0];
[Disab3@0];
sense1 WITH sense2;
Int variable will have mean approx
sense2 WITH sense3;
= mean of move1
sense1 WITH sense3;
Int BY Disab1@1 Disab2@1 Disab3@1;
Slope BY Disab1@0 Disab2@1 Disab3@2;
[Int];
[Slope];
From yesterday’s exercise #6
11
Means
INT
SLOPE
Intercepts
MOVE1
TASK1
SENSE1
MOVE2
TASK2
SENSE2
MOVE3
TASK3
SENSE3
DISAB1
DISAB2
DISAB3
4.102
0.279
0.056
0.024
73.232
11.393
0.000
0.000
0.000
0.259
1.706
0.000
0.259
1.706
0.000
0.259
1.706
0.000
0.000
0.000
0.000
0.059
0.087
0.000
0.059
0.087
0.000
0.059
0.087
0.000
0.000
0.000
999.000
4.366
19.534
999.000
4.366
19.534
999.000
4.366
19.534
999.000
999.000
999.000
999.000
0.000
0.000
999.000
0.000
0.000
999.000
0.000
0.000
999.000
999.000
999.000
12
Disab1 BY move1@1;
An alternative
parameterization
Disab2 BY move2@1 ;
Disab3 BY move3@1 ;
Disab1 BY sense1 (1);
Disab2 BY sense2 (1);
Disab3 BY sense3 (1);
Disab1 BY task1 (2);
Disab2 BY task2 (2);
Disab3 BY task3 (2);
[move1] (5);
[move2] (5);
Not = 0 but equality constraints
[move3] (5);
time, just like other 2 indicators
[task1] (3);
[sense1] (4);
[task2] (3);
[sense2] (4);
[task3] (3);
[sense3] (4);
[Disab1@0] ;
[Disab2@0];
[Disab3@0];
sense1 WITH sense2;
sense2 WITH sense3;
sense1 WITH sense3;
Int BY Disab1@1 Disab2@1 Disab3@1;
Slope BY Disab1@0 Disab2@1 Disab3@2;
Must fix to
[Int@0];
zero
[Slope];
task2 WITH task1;
across
13
This model includes correlated errors for the sense
indicator
INT
ON
ED
BLACK
YEARBORN
WORKING
RETIRED
-0.084
0.575
0.016
-0.600
-0.257
0.018
0.230
0.006
0.147
0.133
-4.602
2.504
2.638
-4.070
-1.927
0.000
0.012
0.008
0.000
0.054
SLOPE
ON
ED
BLACK
YEARBORN
WORKING
RETIRED
-0.012
-0.183
0.009
0.043
0.064
0.008
0.106
0.003
0.068
0.062
-1.389
-1.725
3.032
0.635
1.034
0.165
0.085
0.002
0.526
0.301
14
Also a gender effect:
(we didn’t include gender in Ex. #6)
INT
ON
ED
BLACK
YEARBORN
WORKING
RETIRED
SEX
-0.082
0.566
0.015
-0.564
-0.208
-0.174
0.018
0.229
0.006
0.149
0.137
0.109
-4.476
2.469
2.458
-3.788
-1.523
-1.592
0.000
0.014
0.014
0.000
0.128
0.111
SLOPE
ON
ED
BLACK
YEARBORN
WORKING
RETIRED
SEX
-0.010
-0.188
0.008
0.066
0.095
-0.110
0.008
0.106
0.003
0.069
0.063
0.050
-1.224
-1.782
2.795
0.967
1.506
-2.189
0.221
0.075
0.005
0.334
0.132
0.029
Sex 1=male 0=female
15
A more complex model, sometimes with
slopes predicting slopes
• Be careful of causal order issues though
INT
ON
YEARBORN
ED
SEX
0.199
-0.230
-0.100
0.044
0.044
0.044
4.545
-5.293
-2.275
0.000
0.000
0.023
SLOPE
ON
YEARBORN
ED
SEX
0.260
-0.052
-0.113
0.062
0.063
0.062
4.181
-0.823
-1.809
0.000
0.411
0.070
Int = intercept for disability
Slope = slope for disability
16
A more complex model, sometimes with
slopes predicting slopes
Predicting earnings INT:
z
EARNINT ON
INT
YEARBORN
ED
SEX
-0.159
0.004
0.273
0.269
0.043
0.052
0.031
0.050
-3.738
0.075
8.889
5.357
0.000
0.940
0.000
0.000
Int = intercept for disability
Slope = slope for disability
17
Predicting earnings slope:
EARNSLOP ON
INT
SLOPE
EARNSLOP ON
YEARBORN
ED
SEX
-0.036
0.015
0.051
0.083
-0.701
0.175
0.483
0.861
-0.130
0.107
0.089
0.061
0.035
0.058
-2.127
3.112
1.530
0.033
0.002
0.126
Int = intercept for disability
Slope = slope for disability
18
Predicting alcohol consumption slope!
ALCSLOP ON
INT
SLOPE
EARNINT
EARNSLOP
YEARBORN
ED
SEX
0.095
-0.115
0.246
-0.301
-0.125
-0.031
-0.010
0.072
0.116
0.122
0.113
0.086
0.055
0.083
1.311
-0.990
2.011
-2.660
-1.455
-0.552
-0.121
0.190
0.322
0.044
0.008
0.146
0.581
0.904
Int = intercept for disability
Slope = slope for disability
19
piecewise latent curve model
parm33R
M
0,
parm2,
parm1,
Slope1
Intercept
0
0
1
Slope2
2
1
1
not shown: 0 path (not
needed!) from slope2
to v1-t1, v1-t2
2
1
2
2
1
Slope1: change from
time 1 through time 3
Slope 2: Change from
time 3 through time 5
v1-t1
1
0,
v1-t2
1
0,
v1-t3
v1-t4
v1-t5
1
0,
1
0,
1
0,
New slide not
previously
discussed
20