Announcement

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

  • Use lincom to compare groups means to overall mean in SEM

    Hello,

    I am running a model in SEM (stata version 13) to examine the association between month of birth and birthweight (controlling for several other variables).

    Example:

    sem (bweightcor <- bage_d gestage bsex mheightavg parity bm1-bm12 bm14-bm15 )

    where bm1-bm12 bm14-bm15 represent the dummy variables for each of the 15 months (in this case month 13 is used at the reference).


    I would like to use lincom to test whether any of the mean monthly birth weights (15 months) are different than the overall mean birthweight, but am unsure how to specify this when I have a series of dummy variables in the model (as opposed to the i.birthmonth which does not appear to work in SEM) I would greatly appreciate if someone could help me out with this!

    Thanks!

    Emily

  • #2
    I wonder why you are fitting this using -sem- and why not just run the -regress- and use the -margins- command to exploit further testing. However, if you really need to run sem, try the following:

    Code:
    assuming you have run the model:
    
    sem (bweightcor <- bage_d gestage bsex mheightavg parity bm1-bm12 bm14-bm15 )
    mat li e(b) // see the coefficient matrix cloumn names to identify 15month precisely. I assume it is 1.bm15 at 15months
    
    sum bweightcor //summarise the overall mean. This command should be run simultaneously with the following two commands below
    loc overall_mean = r(mean) // get the overall mean in a macro
    lincom (_b[_cons] + _b[1.bm15]) - `overall_mean'
    Roman

    Comment


    • #3
      Thanks for your reply, Roman! I am running in SEM because I have an issue of missing data in some of my co-variates so am using the mvml procedure to handle that.

      I did not fully understand the comment "see the coefficient matrix column names to identify 15month precisely. I assume it is 1.bm15 at 15months". The output for the coefficient matrix uses "bm15" rather than "i.bm15". Should I use "bm15" vs. "i.bm15" in the sample code that you provided?


      bweightcor: bweightcor: bweightcor: bweightcor: bweightcor: bweightcor:
      bm9 bm10 bm11 bm12 bm14 bm15




      I ran: lincom (_b[_cons] + _b[bm15]) - `overall_mean' with the other coded provided
      This does produce a test against the mean, but I just wanted to make sure that I understand correctly that this is comparing the adjusted birthweight at month 15 compared to the overall mean? Accordingly, I can just substitute in bm1 through bm14 to test each month against the mean?

      Thank you again!

      Emily

      Comment


      • #4
        Yes, your understanding is correct. Sorry for the factor variable notation I had in mind which confused you.
        Roman

        Comment


        • #5
          Amazing! Thank you!

          Comment


          • #6
            Hello,

            I would like to ask a follow up question about this earlier thread. If I run the following code after my SEM model, in which the numbers represent the mean values of the co-variates in my dataset, is the interpretation correct that this is testing whether the mean of birth month 1 (bm1) at the mean level of other covariates is different than the overall mean?

            sum bweightcor
            loc overall_mean = r(mean)
            lincom 39*gestage + 150*mheightavg + 0.5*bsex + 0.7*primip+ 0.7*noedu + 3*bage_d + 0.3*foodinsec + _cons + bm1- `overall_mean'


            Thank you!

            Emily




            Comment

            Working...
            X