UCLA Academic Technology Services HomeServicesClassesContactJobs

Mplus Textbook Examples
Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence
by Judith D. Singer and John B. Willett
Chapter 5: Treating time more flexibly


NOTE:  This page is under construction.

Table 5.2, page 145

Table 5.2 uses data file reading.dat. Note the format of this file, that it is in wide form.  Here is a display of the first 10 observations.

. list  id  cage1 cage2 cage3 cagegrp1 cagegrp2 cagegrp3 piat1 piat2 piat3

+-----------------------------------------------------------------------------------------------+
| id       cage1      cage2      cage3   cagegrp1   cagegrp2   cagegrp3   piat1   piat2   piat3 |
|-----------------------------------------------------------------------------------------------|
|  1         -.5   1.833333   3.833333          0          2          4      18      35      59 |
|  2         -.5          2   4.083333          0          2          4      18      25      28 |
|  3   -.4166665   1.916667   3.916667          0          2          4      18      23      32 |
|  4         -.5          2   4.166667          0          2          4      18      31      50 |
|  5         -.5   1.666667       3.75          0          2          4      18      33      53 |
|-----------------------------------------------------------------------------------------------|
|  6         -.5          2          4          0          2          4      18      28      31 |
|  7   -.4166665          2          4          0          2          4      17      28      28 |
|  8         -.5   1.916667   4.083333          0          2          4      17      29      41 |
|  9   -.3333335       2.25   4.333333          0          2          4      28      26      26 |
| 10   -.3333335   1.916667   3.916667          0          2          4      16      20      21 |
|-----------------------------------------------------------------------------------------------|

Model A: Using AGEGRPi-6.5 as a temporal predictor, called cagegrpi (i.e., cagegrp1 cagegrp2 cagegrp3).  These were created before making the data file.

Title: 
  Table 5.2, Model A.
Data:  
  File is c:\alda\reading.dat ;
Variable: 
  Names are 
     id agegrp1 agegrp2 agegrp3 age1 age2 age3 piat1 piat2 piat3 cage1
     cage2 cage3 cagegrp1 cagegrp2 cagegrp3;
  Missing are all (-999999999) ; 
  Usevariables are
     piat1 piat2 piat3 cagegrp1 cagegrp2 cagegrp3;
  Tscores cagegrp1-cagegrp3 ;
Analysis: 
  Type = random ;
  estimator = ml;
Model:
  i s | piat1-piat3 at cagegrp1-cagegrp3 ;
  i with s;
  piat1-piat3 (1) ;
------------------------------------------------------------------------------------------------
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                        -909.978
Information Criteria
          Number of Free Parameters              6
          Akaike (AIC)                    1831.956
          Bayesian (BIC)                  1846.888
          Sample-Size Adjusted BIC        1827.953
            (n* = (n + 2) / 24)
MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
 I        WITH
    S                  1.567    2.070      0.757
 Means
    I                 21.133    0.617     34.273
    S                  5.039    0.295     17.065
 Intercepts
    PIAT1              0.000    0.000      0.000
    PIAT2              0.000    0.000      0.000
    PIAT3              0.000    0.000      0.000
 Variances
    I                 11.368    6.115      1.859
    S                  4.388    1.265      3.470
 Residual Variances
    PIAT1             26.961    4.029      6.691
    PIAT2             26.961    4.029      6.691
    PIAT3             26.961    4.029      6.691

Note that the residual variances are constrained to be equal.  See the Supplemental Analyses for Chapter 5 to see an example where the residual variances a permitted to freely vary.


Model B: Using AGE-6.5 as a temporal predictor, i.e., cage1 cage2 cage3.

Title: 
Data:
  File is c:\alda\reading.dat ;
Variable:
  Names are 
     id agegrp1 agegrp2 agegrp3 age1 age2 age3 piat1 piat2 piat3 cage1
     cage2 cage3 cagegrp1 cagegrp2 cagegrp3;
  Missing are all (-999999999) ; 
  Usevariables are
     piat1 piat2 piat3 cage1 cage2 cage3;
  Tscores cage1-cage3 ;
Analysis: 
  Type = random;
  estimator = ml;
MODEL:
  i s | piat1-piat3 at cage1-cage3 ;
  i with s;
  piat1-piat3 (1) ;
------------------------------------------------------------------------------------------------
TESTS OF MODEL FIT

Loglikelihood
          H0 Value                        -901.960
Information Criteria
          Number of Free Parameters              6
          Akaike (AIC)                    1815.920
          Bayesian (BIC)                  1830.851
          Sample-Size Adjusted BIC        1811.916
            (n* = (n + 2) / 24)

MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
 I        WITH
    S                  2.139    1.814      1.179
 Means
    I                 21.033    0.564     37.285
    S                  4.549    0.262     17.397
 Intercepts
    PIAT1              0.000    0.000      0.000
    PIAT2              0.000    0.000      0.000
    PIAT3              0.000    0.000      0.000
 Variances
    I                  5.910    6.045      0.978
    S                  3.384    1.019      3.321
 Residual Variances
    PIAT1             27.009    4.232      6.382
    PIAT2             27.009    4.232      6.382
    PIAT3             27.009    4.232      6.382

Table 5.7, page 163

Table 5.7

Model A: Initial growth model, using Person (wide) unemp.dat data file.

Title: 
  Table 5.7, Model A, Person (wide) file
Data:
  File is c:\alda\unemp.dat ;
