Hi Everyone!

I'm using stata 15.0 on Mac

I'm trying to do a mediation analysis in STATA with a panel data set. SEM or GSEM does not take into consideration that it is panel data, it uses a pooled regression, hence I'm looking for an analysis that does take the panel structure into consideration.

It includes 41 countries and the time range is 1995 until 2018, the IV is 'LME' which is the only variable which does not change over time, it can only have the values 0 or 1. The MV is 'CVC' which is panel data and the DV is 'market concentration' which is panel data as well. I've tried SEM and GSEM but both do not seem right for panel data as it does not consider the panel structure.

Small part of the data:
nr id year cvc marketcon lme
3 Belgium 1995 0 . 0
3 Belgium 1996 0 0,1 0
3 Belgium 1997 0 0,1 0
3 Belgium 1998 0 0,18 0
3 Belgium 1999 0 0,13 0
3 Belgium 2000 0 0,12 0
3 Belgium 2001 0 0,11 0
3 Belgium 2002 0 0,12 0
3 Belgium 2003 0 0,14 0
3 Belgium 2004 20,7 0,14 0
3 Belgium 2005 0 0,09 0
3 Belgium 2006 91,1 0,14 0
3 Belgium 2007 38,1 0,09 0
3 Belgium 2008 12,8 0,07 0
3 Belgium 2009 15,8 0,11 0
3 Belgium 2010 27,7 0,18 0
3 Belgium 2011 14,2 0,17 0
3 Belgium 2012 58,6 0,15 0
3 Belgium 2013 33 0,2 0
3 Belgium 2014 52,6 0,11 0
3 Belgium 2015 10,8 0,17 0
3 Belgium 2016 82 . 0
3 Belgium 2017 58,3 . 0
3 Belgium 2018 195,3 . 0
4 Canada 1995 0 . 1
4 Canada 1996 0 0,13 1
4 Canada 1997 0 0,15 1
4 Canada 1998 0 0,15 1
4 Canada 1999 487,1 0,15 1
4 Canada 2000 17 0,17 1
4 Canada 2001 72,8 0,21 1
4 Canada 2002 3,5 0,14 1
4 Canada 2003 28,2 0,18 1
4 Canada 2004 0 0,19 1
4 Canada 2005 11,9 0,17 1
4 Canada 2006 49,3 0,15 1
4 Canada 2007 91,5 0,19 1
4 Canada 2008 55 0,22 1
4 Canada 2009 102,2 0,17 1
4 Canada 2010 103,3 0,38 1
4 Canada 2011 288,4 0,43 1
4 Canada 2012 253,9 0,39 1
4 Canada 2013 136,1 0,39 1
4 Canada 2014 321,4 0,35 1
4 Canada 2015 531 0,39 1
4 Canada 2016 848,9 . 1
4 Canada 2017 917 . 1
4 Canada 2018 1270 . 1



.gsem (cvc <- lme)(marketcon <- cvc lme)

Iteration 0: log likelihood = -8753.5826
Iteration 1: log likelihood = -8753.5826

Generalized structural equation model Number of obs = 984

Response : cvc Number of obs = 984
Family : Gaussian
Link : identity

Response : marketcon Number of obs = 748
Family : Gaussian
Link : identity

Log likelihood = -8753.5826

----------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------------+----------------------------------------------------------------
cvc |
lme | 2248.843 231.6727 9.71 0.000 1794.773 2702.913
_cons | 59.60339 88.62546 0.67 0.501 -114.0993 233.3061
-----------------+----------------------------------------------------------------
marketcon |
cvc | 3.34e-06 2.54e-06 1.31 0.189 -1.65e-06 8.32e-06
lme | -.0554207 .0163841 -3.38 0.001 -.087533 -.0233085
_cons | .2567047 .005838 43.97 0.000 .2452624 .268147
-----------------+----------------------------------------------------------------
var(e.cvc)| 6597756 297449.8 6039780 7207280
var(e.marketcon)| .0218785 .0011313 .0197699 .0242121
----------------------------------------------------------------------------------

. sem (cvc <- lme)(marketcon <- cvc lme)
(236 observations with missing values excluded)

Endogenous variables

Observed: cvc marketcon

Exogenous variables

Observed: lme

Fitting target model:

Iteration 0: log likelihood = -6698.2382
Iteration 1: log likelihood = -6698.2382

Structural equation model Number of obs = 748
Estimation method = ml
Log likelihood = -6698.2382

---------------------------------------------------------------------------------
| OIM
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
----------------+----------------------------------------------------------------
Structural |
cvc |
lme | 2079.756 223.0174 9.33 0.000 1642.65 2516.862
_cons | 23.62279 83.95391 0.28 0.778 -140.9238 188.1694
--------------+----------------------------------------------------------------
marketcon |
cvc | 3.34e-06 2.54e-06 1.31 0.189 -1.65e-06 8.32e-06
lme | -.0554207 .0163841 -3.38 0.001 -.087533 -.0233085
_cons | .2567047 .005838 43.97 0.000 .2452624 .268147
----------------+----------------------------------------------------------------
var(e.cvc)| 4524982 233981.2 4088860 5007621
var(e.marketcon)| .0218785 .0011313 .0197699 .0242121
---------------------------------------------------------------------------------
Note: The LR test of model vs. saturated is not reported because the fitted
model is not full rank.



I expected it to use the panel structure, which is 41 countries, but it does not. It seems to interpret every observation separately.

Hence my question is: What analysis should I use for a mediation analysis with panel data? I only want to do the mediation analysis for all the countries which have a value of 1 for LME.

Thank you in advance!

Kind regards,

Tim Winters