Mplus VERSION 8
MUTHEN & MUTHEN
04/10/2017 3:33 AM
INPUT INSTRUCTIONS
TITLE: this is an example of two-level univariate first-order
autoregressive AR(1) model with a random intercept,
random AR(1), and random residual variance
Step 1: although we are interested in a twolevel model
we generate data using cross-classified analysis
with an empty Between time model to be able to
save data with subject and time variables.
Missing data on y is created by Model Missing
MONTECARLO: NAMES ARE y w z u;
NOBS = 20000;
NREPS = 1;
CSIZES = 200[100(1)];
NCSIZES = 1[1];
lagged = y(1);
between = (level2b) w z;
missing = y;
! u is needed if there are several y's to make all of them
! have missing at the same time
generate = u(1);
categorical = u;
within = u;
save = ex9.30step1.dat;
MODEL MISSING:
[y@-15]; ! no MCAR missing
y on u@30; ! missing 50% on y;
ANALYSIS: TYPE = CROSSCLASSIFIED RANDOM;
estimator=bayes;
proc=2;
fbiter=(200); ! full convergence not needed to save the right data
MODEL POPULATION:
%WITHIN%
s | y on y&1;
logv | y;
[u$1*0];
%BETWEEN level2a% ! empty
y@0; s@0;
%BETWEEN level2b%
w*1;
y on w*.3;
y*0.09;
s on w*.1;
s*.01; [s*.3];
logv on w*.3;
logv*0; [logv*0];
z on y*.5 s*.7 logv*.3;
z*0.05;
MODEL:
%WITHIN%
s | y on y&1;
logv | y;
[u$1*0];
%BETWEEN level2a% ! empty
y@0; s@0;
%BETWEEN level2b%
y on w*.3;
y*0.09;
s on w*.1;
s*.01; [s*.3];
logv on w*.3;
logv*0; [logv*0];
z on y*.5 s*.7 logv*.3;
z*0.05;
OUTPUT:
tech8;
*** WARNING in MODEL command
Variable is uncorrelated with all other variables: U
*** WARNING in MODEL command
At least one variable is uncorrelated with all other variables in the model.
Check that this is what is intended.
2 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS
this is an example of two-level univariate first-order
autoregressive AR(1) model with a random intercept,
random AR(1), and random residual variance
Step 1: although we are interested in a twolevel model
we generate data using cross-classified analysis
with an empty Between time model to be able to
save data with subject and time variables.
Missing data on y is created by Model Missing
SUMMARY OF ANALYSIS
Number of groups 1
Number of observations 20000
Number of replications
Requested 1
Completed 1
Value of seed 0
Number of dependent variables 3
Number of independent variables 2
Number of continuous latent variables 2
Observed dependent variables
Continuous
Z Y
Binary and ordered categorical (ordinal)
U
Observed independent variables
W Y&1
Continuous latent variables
S LOGV
Variables with special functions
Within variables
U Y&1
Level 2b between variables
W Z
Estimator BAYES
Specifications for Bayesian Estimation
Point estimate MEDIAN
Number of Markov chain Monte Carlo (MCMC) chains 2
Random seed for the first chain 0
Starting value information UNPERTURBED
Treatment of categorical mediator LATENT
Algorithm used for Markov chain Monte Carlo GIBBS(PX1)
Fixed number of iterations 200
K-th iteration used for thinning 1
Link PROBIT
SUMMARY OF DATA FOR THE FIRST REPLICATION
Cluster information
Number of level 2a clusters 100
Number of level 2b clusters 200
SUMMARY OF MISSING DATA PATTERNS FOR THE FIRST REPLICATION
Number of missing data patterns 4
MISSING DATA PATTERNS (x = not missing)
1 2 3 4
U x x x x
Z x x x x
Y x x
Y&1 x x
W x x x x
MISSING DATA PATTERN FREQUENCIES
Pattern Frequency Pattern Frequency Pattern Frequency
1 9936 3 58
2 9963 4 43
COVARIANCE COVERAGE OF DATA FOR THE FIRST REPLICATION
Minimum covariance coverage value 0.100
PROPORTION OF DATA PRESENT
Covariance Coverage
U Z Y W
________ ________ ________ ________
U 1.000
Z 1.000 1.000
Y 0.500 0.500 0.500
W 1.000 1.000 0.500 1.000
MODEL FIT INFORMATION
Number of Free Parameters 15
MODEL RESULTS
ESTIMATES S. E. M. S. E. 95% % Sig
Population Average Std. Dev. Average Cover Coeff
Within Level
Thresholds
U$1 0.000 -0.0009 0.0000 0.0086 0.0000 1.000 0.000
Between LEVEL2A Level
Variances
Y 0.000 0.0000 0.0000 0.0000 0.0000 1.000 0.000
S 0.000 0.0000 0.0000 0.0000 0.0000 1.000 0.000
Between LEVEL2B Level
S ON
W 0.100 0.1254 0.0000 0.0134 0.0006 1.000 1.000
LOGV ON
W 0.300 0.2968 0.0000 0.0125 0.0000 1.000 1.000
Z ON
S 0.700 0.6285 0.0000 0.2694 0.0051 1.000 1.000
LOGV 0.300 0.3233 0.0000 0.1333 0.0005 1.000 1.000
Y ON
W 0.300 0.2859 0.0000 0.0245 0.0002 1.000 1.000
Z ON
Y 0.500 0.4899 0.0000 0.0587 0.0001 1.000 1.000
Intercepts
Z 0.000 0.0264 0.0000 0.0815 0.0007 1.000 0.000
Y 0.000 -0.0216 0.0000 0.0303 0.0005 1.000 0.000
S 0.300 0.2937 0.0000 0.0162 0.0000 1.000 1.000
LOGV 0.000 -0.0261 0.0000 0.0128 0.0007 1.000 0.000
Residual Variances
Z 0.050 0.0470 0.0000 0.0068 0.0000 1.000 1.000
Y 0.090 0.1032 0.0000 0.0122 0.0002 1.000 1.000
S 0.010 0.0128 0.0000 0.0029 0.0000 1.000 1.000
LOGV 0.000 0.0058 0.0000 0.0020 0.0000 0.000 1.000
CORRELATIONS AND MEAN SQUARE ERROR OF THE TRUE FACTOR VALUES AND THE FACTOR SCORES
CORRELATIONS MEAN SQUARE ERROR
Average Std. Dev. Average Std. Dev.
S%2a 0.000 0.000 0.029 0.000
LOGV%2a 0.000 0.000 0.034 0.000
S%2b 0.821 0.000 0.091 0.000
LOGV%2b 0.991 0.000 0.055 0.000
B2a_Y 0.356 0.000 0.028 0.000
B2b_Y 0.940 0.000 0.150 0.000
TECHNICAL 1 OUTPUT
PARAMETER SPECIFICATION FOR WITHIN
TAU
U$1
________
15
NU
U Y Y&1
________ ________ ________
0 0 0
LAMBDA
Y Y&1
________ ________
U 0 0
Y 0 0
Y&1 0 0
THETA
U Y Y&1
________ ________ ________
U 0
Y 0 0
Y&1 0 0 0
ALPHA
Y Y&1
________ ________
0 0
BETA
Y Y&1
________ ________
Y 0 0
Y&1 0 0
PSI
Y Y&1
________ ________
Y 0
Y&1 0 0
PARAMETER SPECIFICATION FOR BETWEEN LEVEL2A
NU
Y
________
0
LAMBDA
S%2a LOGV%2a Y
________ ________ ________
Y 0 0 0
THETA
Y
________
Y 0
ALPHA
S%2a LOGV%2a Y
________ ________ ________
0 0 0
BETA
S%2a LOGV%2a Y
________ ________ ________
S%2a 0 0 0
LOGV%2a 0 0 0
Y 0 0 0
PSI
S%2a LOGV%2a Y
________ ________ ________
S%2a 0
LOGV%2a 0 0
Y 0 0 0
PARAMETER SPECIFICATION FOR BETWEEN LEVEL2B
NU
Z Y W
________ ________ ________
0 0 0
LAMBDA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
Z 0 0 0 0 0
Y 0 0 0 0 0
W 0 0 0 0 0
THETA
Z Y W
________ ________ ________
Z 0
Y 0 0
W 0 0 0
ALPHA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
1 2 3 4 0
BETA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 0 0 0 0 5
LOGV%2b 0 0 0 0 6
Z 7 8 0 9 0
Y 0 0 0 0 10
W 0 0 0 0 0
PSI
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 11
LOGV%2b 0 12
Z 0 0 13
Y 0 0 0 14
W 0 0 0 0 0
STARTING VALUES FOR WITHIN
TAU
U$1
________
0.000
NU
U Y Y&1
________ ________ ________
0.000 0.000 0.000
LAMBDA
Y Y&1
________ ________
U 0.000 0.000
Y 1.000 0.000
Y&1 0.000 1.000
THETA
U Y Y&1
________ ________ ________
U 1.000
Y 0.000 0.000
Y&1 0.000 0.000 0.000
ALPHA
Y Y&1
________ ________
0.000 0.000
BETA
Y Y&1
________ ________
Y 0.000 0.000
Y&1 0.000 0.000
PSI
Y Y&1
________ ________
Y 0.000
Y&1 0.000 0.500
STARTING VALUES FOR BETWEEN LEVEL2A
NU
Y
________
0.000
LAMBDA
S%2a LOGV%2a Y
________ ________ ________
Y 0.000 0.000 1.000
THETA
Y
________
Y 0.000
ALPHA
S%2a LOGV%2a Y
________ ________ ________
0.000 0.000 0.000
BETA
S%2a LOGV%2a Y
________ ________ ________
S%2a 0.000 0.000 0.000
LOGV%2a 0.000 0.000 0.000
Y 0.000 0.000 0.000
PSI
S%2a LOGV%2a Y
________ ________ ________
S%2a 0.000
LOGV%2a 0.000 0.000
Y 0.000 0.000 0.000
STARTING VALUES FOR BETWEEN LEVEL2B
NU
Z Y W
________ ________ ________
0.000 0.000 0.000
LAMBDA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
Z 0.000 0.000 1.000 0.000 0.000
Y 0.000 0.000 0.000 1.000 0.000
W 0.000 0.000 0.000 0.000 1.000
THETA
Z Y W
________ ________ ________
Z 0.000
Y 0.000 0.000
W 0.000 0.000 0.000
ALPHA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
0.300 0.000 0.000 0.000 0.000
BETA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 0.000 0.000 0.000 0.000 0.100
LOGV%2b 0.000 0.000 0.000 0.000 0.300
Z 0.700 0.300 0.000 0.500 0.000
Y 0.000 0.000 0.000 0.000 0.300
W 0.000 0.000 0.000 0.000 0.000
PSI
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 0.010
LOGV%2b 0.000 0.000
Z 0.000 0.000 0.050
Y 0.000 0.000 0.000 0.090
W 0.000 0.000 0.000 0.000 0.500
POPULATION VALUES FOR WITHIN
TAU
U$1
________
0.000
NU
U Y Y&1
________ ________ ________
0.000 0.000 0.000
LAMBDA
Y Y&1
________ ________
U 0.000 0.000
Y 1.000 0.000
Y&1 0.000 1.000
THETA
U Y Y&1
________ ________ ________
U 0.000
Y 0.000 0.000
Y&1 0.000 0.000 0.000
ALPHA
Y Y&1
________ ________
0.000 0.000
BETA
Y Y&1
________ ________
Y 0.000 0.000
Y&1 0.000 0.000
PSI
Y Y&1
________ ________
Y 0.000
Y&1 0.000 1.000
POPULATION VALUES FOR BETWEEN LEVEL2A
NU
Y
________
0.000
LAMBDA
S%2a LOGV%2a Y
________ ________ ________
Y 0.000 0.000 1.000
THETA
Y
________
Y 0.000
ALPHA
S%2a LOGV%2a Y
________ ________ ________
0.000 0.000 0.000
BETA
S%2a LOGV%2a Y
________ ________ ________
S%2a 0.000 0.000 0.000
LOGV%2a 0.000 0.000 0.000
Y 0.000 0.000 0.000
PSI
S%2a LOGV%2a Y
________ ________ ________
S%2a 0.000
LOGV%2a 0.000 0.000
Y 0.000 0.000 0.000
POPULATION VALUES FOR BETWEEN LEVEL2B
NU
Z Y W
________ ________ ________
0.000 0.000 0.000
LAMBDA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
Z 0.000 0.000 1.000 0.000 0.000
Y 0.000 0.000 0.000 1.000 0.000
W 0.000 0.000 0.000 0.000 1.000
THETA
Z Y W
________ ________ ________
Z 0.000
Y 0.000 0.000
W 0.000 0.000 0.000
ALPHA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
0.300 0.000 0.000 0.000 0.000
BETA
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 0.000 0.000 0.000 0.000 0.100
LOGV%2b 0.000 0.000 0.000 0.000 0.300
Z 0.700 0.300 0.000 0.500 0.000
Y 0.000 0.000 0.000 0.000 0.300
W 0.000 0.000 0.000 0.000 0.000
PSI
S%2b LOGV%2b Z Y W
________ ________ ________ ________ ________
S%2b 0.010
LOGV%2b 0.000 0.000
Z 0.000 0.000 0.050
Y 0.000 0.000 0.000 0.090
W 0.000 0.000 0.000 0.000 1.000
PRIORS FOR ALL PARAMETERS PRIOR MEAN PRIOR VARIANCE PRIOR STD. DEV.
Parameter 1~N(0.000,infinity) 0.0000 infinity infinity
Parameter 2~N(0.000,infinity) 0.0000 infinity infinity
Parameter 3~N(0.000,infinity) 0.0000 infinity infinity
Parameter 4~N(0.000,infinity) 0.0000 infinity infinity
Parameter 5~N(0.000,infinity) 0.0000 infinity infinity
Parameter 6~N(0.000,infinity) 0.0000 infinity infinity
Parameter 7~N(0.000,infinity) 0.0000 infinity infinity
Parameter 8~N(0.000,infinity) 0.0000 infinity infinity
Parameter 9~N(0.000,infinity) 0.0000 infinity infinity
Parameter 10~N(0.000,infinity) 0.0000 infinity infinity
Parameter 11~IG(-1.000,0.000) infinity infinity infinity
Parameter 12~IG(-1.000,0.000) infinity infinity infinity
Parameter 13~IG(-1.000,0.000) infinity infinity infinity
Parameter 14~IG(-1.000,0.000) infinity infinity infinity
Parameter 15~N(0.000,5.000) 0.0000 5.0000 2.2361
TECHNICAL 8 OUTPUT
REPLICATION 1:
Kolmogorov-Smirnov comparing posterior distributions across chains 1 and 2 using 100 draws.
Parameter KS Statistic P-value
Parameter 6 0.1100 0.5560
Parameter 3 0.1100 0.5560
Parameter 7 0.1000 0.6766
Parameter 9 0.0900 0.7942
Parameter 2 0.0700 0.9610
Parameter 8 0.0700 0.9610
Parameter 5 0.0500 0.9995
Parameter 10 0.0400 1.0000
Parameter 1 0.0300 1.0000
Parameter 4 0.0100 1.0000
Parameter 14 0.0000 1.0000
Parameter 11 0.0000 1.0000
Parameter 12 0.0000 1.0000
Parameter 13 0.0000 1.0000
Parameter 15 0.0000 1.0000
Simulated prior distributions
Parameter Prior Mean Prior Variance Prior Std. Dev.
Parameter 1 Improper Prior
Parameter 2 Improper Prior
Parameter 3 Improper Prior
Parameter 4 Improper Prior
Parameter 5 Improper Prior
Parameter 6 Improper Prior
Parameter 7 Improper Prior
Parameter 8 Improper Prior
Parameter 9 Improper Prior
Parameter 10 Improper Prior
Parameter 11 Improper Prior
Parameter 12 Improper Prior
Parameter 13 Improper Prior
Parameter 14 Improper Prior
Parameter 15 0.0050 4.9231 2.2188
TECHNICAL 8 OUTPUT FOR BAYES ESTIMATION
CHAIN BSEED
1 0
2 285380
REPLICATION 1:
POTENTIAL PARAMETER WITH
ITERATION SCALE REDUCTION HIGHEST PSR
100 1.221 8
200 1.113 6
SAVEDATA INFORMATION
Order of variables
U
Z
Y
W
LEVEL2A
LEVEL2B
Y&1
Save file
ex9.30step1.dat
Save file format Free
Save file record length 10000
Missing designated by 999
Beginning Time: 03:33:27
Ending Time: 03:40:51
Elapsed Time: 00:07:24
MUTHEN & MUTHEN
3463 Stoner Ave.
Los Angeles, CA 90066
Tel: (310) 391-9971
Fax: (310) 391-8971
Web: www.StatModel.com
Support: Support@StatModel.com
Copyright (c) 1998-2017 Muthen & Muthen
Back to examples