Announcement

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

  • #16
    Originally posted by Joseph Coveney View Post
    So mask is an outcome variable.

    I recommend that you step back from all of the nested-versus-crossed for a moment and take time to get a conceptual grip on what these neuroimaging terms are, what they represent. They can't be just stuff that pops out of some software package or another.

    From what you say, mask (i.e., color area) is a crude categorization of fractional anisotropy. Maybe start from that.
    Thanks for your response Joseph.

    Comment


    • #17
      Originally posted by Clyde Schechter View Post
      In truth, I don't know much about the -contrast- command and have never used it. It may be that you can get the same results with -contrast-, but I really don't know. I like using -margins- because it is very general and can be used to compute a wide range of post-estimation statistics, and having gotten used to its syntax, I find it very easy to write precisely the commands that will get me the particular statistics I'm interested in. Maybe -contrast- is as good or even better, or maybe it does something rather different; I just don't know. Sorry I can't answer that.
      Dear Clyde,

      Below is the output of using the margins command. I have two questions:

      1, Where is the 0.Group?
      2, How can I interpret the coefficient for example

      1 3 | -.0493103

      Best,
      Jack Liang
      Code:
       margins specific_mask, dydx(Group)
      
      Average marginal effects                        Number of obs     =        280
      Model VCE    : Robust
      
      Expression   : Linear prediction, fixed portion, predict()
      dy/dx w.r.t. : 1.Group
      
      -------------------------------------------------------------------------------
                    |            Delta-method
                    |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
      0.Group       |  (base outcome)
      --------------+----------------------------------------------------------------
      1.Group       |
      specific_mask |
               1 1  |  -.0136169   .0207363    -0.66   0.511    -.0542593    .0270256
               1 2  |  -.0225617    .019598    -1.15   0.250    -.0609732    .0158497
               1 3  |  -.0493103   .0133219    -3.70   0.000    -.0754207   -.0231999
               1 4  |    -.03988   .0183443    -2.17   0.030    -.0758342   -.0039258
               2 1  |  -.0288157    .019685    -1.46   0.143    -.0673975    .0097661
               2 2  |  -.0179096   .0213226    -0.84   0.401    -.0597011     .023882
               2 3  |  -.0466997   .0136155    -3.43   0.001    -.0733856   -.0200138
               2 4  |  -.0406223     .01809    -2.25   0.025    -.0760781   -.0051665
               3 1  |  -.0263219     .02059    -1.28   0.201    -.0666775    .0140337
               3 2  |   -.038107   .0165473    -2.30   0.021     -.070539    -.005675
               3 3  |  -.0491556   .0138539    -3.55   0.000    -.0763086   -.0220025
               3 4  |  -.0499809   .0168559    -2.97   0.003    -.0830179   -.0169438
               4 1  |  -.0236834   .0207031    -1.14   0.253    -.0642607    .0168939
               4 2  |  -.0268184   .0187694    -1.43   0.153    -.0636059     .009969
               4 3  |  -.0487373   .0136983    -3.56   0.000    -.0755855   -.0218891
               4 4  |  -.0459144   .0176739    -2.60   0.009    -.0805547   -.0112742
               5 1  |  -.0135729   .0209492    -0.65   0.517    -.0546326    .0274868
               5 2  |  -.0106073   .0200573    -0.53   0.597    -.0499188    .0287042
               5 3  |   -.034678    .014952    -2.32   0.020    -.0639834   -.0053726
               5 4  |  -.0374389   .0166741    -2.25   0.025    -.0701195   -.0047582
      -------------------------------------------------------------------------------

      Comment


      • #18
        The output explains that the 0 group is the reference group. You asked Stata to calculate the marginal effect of Group at all values of variable specific_mask. The latter is a multi-level discrete variable, and the former is a dichotomy.

        The marginal effect of a dichotomy is calculated as the difference between the expected outcomes at the two values of the dichotomy. The output tells you here that 0 is used as the reference value of group, so all marginal effects represent the expected outcome when group = 1 minus the expected outcome when group = 0.

        So, in particular, the row that begins with 1 3 | -.0493103 can be interpreted as saying that when specific_mask == 1 3 (whatever that means), the expected value of your outcome variable is 0.049... lower when group = 1 than it is when group = 0. More concisely put, the marginal effect of group conditional on specific_mask -- 1 3 is a reduction of approximately 0.049.

        Comment


        • #19
          Originally posted by Clyde Schechter View Post
          The output explains that the 0 group is the reference group. You asked Stata to calculate the marginal effect of Group at all values of variable specific_mask. The latter is a multi-level discrete variable, and the former is a dichotomy.

          The marginal effect of a dichotomy is calculated as the difference between the expected outcomes at the two values of the dichotomy. The output tells you here that 0 is used as the reference value of group, so all marginal effects represent the expected outcome when group = 1 minus the expected outcome when group = 0.

          So, in particular, the row that begins with 1 3 | -.0493103 can be interpreted as saying that when specific_mask == 1 3 (whatever that means), the expected value of your outcome variable is 0.049... lower when group = 1 than it is when group = 0. More concisely put, the marginal effect of group conditional on specific_mask -- 1 3 is a reduction of approximately 0.049.
          Do we have to use multiple testing correction here? Because we used Z test to do the 20 comparisons? If we can, which is the appropriate multiple testing method here?

          Best,
          Jack Liang

          Comment


          • #20
            The appropriate use of multiple testing correction is a fairly messy and controversial topic. I will offer you my opinion, but with the caveat that if you ask 5 statisticians you will likely get at least 5 different answers.

            I am, in general, not a fan of correcting for multiple hypothesis tests. But given that I am not a fan of hypothesis testing in the first place, perhaps that goes without saying. One of the reasons I am not a fan of hypothesis tests is precisely because they become difficult to interpret when you do more than one of them.

            That said, the one situation in which I think that correcting for multiple hypothesis tests is actually helpful and adds clarity rather than confusion is the one in which you find yourself. You have 20 pre-planned comparisons being done that each correspond to a level of a single multi-level variable. In this situation, I find the Bonferroni correction useful. By the way, you can have Stata do this for you by adding the -mcompare(bonferroni)- option to your -margins- command.

            Comment


            • #21
              We compare fa value mean difference of two groups of specific-mask within each braintract by using this model
              Code:
               
               mixed fa i.group#i.specific_mask i.sex age || id: , vce(robust)
              .

              If I want to compare the fa value mean difference of two groups for each braintract, can we still use the above model? How can we construct code to do the comparisons?

              Much appreciate.

              Jack Liang

              Comment


              • #22
                No, because brain tract is not a variable in that model.

                Comment


                • #23
                  Originally posted by Clyde Schechter View Post
                  No, because brain tract is not a variable in that model.
                  Dear Clyder,

                  One more question about
                  Code:
                   
                   i.group#i.specific_mask
                  .

                  Is this code means the interaction between group and mask, or
                  the interaction between group, mask, and braintract, or
                  something else. A little confused about this variable here.

                  Best,
                  Jack Liang

                  Comment


                  • #24
                    The variable specific mask is not an interaction term. It functions like one in certain ways, because its levels represent all combinations of brain_tract and mask, but -margins- cannot treat it as an interaction. So i.group#specific_mask is an interaction between group and a single variable that represents each combination of brain tract and mask as a separate level. But that variable (except in its labeling) does not retain any information about brain tracts or masks separately, and you cannot extract that information back out of it in your regression or regression post-estimation commands.

                    Comment


                    • #25
                      Originally posted by Clyde Schechter View Post
                      The variable specific mask is not an interaction term. It functions like one in certain ways, because its levels represent all combinations of brain_tract and mask, but -margins- cannot treat it as an interaction. So i.group#specific_mask is an interaction between group and a single variable that represents each combination of brain tract and mask as a separate level. But that variable (except in its labeling) does not retain any information about brain tracts or masks separately, and you cannot extract that information back out of it in your regression or regression post-estimation commands.
                      Thanks!
                      And if I had to write a report using a regression, how can I write this i.group#specific_tract in my model?

                      Best,
                      Jack Liang
                      Click image for larger version

