0%

1
2
3
4

use "D:\Data Storages\Dataset for Learning\depression_clean.dta", clear
reshape long dep, i(sid) j(time)
mixed dep time || sid:time, var cov(unstr)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21

------------------------------------------------------------------------------
         dep |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        time |    -1.6025   .4262612    -3.76   0.000    -2.437957   -.7670434
       _cons |   14.18924   .8147121    17.42   0.000     12.59243    15.78605
------------------------------------------------------------------------------


------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
sid: Unstructured            |
                   var(time) |   3.201386   2.047798      .9138158    11.21547
                  var(_cons) |   21.93819   6.613945       12.1501    39.61154
             cov(time,_cons) |  -1.153612   2.751286     -6.546034     4.23881
-----------------------------+------------------------------------------------
               var(Residual) |    10.3135    2.15051      6.853596    15.52006
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 54.85                 Prob > chi2 = 0.0000

  • 线性模型
  • Stata
1
2
3

use https://stats.idre.ucla.edu/stat/stata/examples/mlm_ma_hox/pupcross, clear
xtmixed achiev pupsex pupses  || _all: R.sschool ||_all: R.pschool, reml var
  • SAS
1
2
3
4
5
6

proc mixed data=WORK.IMPORT covtest CL;
      class sschool pschool;
      model achiev = pupsex pupses/solution CL;
      random sschool pschool / solution;
run;

Mundlak Model, Chamberlain Model & Hybrid Model 
蒙德拉克模型、张伯伦模型和混合模型
  • Hybrid 模型是Allison在2009年提出的分解聚类内(within-cluster)和聚类间(between-cluster)效应的方法
  • Hybrid方法又称为对中随机效应模型(the centered Random Effect Model)
  • Firebaugh, G., Warner, C., & Massoglia, M. (2013). Fixed effects, random effects, and hybrid models for causal analysis. In Handbook of causal analysis for social research (pp. 113-132). Springer, Dordrecht.