Announcement

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

  • Assessing 3-way Interaction

    I am modeling cost with treatment, facility, and month using a GLM with a gamma distribution, and there is significant 3-way interaction. Here are the variable definitions
    Cost: continuous ($30,000-$200,000)
    Treatment: binary (0 or 1)
    Facility: categorical (1, 2, 3)
    Month: continuous (0-110)

    I have a lot of details I need to parse out, one of which is testing for differences in cost at different month values. For example, below is an interaction plot for facility 1. Clearly, there is no significant difference between treatment 0 or treatment 1; however, I want to test for a significant change in cost between months 10 and 90. How would I test for a mean cost change from 10 months to 90 months at only facility 1?

    Code:
    glm cost i.treatment##i.facility##c.month, f(gam) l(log)
    margins, at(month=(10(10)90) treatment=(1 2) facility=(1)) marginsplot, noci title("Interaction Plot of Treatment Strategy Over Time") subtitle("Facility 1 Patients Only") xtitle("Number of Months",margin(medium)) ytitle("Estimated Cost ($)", margin(medium)) graphregion(col(white)) ylabel(40000(20000)125000, format(%9.0gc) labsize(small) ) xlabel(10(20)90,labsize(small)) legend(on order(1 "0" 2 "1"))
    Attached Files

  • #2
    How would I test for a mean cost change from 10 months to 90 months at only facility 1?
    Code:
    margins, at(month = (10 90) facility = 1) pwcompare effect

    Comment


    • #3
      Thank you!

      Comment


      • #4
        Another question: how would I compare the slopes of treatment 1 versus treatment 2?

        Comment


        • #5
          Well, with a 3-way interaction model, you are stipulating that the treatments do not have unique effects, but rather multiple effects depending on the facility, and also on the passage of time. So do you want to compare the treatment effects at some particular combinations of facilities and time periods? Or do you want an average effect, averaged over the distribution of facilities and time in your data? Or by slopes, do you here mean the slope of the outcome:time graph? If the latter, do you want that separately at each facility, or an average over the distribution of facilities in your data?

          Comment


          • #6
            I believe I figured it out, but I don't want to leave the post unanswered. Clyde Schechter, that's a really good series of questions, and I appreciate you forcing me to think it through. For this analysis and 3-way interaction, I think it is necessary to compare a) the slopes of the two treatments per facility and b) the slopes of the same treatment at each facility. I am doing so with the following series of statements. These would then need to be extended for both treatments and each facility.

            Code:
            margins, dydx(month) at(treatment=(1 2) center=1)
            margins, dydx(month) at(treatment=(1 2) center=1) pwcompare(effects)
            margins, dydx(month) at(treatment=1 center=(1 2))
            margins, dydx(month) at(treatment=1 center=(1 2)) pwcompare(effects)

            Comment


            • #7
              Looks right to me.

              Comment

              Working...
              X