Announcement

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

  • #16
    I got the bootstrap to work (i did 1000 reps) and also the percentile (estat boot)

    Comment


    • #17
      Re #15, here are two examples from the help:
      Code:
            /* example 1:  iv level 1; mv level 1 */
          . ml_mediation, dv(write) iv(hon) mv(abil) cv(socst i.grp) l2id(cid)
      
            /* example 2:  iv level 2; mv level 2 */
          . ml_mediation, dv(write) iv(m_hon) mv(m_abil) cv(socst i.grp) l2id(cid)
      Notice that there are no commas between variables in cv(). I.e., try cv(cv1 cv2 cv3 cv4).
      --
      Bruce Weaver
      Email: [email protected]
      Version: Stata/MP 18.5 (Windows)

      Comment


      • #18
        Hey Bruce, tvym. I was able to get concurrent covariates to run as you suggest. cv(cv1, cv2, cv3, cv4). However, the same syntax does not work for me with the predictors: iv(IV1, IV2, IV3, etc.).

        Comment


        • #19
          DISCLAIMER: I have never used ml_mediate. However, I do see this in the help:
          Code:
          Non-options
              dv(varname) Name of the continuous dependent variable.  Must be a level 1 variable.
              iv(varname) Name of the continuous or binary predictor variable.
              mv(varname) Name of the continuous mediator variable.
              l2id(varname) Name of the level 2 id variable.
          As I understand that, iv() can take only one quantitative or dichotomous variable. YMMV.

          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment


          • #20
            Scott,

            Why do you need multiple IVs? This is the variable that starts the mediation chain. IV --> MV --> DV. Covariates (CV in ml_mediation) are variables that are included in the two models ml_mediation runs. They are not involved in the mediation process, but help to deal with confounding in the regressions for the MV and DV.

            If you have multiple predictors that you believe start the mediation chain, e.g., IV1 --> MV -->DV and IV2 --> MV --> DV, then you will have to run two different ml_mediation calls. The first with IV set to IV1 and the second with IV set to IV2.

            Otherwise, put all the covariates into CV:
            Code:
            ml_mediation, dv(outcome) iv(predictor) mv(mediator) cv(covariate1 covariate2 covariate3) l2id(ID)

            Comment


            • #21
              Hey Erik - It isn't that I need multiple IVs. I just happen to have more than one IV because of the literature review and theory development. I successfully did exactly as you suggested last night on both accounts (ran two different ml_mediation calls and put all the covariates into CV). It ran fine this way. As pointed out in Fiedler et al., 2018, there may additional causal models that I may need to consider and discuss. Thank you all so far for the suggestions and challenge. Much appreciated.

              Comment


              • #22
                Good evening. I am reaching out for some help again. I can get Stata to run the mediation cases fine but under the equation 3 results table where the paths (c, a, b, c prime) and effects (IE, DE, TE) appear, tStata indicates my mediator is a level 1 variable. I cannot figure out why. I've double checked how my data is loaded and this is a level 2 variable along with the predictors at the country level. All observations are the same for a given year. I thought there might be some way to assign the level manually but it doesn't appear so. Is there a way to do so that I haven't discovered? The information I've read thus far indicates Stata (via ml_meidaiton) should detect which variables are at which level.
                Tyvm in advance

                Comment


                • #23
                  It is hard to diagnose what might be going on without having access to your data. You can provide a representative slice of your data using the dataex command and then post the results here using the CODE delimiters (# on the panel). You can also post the results of ml_mediation here, which might be useful, but honestly, having data would be best.

                  You say that "all observations are the same for a given year," however, the important thing is that this variable cannot vary within the cluster id variable. If it does, then it would be considered a level 1 (within-cluster) variable.

                  Comment


                  • #24
                    Code:
                    * Example generated by -dataex-. For more info, type help dataex
                    clear
                    input str7 Country byte CountryID str23 Company byte CompanyID int Year double(IV1 IV2) byte(IV3 IV4 IV5 IV6 IV7) double(CV1 MED DV CV2) int CV3 double CV4
                    "Belgium" 2 "Umicore SA"               7 2009 3.92 3.71 65 75 54 94 82 44760.29             85.27 62.26    9315 205 3.8633
                    "Belgium" 2 "Solvay SA"                8 2009 3.92 3.71 65 75 54 94 82 44760.29             85.27  62.5   18992 147 1.5114
                    "Belgium" 2 "UCB SA"                   9 2009 3.92 3.71 65 75 54 94 82 44760.29             85.27 52.74    9324  85 2.9634
                    "Belgium" 2 "Elia System Operator SA" 10 2009 3.92 3.71 65 75 54 94 82 44760.29             85.27 61.41    1205   9 3.3006
                    "Belgium" 2 "Umicore SA"               7 2010 3.96 3.72 65 75 54 94 82 44184.95 79.16000000000001 62.71    9558 206 6.1376
                    "Belgium" 2 "Solvay SA"                8 2010 3.96 3.72 65 75 54 94 82 44184.95 79.16000000000001  43.8   16785 148 2.4315
                    "Belgium" 2 "UCB SA"                   9 2010 3.96 3.72 65 75 54 94 82 44184.95 79.16000000000001 51.72    8898  86  3.227
                    "Belgium" 2 "Elia System Operator SA" 10 2010 3.96 3.72 65 75 54 94 82 44184.95 79.16000000000001 66.52 1755.47  10 3.4026
                    "Belgium" 2 "Umicore SA"               7 2011 3.97 3.77 65 75 54 94 82 47410.57              79.2 73.34    9494 207 7.1153
                    "Belgium" 2 "Solvay SA"                8 2011 3.97 3.77 65 75 54 94 82 47410.57              79.2 49.24   29121 149 2.5161
                    "Belgium" 2 "UCB SA"                   9 2011 3.97 3.77 65 75 54 94 82 47410.57              79.2  60.1    8506  87 3.0242
                    "Belgium" 2 "Elia System Operator SA" 10 2011 3.97 3.77 65 75 54 94 82 47410.57              79.2 54.32 1809.73  11 3.1782
                    "Belgium" 2 "Umicore SA"               7 2012 3.95 3.78 65 75 54 94 82 44670.56             79.03 67.96    9699 208 5.8514
                    "Belgium" 2 "Solvay SA"                8 2012 3.95 3.78 65 75 54 94 82 44670.56             79.03 68.43   29103 150 3.0727
                    "Belgium" 2 "UCB SA"                   9 2012 3.95 3.78 65 75 54 94 82 44670.56             79.03 59.31    8535  88 2.9946
                    "Belgium" 2 "Elia System Operator SA" 10 2012 3.95 3.78 65 75 54 94 82 44670.56             79.03 44.29 1886.37  12 3.1824
                    "Belgium" 2 "Umicore SA"               7 2013 3.99 3.81 65 75 54 94 82 46757.95             78.93 57.69    9491 209 4.8902
                    "Belgium" 2 "Solvay SA"                8 2013 3.99 3.81 65 75 54 94 82 46757.95             78.93 61.67   29400 151 2.6524
                    "Belgium" 2 "UCB SA"                   9 2013 3.99 3.81 65 75 54 94 82 46757.95             78.93  60.3    8224  89 2.0008
                    "Belgium" 2 "Elia System Operator SA" 10 2013 3.99 3.81 65 75 54 94 82 46757.95             78.93 44.98    1800  13 2.3237
                    "Belgium" 2 "Umicore SA"               7 2014 3.91 3.71 65 75 54 94 82 47764.07             80.93 59.73    9631 210 3.6372
                    "Belgium" 2 "Solvay SA"                8 2014 3.91 3.71 65 75 54 94 82 47764.07             80.93 62.62   26033 152 3.4015
                    "Belgium" 2 "UCB SA"                   9 2014 3.91 3.71 65 75 54 94 82 47764.07             80.93 67.31    8181  90 2.3859
                    "Belgium" 2 "Elia System Operator SA" 10 2014 3.91 3.71 65 75 54 94 82 47764.07             80.93 50.85    2000  14 2.3149
                    "Belgium" 2 "Umicore SA"               7 2015 3.95 3.66 65 75 54 94 82  41008.3             81.01 59.38    8254 211 3.8535
                    "Belgium" 2 "Solvay SA"                8 2015 3.95 3.66 65 75 54 94 82  41008.3             81.01 62.08   25540 153 2.6027
                    "Belgium" 2 "UCB SA"                   9 2015 3.95 3.66 65 75 54 94 82  41008.3             81.01  58.6    7620  91 3.4175
                    "Belgium" 2 "Elia System Operator SA" 10 2015 3.95 3.66 65 75 54 94 82  41008.3             81.01 44.94  1210.2  15 2.3057
                    "Belgium" 2 "Umicore SA"               7 2016 3.91 3.63 65 75 54 94 82 42012.62             79.01 62.19 8780.94 212 4.2311
                    "Belgium" 2 "Solvay SA"                8 2016 3.91 3.63 65 75 54 94 82 42012.62             79.01 56.57   27000 154  2.428
                    end

                    Comment


                    • #25
                      Tyvm for any help you can provide

                      Comment


                      • #26
                        Scott Henry , can you also share your ml_mediation syntax?

                        Comment


                        • #27
                          Sure Erik: ml_mediation, dv(DV) iv(IV1) mv(MED) l2id(CompanyID) cv(CV1 CV2 CV3 CV4)

                          Comment


                          • #28
                            The above was incorrect Erik. My syntax was: ml_mediation, dv(DV) iv(IV1) mv(MED) l2id(CountryID) cv(CV1 CV2 CV3 CV4)

                            Comment


                            • #29
                              The COUNTRYID is my clustering value. In this case, 2 for Belgium. Since it is the same country, the value is the same throughout. In contrast, the other level 2 variables: IV1, MED, CV1 all vary annually. For instance, a country's gross domestic product varies annually. The remaining variables: CV2, CV3, CV4 and the DV are all at the firm level and each observation is different bc each firm has an individual value for the DV for the year, and each one of it's associated firm level variables (e.g., net income). My panelvar is the CompanyID and my timevar is Year. IF you are saying that the mediator cannot vary by year bc of how ml_mediation works, I would very much appreciate any suggestions. I cannot figure out how to designate it in the code as a level 2 variable. Syntax that works elsewhere like l2(varname) does not work. I think this would imply that ml_mediation cannot do longitudinal data, but I may be missing something.

                              Comment


                              • #30
                                As ml_mediation understands it, you have two level data - observations within countries. Any variable with values that vary within country is considered a level 1 variable. So in the case of your mediator, which has the same value within a year but is different each year, it is appropriately being treated by ml_mediation as a level 1 variable that varies within country. This is why you are seeing the mediator listed as a level 1 variable.

                                If you truly wanted each country to have a single value for MED across years, you would need to calculate a country mean, but that is not suggested because it would be throwing away information.

                                Comment

                                Working...
                                X