Variable:
  Names are 
     id cesd1 cesd2 cesd3 months1 months2 months3 unemp1 unemp2 unemp3
     ubym1 ubym2 ubym3;
  Missing are all (-999999999) ; 
  Usevariables are
     cesd1 cesd2 cesd3 months1 months2 months3 ;
  Tscores months1-months3 ;
Analysis: 
  Type = random;
  estimator = ml;
MODEL:
  i s | cesd1-cesd3 at months1-months3 ;
  i with s;
  cesd1-cesd3 (1) ;
-----------------------------------------------------------------------------
TESTS OF MODEL FIT

Loglikelihood
          H0 Value                       -2189.403
Information Criteria
          Number of Free Parameters              6
          Akaike (AIC)                    4390.806
          Bayesian (BIC)                  4410.382
          Sample-Size Adjusted BIC        4391.375
            (n* = (n + 2) / 24)
MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
 I        WITH
    S                 -2.335    1.329     -1.757
 Means
    I                 17.187    0.845     20.332
    S                 -0.387    0.085     -4.533
 Variances
    I                 78.573   15.179      5.176
    S                  0.325    0.176      1.850
 Residual Variances
    CESD1             66.008    6.574     10.041
    CESD2             66.008    6.574     10.041
    CESD3             66.008    6.574     10.041

Model A (again): Initial growth model, using person period ("long") unemp_pp.dat data file.

Title: 
  Table 5.7, Model A, Person Period (long) file
Data:
  File is c:\alda\unemp_pp.dat ;
Variable:
  Names are 
     id months cesd unemp;
  Missing are all (-999999999) ; 
  Usevariables are
     months cesd ;
     cluster = id;
     within = months ;
Analysis: 
  Type = random twolevel ;
  mconvergence = .000001;
  estimator = ml;
model:
  %within%
    s | cesd on months;
  %between%
    cesd with s;
-----------------------------------------------------------------------------
TESTS OF MODEL FIT

Loglikelihood
          H0 Value                       -2566.569
Information Criteria
          Number of Free Parameters              6
          Akaike (AIC)                    5145.137
          Bayesian (BIC)                  5172.217
          Sample-Size Adjusted BIC        5153.166
            (n* = (n + 2) / 24)
MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
Within Level
 Residual Variances
    CESD              68.848    6.602     10.428
Between Level
 CESD     WITH
    S                 -3.058    1.385     -2.208
 Means
    CESD              17.669    0.776     22.782
    S                 -0.422    0.083     -5.083
 Variances
    CESD              86.852   14.963      5.804
    S                  0.355    0.184      1.925

Model B: Main effect of unemployment using person period ("long") unemp_pp.dat data file.

Title: 
  Table 5.7, Model B, Person Period (long) file
Data:
  File is c:\alda\unemp_pp.dat ;
Variable:
  Names are 
     id months cesd unemp;
  Missing are all (-999999999) ; 
  Usevariables are
     months cesd unemp;
     cluster = id;
     within = months unemp;
Analysis: 
  Type = random missing twolevel ;
  mconvergence = .000001;
  estimator = ml;

model:

  %within%
    cesd on unemp;
    s | cesd on months;
  %between%
    cesd with s;
-----------------------------------------------------------------------------
TESTS OF MODEL FIT

Loglikelihood
          H0 Value                       -2553.802
Information Criteria
          Number of Free Parameters              7
          Akaike (AIC)                    5121.603
          Bayesian (BIC)                  5153.196
          Sample-Size Adjusted BIC        5130.970
            (n* = (n + 2) / 24)

MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
Within Level
 CESD     ON
    UNEMP              5.111    0.996      5.133
 Residual Variances
    CESD              62.388    6.013     10.375
Between Level
 CESD     WITH
    S                 -3.894    1.370     -2.842
 Means
    CESD              12.666    1.247     10.157
    S                 -0.202    0.093     -2.163
 Variances
    CESD              93.518   14.820      6.310
    S                  0.465    0.180      2.585

Model C: Effect of unemployment on initial status and growth rate.

Title: 
  Table 5.7, Model C, Person Period (long) file
Data:
  File is H:\alda\mplus\unemployment_pp.dat ;
Define:
  monBYun = months * unemp;
Variable:
  Names are 
     id months cesd unemp;
  Missing are all (-999999999) ; 
  Usevariables are
     months cesd unemp monBYun;
     cluster = id;
     within = months unemp monBYun;
Analysis: 
  Type = random missing twolevel ;
  mconvergence = .000001;
  estimator = ml;
model:
  %within%
    cesd on unemp monBYun;
    s | cesd on months;
  %between%
    cesd with s;
-----------------------------------------------------------------------------
TESTS OF MODEL FIT

Loglikelihood
          H0 Value                       -2551.523
Information Criteria
          Number of Free Parameters              8
          Akaike (AIC)                    5119.047
          Bayesian (BIC)                  5155.153
          Sample-Size Adjusted BIC        5129.752
            (n* = (n + 2) / 24)

MODEL RESULTS
                   Estimates     S.E.  Est./S.E.
Within Level
 CESD     ON
    UNEMP              8.529    1.880      4.538
    MONBYUN           -0.465    0.217     -2.140
 Residual Variances
    CESD              62.031    5.966     10.398
Between Level
 CESD     WITH
    S                 -3.873    1.359     -2.850
 Means
    CESD               9.617    1.891      5.086
    S                  0.162    0.194      0.836
 Variances
    CESD              93.712   14.777      6.342
    S                  0.451    0.177      2.544

Model D: Allowing unemployment to have both fix and random effects. There are only 193 groups that have all data points for the three time points.

Skipped for now.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.