楼主: Lisrelchen
701 1

Tutorials: Using Multilevel Models to Analyze Marital [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6306
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2016-5-29 05:15:26 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Tutorials: Using multilevel models to analyze marital

Atkins, D. C. (2005). Using multilevel models to analyze marital and family treatment data: Basic and advanced issues. Journal of Family Psychology, 19, 98-110.

[Paper]
[Data]
[R code]
[SPSS code]




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Multilevel Tutorials Tutorial Marital analyze Journal family issues

沙发
Lisrelchen 发表于 2016-5-29 05:16:32
  1. *** SPSS Syntax to accompany .
  2. *.
  3. *** Atkins, D. C. (2005). Using multilevel models to analyze couple and family
  4. *** treatment data: Basic and advanced issues.  Journal of Family Psychology, 19,
  5. *** 98-110.
  6. *.
  7. *** Introductory: The following SPSS syntax demonstrates how to fit the models for
  8. *** the examples from the article mentioned above, with the exception of the
  9. *** simulations described in the power/sample size section, which is only available
  10. *** in R.  I have tried to make this file as clear as possible, but please don't
  11. *** hesitate to contact me with questions and/or clarifications (or suggestions for
  12. *** improvement!).
  13. *.
  14. *** Best, Dave Atkins (datkins@fuller.edu)
  15. *.
  16. *** Import data .
  17. *.
  18. *** NOTE: You'll need to change the /FILE to indicate where the file is saved .
  19. ***                on your computer .
  20. GET DATA  /TYPE = TXT
  21. /FILE = 'C:\Temp\Atkins JFP data.dat'
  22. /DELCASE = LINE
  23. /DELIMITERS = "\t"
  24. /QUALIFIER = '"'
  25. /ARRANGEMENT = DELIMITED
  26. /FIRSTCASE = 2
  27. /IMPORTCASE = ALL
  28. /VARIABLES =
  29. id F2.1
  30. sex F1.0
  31. therapy F2.1
  32. time F1.0
  33. das F2.1
  34. pilot F16.2
  35. miss F1.0
  36. m.ind F1.0
  37. .
  38. CACHE.
  39. EXECUTE.

  40. *** Save data after import .
  41. *.
  42. *** NOTE: Again, change location to where you'd like to save it .
  43. SAVE OUTFILE='C:\Temp\JFP data.sav'
  44. /COMPRESSED.

  45. *** Value labels for therapy .
  46. Value Labels  therapy  
  47.      -0.5 "Tx1" 0.5 "Tx2" .

  48. *** Value labels for sex .
  49. Value Labels  sex  
  50.      0 "Husband" 1 "Wife" .

  51. ************************ Two Level Example ******************* .
  52. *.
  53. *** In SPSS, we need to explicitly create quadratic .
  54. COMPUTE time2 = time**2 .
  55. EXECUTE .

  56. *** To restrict analyses to Wives, need to "filter" Husbands .
  57. USE ALL.
  58. COMPUTE filter_$=(sex=1).
  59. VARIABLE LABEL filter_$ 'sex=1 (FILTER)'.
  60. VALUE LABELS filter_$  0 'Not Selected' 1 'Selected'.
  61. FORMAT filter_$ (f1.0).
  62. FILTER BY filter_$.
  63. EXECUTE .

  64. *** Run the following command to "turn off" case selection (when you want to) .
  65. FILTER OFF.
  66. USE ALL.
  67. EXECUTE .

  68. *** Next, run HLM analysis with random intercept, slope, and quadratic .
  69. MIXED
  70.   das BY id WITH therapy time time2
  71.   /FIXED = therapy time time2 therapy*time therapy*time2 | SSTYPE(3)
  72.   /METHOD = REML
  73.   /PRINT = CORB COVB SOLUTION TESTCOV
  74.   /RANDOM INTERCEPT time time2 | SUBJECT(id) COVTYPE(UN) .

  75. *** NOTE: the above code treats "therapy" as a contiuous variable .
  76. ***                if we treat it as categorical (factor), SPSS gives the .
  77. ***                variable a different set of contrasts; this way we .
  78. ***                retain the -0.5, 0.5 contrasts .
  79. *.
  80. *** NOTE: You can use the /TEST command to get specific contrasts.
  81. ***                For example, you might try inserting the following .
  82. ***                commands after the /RANDOM statement above, but don't .
  83. ***                forget to move the "." to the end of the command .
  84. *.
  85. *** /TEST 'SLOPE - TX1-EST'  time 1 therapy*time 1 0
  86. *** /TEST 'SLOPE - TX2-EST'  time 1 therapy*time 0 1
  87. *** /TEST 'CONTRAST SLOPE '  therapy*time  1 -1
  88. *** /TEST 'POOLED SLOPE' time 1 therapy*time 0.5 0.5

  89. ******* Multilevel Models for Longitudinal Couple and Family Data ****** .
  90. *.
  91. *** To run the model in equation 5, first turn off the "case selection" .
  92. *** that we ran earlier to select only Wives (if you haven't already) .
  93. MIXED
  94.   das BY id sex WITH therapy time time2
  95.   /FIXED = therapy time time2 therapy*time therapy*time2 | SSTYPE(3)
  96.   /METHOD = REML
  97.   /PRINT = COVB SOLUTION TESTCOV
  98.   /RANDOM INTERCEPT | SUBJECT(id*sex) COVTYPE(UN)
  99.   /RANDOM INTERCEPT time time2 | SUBJECT(id) COVTYPE(UN)
  100.   /SAVE RESID .

  101. *** NOTE: The command above saves the level-1 residuals via the /SAVE .
  102. *** statement.  This creates a new column in the datafile with the level-1 .
  103. *** residuals, which can then be used to examine the distributional .
  104. *** assumptions.  Unfortunately, it is not straightforward to have SPSS .
  105. *** save the Empirical Bayes residuals of the level-2 and level-3 .
  106. *** random-effects.  In a very thorough review of the MIXED command in .
  107. *** SPSS, Alastair Leyland shows how it is possible to calculate the .
  108. *** EB residuals: http://multilevel.ioe.ac.uk/softrev/index.html .
  109. *.
  110. *** To fit the multivariate model in equation 6, we need to create vectors .
  111. *** that specify male intercept, female intercept, male slope, and female slope .
  112. *.
  113. *** We can recode from our sex variable to create the intercepts .
  114. RECODE sex (0=0) (1=1) INTO f.int .               
  115. RECODE sex (0=1) (1=0) INTO m.int .               
  116. EXECUTE .

  117. *** Now, slopes .
  118. COMPUTE f.slope = f.int*time .
  119. COMPUTE m.slope = m.int*time .
  120. EXECUTE .

  121. *** Now we can run the multivariate model; notice that we exclude the intercept .
  122. *** from both the /FIXED and /RANDOM statements .
  123. MIXED
  124.   das BY id WITH f.int m.int f.slope m.slope
  125.   /FIXED = f.int m.int f.slope m.slope | NOINT SSTYPE(3)
  126.   /METHOD = REML
  127.   /PRINT = COVB CORB SOLUTION TESTCOV
  128.   /RANDOM f.int m.int f.slope m.slope  | SUBJECT(id) COVTYPE(UN) .

  129. *** We could easily extend this model to include quadratic effects and .
  130. *** interactions with therapy.  However, the random-effects parameters .
  131. *** in multivariate models grow very quickly.  You can end up "over-fitting" .
  132. *** your data, leading to convergence problems and ill-conditioned .
  133. *** random-effects matrices .
  134. *.

  135. ********************* Missing Data Example *******************************.
  136. *.
  137. *** The missing data section doesn't really require any special models; if you .
  138. *** wish to reproduce the analyses in the manuscript, use the "miss" variable to select only .
  139. *** those cases with a value of 0 (to mimic missing data); then, m.ind is the .
  140. *** the missing data indicator variable (our pattern) .
  141. *.
  142. *** To restrict analyses to miss = 0 .
  143. USE ALL.
  144. COMPUTE filter_$=(miss=0).
  145. VARIABLE LABEL filter_$ 'miss=0 (FILTER)'.
  146. VALUE LABELS filter_$  0 'Not Selected' 1 'Selected'.
  147. FORMAT filter_$ (f1.0).
  148. FILTER BY filter_$.
  149. EXECUTE .

  150. *** Run the following command to "turn off" case selection (when you want to) .
  151. FILTER OFF.
  152. USE ALL.
  153. EXECUTE .

  154. *** Here's the command to run the model in equation 7 .
  155. MIXED
  156.   das BY id sex WITH therapy m.ind time
  157.   /FIXED = therapy m.ind therapy*m.ind time therapy*time m.ind*time therapy*m.ind*time | SSTYPE(3)
  158.   /METHOD = REML
  159.   /PRINT = COVB SOLUTION TESTCOV
  160.   /RANDOM INTERCEPT | SUBJECT(id*sex) COVTYPE(UN)
  161.   /RANDOM INTERCEPT time | SUBJECT(id) COVTYPE(UN) .

  162. *** Use the output from the above command along with the description in the text .
  163. *** to estimate the pattern-mixture models .
  164. *.
  165. *** Simulation and power: These analyses are only possible using R; however, I have .
  166. *** recently discovered that Raudenbush, Liu, and Congdon have extended the power .
  167. *** analyses functions of their Optimal Design software to handle some 3-level .
  168. *** models.  The program and manual can be downloaded here:
  169. *.
  170. *** http://www.ssicentral.com/other/hlmod.htm
  171. .
复制代码

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-3 01:31