Announcement

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

  • Three way interaction marginsplot After SEM?

    Hi Everyone,

    I was wondering if anyone had experience or could help me create a graph for a three-way interaction between two continuous variables (sleep and depression scores) and one categorical variable (sex) after an SEM command.

    Here is what I have tried so far and the error I ran into:

    Code:
    sem (c_sat_composite <- c_cesd_wthsleep c_avg_sleepdis c_depXsleep c_depXsex c_sleepXsex c_depXsleepXsex ce_rage rasex rarace ///
                     ramari ra_edu emp_status smoking_now alcohol_ever meds_use diff_func gn_health rate_memory), allmissing method(mlmv)     
                
                    *Graph Significant 3-way interaction
                    margins rasex, at(c_cesd_wthsleep==(0(1)7) c_avg_sleepdis=(0(1)2))
                    marginsplot, by(rasex) noci xdimension(c_cesd_wthsleep)
    However, I get the error that
    Code:
    factor 'rasex' not found in list of covariates
    Any guidance or help would be greatly appreciated!

  • #2
    I realized that I was getting an error as I could not specify that my sex variable (rasex) was a factor with the SEM command, which I had to use to implement the full maximum likelihood method. Does anyone have any insight on how I might go about plotting a three-way interaction after the SEM command, given that I have a continous*continous*categorical interaction term? Any help would be greatly appreciated

    Comment


    • #3
      This might work, but I'm not 100% sure without having some data to play with.

      Code:
      margins , at(c_cesd_wthsleep==(0(1)7) c_avg_sleepdis=(0(1)2) rasex=(0 1))
      marginsplot, by(rasex) noci xdimension(c_cesd_wthsleep)

      Comment

      Working...
      X