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

  • Controlling for baseline variable when using data in long format

    I am analysing longitudinal data that involves a dependent variable which is continuous and measured at 4 time points. I am intending to use mixed methods to determine explanatory variables that could be associated with the dependent variable. One of the explanatory variables I intend to use is the baseline value of the dependent variable. How do I determine this in stata for data that’s in long format? Thank you

  • #2
    Well, you don't show example data, so I can only describe what you need to do in general terms. By "mixed methods" I assume you really mean that you plan to use a mixed effects model.

    So the first thing you need to do is create a new variable that is the baseline value of the dependent variable. That will go something like this:

    by unit_identifier (time_variable), sort: gen baseline_dep_var = dep_var[1]
    Then when you run your mixed effects model, include in the command an -if- clause which excludes observations corresponding to the baseline time And include the baseline dependent variable you just created as one of the model covariates..