Name:	1201675679.jpg
Views:	1
Size:	91.5 KB
ID:	1484480

                      Comment


                      • #26
                        I think I would refer to it as "combination of brain tract and mask."

                        Comment


                        • #27
                          Originally posted by Clyde Schechter View Post
                          I think I would refer to it as "combination of brain tract and mask."
                          Dear Clyde,

                          In my data set, I have a variable braintract_mask, which seems is the same as specific_mask. For example for the value 1 1, these two variables all mean the mask1 on the corpus collasum, 1 2 means the mask 2 on the corpus collasum. But when I did the regression,

                          Code:
                          mixed fa i.group i.group#i.specific_mask i.sex age || id: || braintract:, vce(robust)
                          margins specific_mask, dydx(group) mcompare(sid)

                          Code:
                          mixed fa i.group i.group#i.braintract_mask i.sex age || id: || braintract:, vce(robust)
                          margins braintract_mask, dydx(group) mcompare(sid)
                          I got different regression coefficients and different margins.

                          SO what is the different between this specific_mask(which is generated by "egen specific_mask = group(braintract mask), label") with braintract_mask?

                          Best,
                          Jack Liang

                          Click image for larger version

Name:	WeChat Screenshot_20190221115213.png
Views:	1
Size:	18.5 KB
ID:	1484891

                          Comment


                          • #28
                            Well, your screenshot (please read Forum FAQ 12 which specifically asks people not to use screenshots to post data) happens to be readable, and readable enough that I can see what is going on here. (But most screenshots are not, and even when readable they often lack important details about the data, so please don't do this again.)

                            Your variables specific_mask and braintract_mask look the same to your eyes. But they are actually different in Stata. specific_mask's actual values are 1, 2, 3, 4, 5, 6 and they are labeled 1 1, 1 2, 1 3, etc. But braintract_mask actually takes on the values 11, 12, 13, 21, 22, and 23. So Stata may be choosing different reference categories for these variables or otherwise handling them in different ways. I suspect, though, that your marginal effects are just listed in a different order in the output. Anyway, 11, 12, 13, 21, 22, 23 is kind of an odd way to code a variable like this. Stick with specific_mask.

                            In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 15.1 or a fully updated version 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

                            When asking for help with code, always show example data. When showing example data, always use -dataex-.

                            Comment


                            • #29
                              Originally posted by Clyde Schechter View Post
                              Well, your screenshot (please read Forum FAQ 12 which specifically asks people not to use screenshots to post data) happens to be readable, and readable enough that I can see what is going on here. (But most screenshots are not, and even when readable they often lack important details about the data, so please don't do this again.)

                              Your variables specific_mask and braintract_mask look the same to your eyes. But they are actually different in Stata. specific_mask's actual values are 1, 2, 3, 4, 5, 6 and they are labeled 1 1, 1 2, 1 3, etc. But braintract_mask actually takes on the values 11, 12, 13, 21, 22, and 23. So Stata may be choosing different reference categories for these variables or otherwise handling them in different ways. I suspect, though, that your marginal effects are just listed in a different order in the output. Anyway, 11, 12, 13, 21, 22, 23 is kind of an odd way to code a variable like this. Stick with specific_mask.

                              In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 15.1 or a fully updated version 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

                              When asking for help with code, always show example data. When showing example data, always use -dataex-.
                              Dear Clyder

                              Thanks you very much! I remember next time I will use -dataex-.

                              So the interaction term i.group#specific_mask here is actually the interaction term group#braintract#mask in the real model. Because we want to make Stata run the comparison that we need, so we mark group#braintract#mask as group#specific_mask. If I want to write the real model in my poster or report,
                              I need to write the real model as Y=B0+B1group+B2sex+B3age+B4group*braintract*mask+a1id+a2braintract+E,
                              I shouldn't write it as Y=B0+B1group+B2sex+B3age+B4group*specific_mask+a1id+a2braintract+E,
                              correct?

                              Thanks,
                              Jack Liang
                              Code:
                               
                               mixed fa i.group i.group#i.specific_mask i.sex age || id: || braintract:, vce(robust)

                              Comment


                              • #30
                                Originally posted by Liang Wang Jack View Post
                                So the interaction term i.group#specific_mask here is actually the interaction term group#braintract#mask in the real model. Because we want to make Stata run the comparison that we need, so we mark group#braintract#mask as group#specific_mask. If I want to write the real model in my poster or report,
                                I need to write the real model as Y=B0+B1group+B2sex+B3age+B4group*braintract*mask+a1id+a2braintract+E,
                                correct?
                                You should also fit the real model in Stata.

                                You don't need to concoct a "specific mask" in order to make the comparisons that you want. Both margins and contrast will give you the comparisons that you desire after fitting the real model. (Run the do-file below to see that it is the case.)

                                Although I have doubts about its exogeneity—and I'm not sure why you sometimes have three categories and sometimes four in your snippets above—for mask, red (apparently high-probability of white matter hyper-intensity) in the corpus callosum means the same as red in the corona radiata, and in all of the brain tracts. Mask is crossed with brain tract. The model that you fit in Stata should include a term for the interaction of brain tract and mask, and not "specific mask".
                                Code:
                                version 15.1
                                
                                clear *
                                
                                set seed `=strreverse("1484913")'
                                
                                quietly set obs 14
                                generate byte grp = _n > _N / 2
                                label variable grp Group
                                
                                generate int pid = _n
                                label variable pid "Particpant ID"
                                generate double pid_u = rnormal(0, 2)
                                generate byte age = runiformint(18, 88)
                                generate byte sex = mod(_n, 2)
                                
                                quietly expand 5
                                bysort pid: generate byte btc = _n
                                label define BrainTracts 1 "Cingulum bundle" 2 "Corona radiata" ///
                                    3 "Corpus callosum" 4 "Internal capsule" 5 "Remaining white matter"
                                label values btc BrainTracts
                                label variable btc "Brain Tract"
                                generate double btc_u = rnormal(0, 1) // Assumption about the data-generating mechanism
                                
                                quietly expand 4
                                bysort pid btc: generate byte msk = _n
                                label define Leukoaraiosis 1 "Red High-probability WMH" 2 "Green Low-probability WMH" 3 "Blue NAWM" 4 "God knows"
                                label values msk Leukoaraiosis
                                label variable msk Mask
                                
                                generate double fai = normal(pid_u + btc_u + rnormal(0, 0.5))
                                label variable fai "Fractional Anisotropy"
                                
                                *
                                * Begin here
                                *
                                
                                // Recommend the following transformation in lieu of -vce(robust)-; could use arcsine square-root, too
                                generate double ifa = invnormal(fai)
                                
                                anova ifa c.age sex grp / pid|grp btc grp#btc / btc|pid|grp msk btc#msk grp#msk grp#btc#msk
                                
                                quietly mixed ifa c.age i.sex i.grp i.btc i.grp#i.btc i.msk i.btc#i.msk i.grp#i.msk i.grp#i.btc#i.msk ///
                                    || pid: || btc: , reml dfmethod(satterthwaite) nolrtest
                                
                                margins btc#msk, dydx(grp) df(`=e(df_max)') mcompare(bonferroni)
                                
                                contrast r.grp@btc#msk, df(`=e(df_max)') mcompare(bonferroni)
                                
                                exit

                                Comment

                                Working...
                                X