Announcement

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

  • Piecewise Linear Regression, Linear predictor is time with only four time points.

    Hello, Statalist Users,

    This is an exploratory question: Is it possible to carry out a piecewise linear model in which the linear predictor (time in this case) only has four time points? The outcome at each time point is a score. I want three slope segments so that I can compare the equality of the middle slope between two or more groups.

    Seems like I need a continuous predictor with a greater range that I can then divide into segments. Though time is continuous, those four time points are basically discrete in my thinking.

    Alternative approaches are welcome.

    D

  • #2
    -help mkspline-

    Create a linear spline with knots at the second and third time periods. Use all three spline variables as predictors in your regression and you will get the slopes for time periods 1 to 2, 2 to 3, and 3 to 4. You can do comparisons with the -test- or -lincom- commands.

    Comment


    • #3
      Thanks much.

      So when I graph this I'll get three slopes, correct? Also, when using -test- to compare slopes for two different groups (binary covariate), is it necessary to precede -test- with -suest-?

      Comment


      • #4
        So when I graph this I'll get three slopes, correct?
        Well, graphing this will be a bit of an ordeal because you have three variables for time to deal with, but yes, after you slog through it you will get a piecewise linear graph with three segments.

        Also, when using -test- to compare slopes for two different groups (binary covariate), is it necessary to precede -test- with -suest-?
        Um, I don't understand why you are asking this in this context. There is only one regression equation, so nothing for -suest- to do. This makes me think you have misunderstood my earlier advice. You do not do three separate regressions on the spline variables. You include all three of them as predictors in a single regression.

        Comment


        • #5
          Sorry, Clyde. With respect to my last question I was thinking of running two separate regressions with an if statement so that I could compare the difference in slope between two or more groups just on the second segment. That's why I asked about the suest command. I think I understand now what should be done, though I think I would have to adapt it to work with panel data using mixed. I see that you've assisted another individual with that question in the past.

          Thanks,
          David

          Comment


          • #6
            Hello David. If you have access to Michael Mitchell's book Interpreting and Visualizing Regression Models Using Stata, see chapter 12, Piecewise by categorical interactions. HTH.
            --
            Bruce Weaver
            Email: bweaver@lakeheadu.ca
            Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
            Stata version: 15.1 IC (Windows)

            Comment

            Working...
            X