楼主: Lisrelchen
2904 23

[Code]Multilevel Modeling using Mplus [推广有奖]

11
Statachen 发表于 2016-6-1 12:01:58 |只看作者 |坛友微信交流群
  1. 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.

  2. Title:
  3.   Table 5.2, Model A.
  4. Data:  
  5.   File is c:\alda\reading.dat ;
  6. Variable:
  7.   Names are
  8.      id agegrp1 agegrp2 agegrp3 age1 age2 age3 piat1 piat2 piat3 cage1
  9.      cage2 cage3 cagegrp1 cagegrp2 cagegrp3;
  10.   Missing are all (-999999999) ;
  11.   Usevariables are
  12.      piat1 piat2 piat3 cagegrp1 cagegrp2 cagegrp3;
  13.   Tscores cagegrp1-cagegrp3 ;
  14. Analysis:
  15.   Type = random ;
  16.   estimator = ml;
  17. Model:
  18.   i s | piat1-piat3 at cagegrp1-cagegrp3 ;
  19.   i with s;
  20.   piat1-piat3 (1) ;
复制代码
  1. Model B: Using AGE-6.5 as a temporal predictor, i.e., cage1 cage2 cage3.

  2. Title:
  3. Data:
  4.   File is c:\alda\reading.dat ;
  5. Variable:
  6.   Names are
  7.      id agegrp1 agegrp2 agegrp3 age1 age2 age3 piat1 piat2 piat3 cage1
  8.      cage2 cage3 cagegrp1 cagegrp2 cagegrp3;
  9.   Missing are all (-999999999) ;
  10.   Usevariables are
  11.      piat1 piat2 piat3 cage1 cage2 cage3;
  12.   Tscores cage1-cage3 ;
  13. Analysis:
  14.   Type = random;
  15.   estimator = ml;
  16. MODEL:
  17.   i s | piat1-piat3 at cage1-cage3 ;
  18.   i with s;
  19.   piat1-piat3 (1) ;
复制代码


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

使用道具

12
Statachen 发表于 2016-6-1 12:05:20 |只看作者 |坛友微信交流群
  1. Table 5.4, page 149, using the ALDACh5Table5.4.txt data

  2. We thank Hemant Kher for providing the Mplus code for this example.

  3. Model A

  4. Title:  Table 5.4, Model A, Person (wide) file
  5. Data:
  6.    File is "C:\alda\ALDACh5Table5.4.txt";
  7. Variable:
  8.    Names are id exp1-exp13 lnw1-lnw13 black hgc_9;
  9.   Missing are all (-999) ;
  10.    Usevariables are exp1-exp13 lnw1-lnw13;
  11.    Tscores exp1-exp13;
  12. Analysis:
  13.   Type = random;
  14.   estimator = ml;
  15. MODEL:
  16.   i s | lnw1-lnw13 at exp1-exp13;
  17.   i with s;
  18.   lnw1-lnw13 (1) ;
复制代码
  1. Model B

  2. Title:
  3.    Table 5.4, Model B, Person (wide) file
  4. Data:
  5.    File is "E:\sandwmplus\ALDACh5Table5.4.txt";
  6. Variable:
  7.   Names are
  8.      id exp1-exp13 lnw1-lnw13 black hgc_9;
  9.   Missing are all (-999) ;
  10.   Usevariables are
  11.      exp1-exp13 lnw1-lnw13 black hgc_9;
  12.   Tscores exp1-exp13;
  13. Analysis:
  14.   Type = random;
  15.   estimator = ml;
  16. MODEL:
  17.   i s | lnw1-lnw13 at exp1-exp13;
  18.   i with s;
  19.   i on black hgc_9;
  20.   s on black hgc_9;
  21.   lnw1-lnw13 (1);
复制代码
  1. Model C

  2. Title:
  3.   Table 5.4, Model A, Person (wide) file
  4. Data:
  5.   File is "E:\sandwmplus\ALDACh5Table5.4.txt";
  6. Variable:
  7.   Names are
  8.      id exp1-exp13 lnw1-lnw13 black hgc_9;
  9.   Missing are all (-999) ;
  10.   Usevariables are
  11.      exp1-exp13 lnw1-lnw13 black hgc_9;
  12.   Tscores exp1-exp13;
  13. Analysis:
  14.   Type = random;
  15.   estimator = ml;
  16. MODEL:
  17.   i s | lnw1-lnw13 at exp1-exp13;
  18.   i with s;
  19.   i on hgc_9;
  20.   s on black;
  21.   lnw1-lnw13 (1);
复制代码

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

使用道具

