Announcement

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

  • Gender#Time

    I am trying to break out my findings by gender and time in Mixed-effects ML regression. My value label for gender is Female=1 and Male=0. My interaction comes back as follows.
    Gender#time2 |
    Male#1 | .0846504
    Female#0 | -.1947381
    Female#1 | 0 (omitted)

    All of the times include Male#1, Female#0, and Female#1. I assumed that Male#1 and Female#0 were the results for Male and Female, but what then is Female#1?
    I appreciate your help.

  • #2
    Can you post a cross-tab of Gender by time2, ideally without labels (option nolab). Also post your regression model and output. Please use code delimiters (use the hashtag button and put all Stata syntax and output between the delimiters).

    Comment


    • #3
      # Stata Command for Crosstab
      tabulate Gender_Female time2, nolab

      # Crosstab Output
      Gender Index1==
      2
      0 1 Total
      0 2,442 407 2,849
      1 2,592 432 3,024
      Total 5,034 839 5,873
      # Regression Model Command
      xtmixed Peer_Eval_Lead Gender_Female Gender_Female#time2 Gender_Female#time3 Gender_Female#time4 Gender_Female#time5 Gender_Female#time6 Gender_Female#time7 c.Index1 || team_id_num: , mle

      # Regression Model Output
      -------------------------------------------------------------------------------------
      Peer_Eval_Lead | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      --------------------+----------------------------------------------------------------
      Gender_Female | .9521573 .1399553 6.80 0.000 .6778499 1.226465
      |
      Gender_Female#time2 |
      Male#1 | .0983908 .0554776 1.77 0.076 -.0103432 .2071248
      Female#0 | -.1804934 .0488327 -3.70 0.000 -.2762038 -.084783
      Female#1 | 0 (omitted)
      |
      Gender_Female#time3 |
      Male#1 | .0872443 .0572194 1.52 0.127 -.0249036 .1993922
      Female#0 | -.2216256 .0459144 -4.83 0.000 -.3116162 -.1316351
      Female#1 | 0 (omitted)
      |
      Gender_Female#time4 |
      Male#1 | .0177903 .0603287 0.29 0.768 -.1004517 .1360323
      Female#0 | -.1414046 .0445848 -3.17 0.002 -.2287891 -.0540201
      Female#1 | 0 (omitted)
      |
      Gender_Female#time5 |
      Male#1 | .0298173 .0645114 0.46 0.644 -.0966229 .1562574
      Female#0 | -.1226618 .0451415 -2.72 0.007 -.2111375 -.0341861
      Female#1 | 0 (omitted)
      |
      Gender_Female#time6 |
      Male#1 | -.032255 .0695611 -0.46 0.643 -.1685922 .1040822
      Female#0 | -.0317765 .0473266 -0.67 0.502 -.1245349 .060982
      Female#1 | 0 (omitted)
      |
      Gender_Female#time7 |
      Male#1 | -.0854471 .0753298 -1.13 0.257 -.2330909 .0621967
      Female#0 | 0 (omitted)
      Female#1 | 0 (omitted)
      |
      Index1 | .0061405 .0087231 0.70 0.481 -.0109565 .0232376
      _cons | 3.458987 .0488087 70.87 0.000 3.363324 3.55465
      -------------------------------------------------------------------------------------

      ------------------------------------------------------------------------------
      Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
      -----------------------------+------------------------------------------------
      team_id_num: Identity |
      sd(_cons) | .3505707 .021669 .310572 .3957208
      -----------------------------+------------------------------------------------
      sd(Residual) | .7485296 .0071064 .7347301 .7625882
      ------------------------------------------------------------------------------
      LR test vs. linear model: chibar2(01) = 754.44 Prob >= chibar2 = 0.0000

      Comment


      • #4
        What is the difference between the time variables? And again, please use code delimiters. Look at the buttons above the box where you enter your message text. See the big #. Put all code and output between the delimiters it gives you:

        Code:
        ["CODE]Remove quotation marks, but place any code and results between the two blocks.[/CODE"]

        Comment


        • #5
          The data is longitudinal. It was measured at 7 different times. Index1 is times 1-7. I left out week 1 in the analysis.
          Code:
          tabulate Index1 Gender_Female, nolabel
          Code:
           
          Gender_Female
          Index1 0 1 Total
          1 407 432 839
          2 407 432 839
          3 407 432 839
          4 407 432 839
          5 407 432 839
          6 407 432 839
          7 407 432 839
          Total 2,849 3,024 5,873
          Here is the model again, perhaps in a form easier to view.
          Code:
           
          Peer_Eval_Lead Coef. Std. Err. z P>|z| [95% Conf. Interval]
          Gender_Female 0.952157 0.139955 6.8 0 0.67785 1.226465
          Gender_Female#time2
          Male#1 0.098391 0.055478 1.77 0.076 -0.01034 0.207125
          Female#0 -0.18049 0.048833 -3.7 0 -0.2762 -0.08478
          Female#1 0 (omitted)
          Gender_Female#time3
          Male#1 0.087244 0.057219 1.52 0.127 -0.0249 0.199392
          Female#0 -0.22163 0.045914 -4.83 0 -0.31162 -0.13164
          Female#1 0 (omitted)
          Gender_Female#time4
          Male#1 0.01779 0.060329 0.29 0.768 -0.10045 0.136032
          Female#0 -0.1414 0.044585 -3.17 0.002 -0.22879 -0.05402
          Female#1 0 (omitted)
          Gender_Female#time5
          Male#1 0.029817 0.064511 0.46 0.644 -0.09662 0.156257
          Female#0 -0.12266 0.045142 -2.72 0.007 -0.21114 -0.03419
          Female#1 0 (omitted)
          Gender_Female#time6
          Male#1 -0.03226 0.069561 -0.46 0.643 -0.16859 0.104082
          Female#0 -0.03178 0.047327 -0.67 0.502 -0.12453 0.060982
          Female#1 0 (omitted)
          Gender_Female#time7
          Male#1 -0.08545 0.07533 -1.13 0.257 -0.23309 0.062197
          Female#0 0 (omitted)
          Female#1 0 (omitted)
          Index1 (Time) 0.006141 0.008723 0.7 0.481 -0.01096 0.023238
          _cons 3.458987 0.048809 70.87 0 3.363324 3.55465

          Comment


          • #6
            xtmixed Peer_Eval_Lead Gender_Female Gender_Female#time2 Gender_Female#time3 Gender_Female#time4 Gender_Female#time5 Gender_Female#time6 Gender_Female#time7 c.Index1 || team_id_num: , mle
            is a rather odd way to model this data. It seems like you are, on the one hand, treating time as discrete and looking to have the gender effect be modified by time, yet you also seek to model a continuous linear time trend. The inclusion of both continuous and discrete time in the same model is a recipe for, at best, confusion, and certainly invites the kind of colinearity-induced omissions you are seeing here. I would only undertake a model like this if there is a truly compelling theoretical reason for doing so.

            Most likely, not knowing much about the substance of your problem, I would just treat time as a discrete variable and do this as
            Code:
            mixed Peer_Eval_Leader i.Gender_Female##i.Index1 || team_id_num:, mle
            margins Index1, dydx(Gender_Female)
            Alternatively, if it is really important to treat time as a linear continuous effect, and you need to see its effect modification on gender:
            Code:
            mixed Peer_Eval_Leader i.Gender_Female##c.Index1 || team_id_num:, mle
            margins, dydx(Gender_Female) at(Index1 = (1(1)7))

            Comment


            • #7
              Agreed with Clyde Schechter. An additional wrinkle is that if you decide to treat time as continuous, which may make more sense given your theory, then you should consider allowing the time slope to vary across teams. In the mixed model, this means that each team is assumed to have a unique time slope that is drawn from a normal distribution with a mean of 0 and an estimated variance. This would be a small addition to the second syntax Clyde presented:
              Code:
              mixed Peer_Eval_Leader i.Gender_Female##c.Index1 || team_id_num:Index1, cov(un) mle
              margins, dydx(Gender_Female) at(Index1 = (1(1)7))
              You can use model fit criteria (AIC and BIC) and likelihood ratio testing (lrtest in Stata) to determine whether such a formulation provides better fit to your data.
              Last edited by Erik Ruzek; 17 Jan 2024, 16:15. Reason: Fixed margins syntax to match #6

              Comment


              • #8
                Wow, thank you so very much. Both options work well but the second is indeed a better fit.

                Comment


                • #9
                  I am working on another project, and this time, I am trying to do both HLM and SEM. I am getting interesting findings using 'mixed Conflict team_cq_max i.Index1 || team_id_num:, mle' & 'margins Index1, dydx( team_cq_max )' as well as 'mixed Communication_Frequency team_cq_max i.Index1 || team_id_num:, mle' & 'margins Index1, dydx( team_cq_max)' and finally 'mixed team_report_average Conflict Communication_Frequency team_cq_max i.Index1'. I also got interesting results running 'gsem (Conflict -> team_report_average,) (Communication_Frequency_mean -> team_report_average,) (team_cq_max -> team_report_average,) ( team_cq_max -> Conflict) (team_cq_max -> Communication_Frequency ) (Communication_Frequency -> Conflict, ), nocapslatent' and then looking for mediation with nlcom. With the mixed, I can see the effects of time "indix1" while considering the team and individual level variables. With the gsem plus nlcom, I can see the mediation. Is there any way to combine the two?

                  Comment


                  • #10
                    Yes. You can emulate multi-level models using -gsem-. The gist of it is including latent variable(s) that represent the random intercept(s). For an illustration of the technique, if you are using the current version of Stata, see example 38g in the SEM volume of the PDF documentation that is part of your Stata installation. If you are using an older version, check the table of contents of the SEM volume of the PDF documentation to find the example that illustrates random-intercept and random-slope models.

                    Comment


                    • #11
                      Thank you for that advice. It is really helpful. I am able to run the model when specified As follows:
                      . tsset student_id_num Index1
                      . gsem (Communication_Frequency -> team_report_average, ) (Communication_Frequency -> Conflict, ) (Conflict -> team_report_average, ) (team_cq_k_pct_correct_max -> team_report_average, ) (team_cq_k_pct_correct_max -> Communication_Frequency, ) (team_cq_k_pct_correct_max -> Conflict, ), listwise nocapslatent

                      However, when I try to add the random intercept at the team level, I get "(not concave)" gsem (M1[team_id_num>student_id_num] -> team_report_average, ) (Communication_Frequency -> team_report_average, ) (Conflict -> team_report_average, ) (Conflict -> Communication_Frequency, ) (team_cq_max -> team_report_average, ) (team_cq_max -> Communication_Frequency, ) (team_cq_max -> Conflict, ), covstruct(_lexogenous, diagonal) listwise latent(M1 ) nocapslatent

                      Am I doing something wrong in how I specify the intercept? Even when I tried to simplify the model, once I added the intercept, the model would not work for me. Could it be because my DV is at the team level?

                      Thank you again for all your time and support. It is greatly appreciated!

                      Comment


                      • #12
                        Could it be because my DV is at the team level?
                        Absolutely! A random intercept must have within-cluster variation. In order for a group level variable to have a random intercept, you would need a third level of nesting such as teams within regions. Then you could specify that team_report_average varies across regions but note that you could not regress this random intercept on student level variables. You could only regress it on team level averages of student level variables and then region-specific variables.

                        Make sure and carefully study Exampled 38g and 39g of the Stata sem manual and this thorough presentation by Chuck Huber (StataCorp)

                        Comment


                        • #13
                          Thank you, this was really helpful.

                          Comment

                          Working...
                          X