Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mediation Analysis - Stata sem and medsem commands with fixed effects models

    Hello everyone,


    I am trying to perform a mediation analysis, in which the variables of concern are as follows:

    Dependent Variable (Y) - Percentage_changes_per_industry

    Independent Variable (X) - tenure_median

    Mediator Variable (M) - median_tenure_promo_top2sf_1st

    Control Variables - median_age_promo_top2sf_1st gender log_nemp_median numb_firms_div1000 vn_per_employee_median higher_education norte algarve centro alentejo acores madeira


    The issue I am having is that I want to include fixed effects models, but do not know how to do so when considering a mediation analysis. The commands for each of the individual regressions would be as follows:

    First, regression with the Mediator as the Dependent Variable:
    Code:
    xtset caem2 year
    
    xtreg median_tenure_promo_top2sf_1st  tenure_median median_age_promo_top2sf_1st  gender log_nemp_median numb_firms_div1000 vn_per_employee_median   higher_education  i.year  norte algarve centro alentejo acores madeira, fe cluster(caem2)

    Second, regression with the Dependent Variable as the Dependent Variable:

    Code:
    xtset caem2 year
    
    xtreg Percentage_changes_per_industry median_tenure_promo_top2sf_1st tenure_median median_age_promo_top2sf_1st gender log_nemp_median numb_firms_div1000 vn_per_employee_median   higher_education  i.year  norte algarve centro alentejo acores madeira, fe cluster(caem2)



    The sem/medsem commands I am using, to perform the actual mediation analysis (and obtain values for the Sobel tests as well), are as follows:

    Code:
    sem    (median_tenure_promo_top2sf_1st <- tenure_median    median_age_promo_top2sf_1st   gender log_nemp_median numb_firms_div1000 vn_per_employee_median   higher_education   norte algarve centro alentejo acores madeira)(Percentage_changes_per_industry <- median_tenure_promo_top2sf_1st tenure_median    median_age_promo_top2sf_1st   gender log_nemp_median numb_firms_div1000 vn_per_employee_median   higher_education   norte algarve centro alentejo acores madeira) , nocapslatent vce(bootstrap, reps(100))
       
    
    medsem, indep(tenure_median) med(median_tenure_promo_top2sf_1st) dep(Percentage_changes_per_industry) mcreps(1000) rit rid

    The issue I have is that these sem/medsem commands are performing regular OLS regressions, and not fixed effects (on caem2) regressions, as I would like them to. Is there any way of implementing a fixed effects regressions in the sem models? It would help me solve the issue I am having with implementing these analyses on Stata.


    Thank you very much in advance!
    Rui




  • #2
    Hi Rul. I am doing mediation analysis with multiple mediators using panel data and having the same problem as you. I don't know how to include fixed effects with sem/medsem commands. Did you find solutions for the problem? I would appreciate it if you could share with me your solutions. Thank you.

    Comment

    Working...
    X