13
Statachen 发表于 2016-6-1 12:10:42 |只看作者 |坛友微信交流群
  1. Latent Class Scaling Analysis by C. Mitchell Dayton

  2. Table 3.2 on page 28 using pleural thickening data. In general, the AIC and BIC displayed in the book is the difference between the AIC for the specific model and the AIC for the unconstrained model and Mplus displays the AIC and BIC for each specific model alone. We can convert Mplus version of  AIC and BIC back to the results in the book by taking the difference. For example, for unconstrained model, Mplus gives AIC as  1796.286 and for homogeneous 1815.697. The difference of these two gives 19.411 which is what in Table 3.2 for AIC of homogeneous model.

  3. Model I: unconstrained

  4.   data:
  5.     file is c:\dayton\table3_1.dat ;
  6.   variable:
  7.     names are
  8.        a b c freq;
  9.     missing are all (-9999) ;
  10.     categorical are a b c;
  11.     classes=cl(2);
  12.     weight is freq (freq);
  13.   analysis:
  14.     type = mixture ;
  15.     starts = 0;
  16.   model:
  17.      %overall%
  18.       [A$1*10  B$1*10 C$1*10];
  19.       %cl#1%
  20.       [A$1*-10  B$1*-10 C$1*-10];
复制代码

使用道具

14
Statachen 发表于 2016-6-1 12:11:39 |只看作者 |坛友微信交流群
  1. Applied Latent Class Analysis
  2. Chapter 1 Latent Class Analysis by Leo A. Goodman

  3. Table 2 on page 11 using data set page11.dat.

  4. Model H0:

  5.   Data:
  6.     File is c:\alca\page11.dat ;
  7.   Variable:
  8.     Names are
  9.        s m freq;
  10.     usevariables are s m freq;
  11.     weight is freq (freq);
  12.     categorical are s m;
  13.     Missing are all (-9999) ;
  14.     classes = cl(1);
  15.   Analysis:
  16.     Type = mixture;
  17.   model:
  18.      %overall%
复制代码

使用道具

15
Statachen 发表于 2016-6-1 12:15:04 |只看作者 |坛友微信交流群
  1. Model H1: We have to specify two of the parameters in order for the model to be identifiable. It does not matter which of the two parameters to be fixed. Please see the discussion for detail on page 32.

  2. Data:
  3.   File is c:\alca\page11.dat;
  4. Variable:
  5.   Names are
  6.      s m freq;
  7.   usevariables are s m freq;
  8.   weight is freq (freq);
  9.   categorical are s m;
  10.   Missing are all (-9999) ;
  11.   classes = cl(2);
  12. Analysis:
  13.   Type = mixture;
  14. model:
  15.    %overall%
  16.    [s$1-s$5*];
  17.    [m$2 m$3*];
  18.    [m$1@-15];
  19.    %cl#1%
  20.    [s$1-s$5*];
  21.    [m$1-m$2*];
  22.    [m$3@15];
复制代码

Applied Latent Class Analysis
Chapter 1 Latent Class Analysis by Leo A. Goodman

使用道具

16
Statachen 发表于 2016-6-1 12:16:02 |只看作者 |坛友微信交流群
  1. Applied Latent Class Analysis
  2. Chapter 2 Basic Concepts and Procedures in Single- and Multiple-Group Latent Class Analysis
  3. by Allan L. McCutcheon

  4. Table 2 on page 60 using data set page59_a.dat.

  5.   Data:
  6.     File is c:\alca\page59_a.dat ;
  7.   Variable:
  8.     Names are
  9.        a b c d group freq;
  10.     Missing are all (-9999) ;
  11.       usev are a b c d freq;
  12.       weight is freq (freq);
  13.       categorical are a b c d;
  14.       classes = x(2);
  15.     Analysis:
  16.       Type = mixture ;
复制代码

使用道具

17
Statachen 发表于 2016-6-1 12:16:53 |只看作者 |坛友微信交流群
  1. Applied Latent Class Analysis
  2. Chapter 3 Latent Cluster Analysis by Jeroen K. Vermunt and Jay Magidson

  3. Table 1 on page 100 using diabetes data. Notice that we only did the first three columns. Technically, the rest is the same.

  4. Model 1:1 Class-dep unrestricted Σk with 1 cluster

  5.    Data:
  6.       File is c:\alca\chapter3\diabetes.dat ;
  7.     Variable:
  8.       Names are
  9.         true glucose insulin sspg;
  10.       Missing are all (-9999) ;
  11.       Usev are glucose insulin sspg;
  12.       classes = c(1);
  13.     Analysis:
  14.       Type = mixture ;

  15.   model:
  16.      %overall%
  17.         glucose with insulin;
  18.         glucose with sspg;
  19.         insulin with sspg;
复制代码

使用道具

18
Statachen 发表于 2016-6-1 12:17:34 |只看作者 |坛友微信交流群
  1. Applied Latent Class Analysis
  2. Chapter 9 Directed Loglinear Modeling with Latent Variables
  3. Causal Models for Cateogrical Data with Nonsystematic and Systematic Measurement Errors By Jacques A. Hagenaars

  4. The data set can be downloaded here.

  5. Table 2 on page 238.

  6. Model 1: (YZ, YA, YB, ZC, ZD, YE)

  7. Data:
  8.     File is d:\alca\table1_chap9.dat ;
  9.   Variable:
  10.     Names are
  11.        a b c d e freq;
  12.     Missing are all (-9999) ;
  13.     usev are a b c d e freq;
  14.     weight is freq (freq);
  15.     categorical are a b c d e;
  16.     classes = y(3) z(3); !y represents system involvement
  17.                          !z represents protest tolerance

  18.   Analysis:
  19.     Type = mixture ;
  20.     parameterization = loglinear;
  21.     starts = 50 5;
  22.   model:
  23.     %overall%
  24.     z#1 with y#1 ;
  25.     z#2 with y#1 ;
  26.     z#1 with y#2 ;
  27.     z#2 with y#2 ;

  28.   model y:

  29.     %y#1%
  30.     [a$1*-1 b$1*-1 e$1*-1];
  31.     [a$2*2 e$2*2];

  32.     %y#2%
  33.     [a$1*4 b$1*4 e$1*4];
  34.     [a$2*8 e$2*8];

  35.    %y#3%
  36.     [a$1*9 b$1*9 e$1*9];
  37.     [a$2*10 e$2*10];

  38.   model z:

  39.     %z#1%
  40.     [c$1*-5 d$1*-5];
  41.     [c$2*0 d$2*0];

  42.     %z#2%
  43.     [c$1*5 d$1*5];
  44.     [c$2*10 d$2*10];

  45.     %z#3%

  46.     [c$1*11 d$1*11];
  47.     [c$2*12 d$2*12];
复制代码

使用道具

19
Statachen 发表于 2016-6-1 12:18:17 |只看作者 |坛友微信交流群
  1. Applied Latent Class Analysis
  2. Chapter 11 Latent Markov Chains by Rolf Langeheine and Frank van de Pol

  3. The data set can be downloaded following the link here.

  4. Expected frequencies of Table 1 on page 310 based on the simple Markov model with time homogeneous transition probabilities.

  5. data:
  6. file is chap11.dat;
  7. variable:
  8. names are
  9. u1 u2 u3 u4 u5 count group;
  10. missing are all (-9999) ;
  11. usevariables are u1 u2 u3 u4 u5 count;
  12. weight is count (freq);
  13. categorical are u1 u2 u3 u4 u5;
  14. classes = c1(2) c2(2) c3(2) c4(2) c5(2);
  15. analysis:
  16. type = mixture;
  17. model:
  18.     %overall%
  19.     c2#1 on c1#1 (1);
  20.     c3#1 on c2#1 (1);
  21.     c4#1 on c3#1 (1);
  22.     c5#1 on c4#1 (1);
  23.     [c1#1];
  24.     [c2#1 c3#1 c4#1 c5#1] (2);
  25. model c1:
  26.     %c1#1%
  27.     [u1$1@-15];
  28.     %c1#2%
  29.     [u1$1@15];
  30. model c2:
  31.     %c2#1%
  32.     [u2$1@-15];
  33.     %c2#2%
  34.     [u2$1@15];
  35. model c3:
  36.     %c3#1%
  37.     [u3$1@-15];
  38.     %c3#2%
  39.     [u3$1@15];
  40. model c4:
  41.     %c4#1%
  42.     [u4$1@-15];
  43.     %c4#2%
  44.     [u4$1@15];
  45. model c5:
  46.     %c5#1%
  47.     [u5$1@-15];
  48.     %c5#2%
  49.     [u5$1@15];   
复制代码

使用道具

20
Statachen 发表于 2016-6-1 12:19:09 |只看作者 |坛友微信交流群
  1. Latent Class Analysis by Allan L. McCutcheon

  2. This page is still under construction!!

  3. The examples on this page is done using Mplus 4.2.

  4. Page 16  data file The data are shown on page 16, and the probabilities are shown at the bottom of page 15.  Also, we have included all of the output for this analysis only.  For all other analyses, we will limit the output presented only to relevant parts.

  5. data: file is "D:\work\mplus_examples\mplus16.dat";
  6. variable: names are a b c wt;
  7. usevar a b c;
  8. freqweight is wt ;
  9. classes = grp(2);
  10. categorical = a b c;
  11. analysis: type = mixture;
  12. RESULTS IN PROBABILITY SCALE
复制代码

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-22 05:24