Announcement

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

  • repeated-measures ancova

    Hello Statalist members,

    I need some help on fitting a repeated measures ANCOVA model in my research. I'm using Stata 17.

    I first fitted a repeated measures ANOVA model by using the following code:

    Code:
    anova em bcorpalt / id|bcorpalt emtype bcorpalt#emtype, repeated(emtype)
    where my between-subject effect is bcorpalt and within-subject effect is emtype. After some discussion, my coauthor team decided to add a covariate, pollute1, to the above model, which will make a repeated measure ANCOVA model. The covariate under consideration is an industry variable; it is a dummy variable and we think it is time invariant.

    However, the following two codes both gave me this feedback: "could not determine between-subject error term; use bse() option"
    Code:
    anova em bcorpalt i.pollute1 / id|bcorpalt emtype bcorpalt#emtype, repeated(emtype)
    Code:
    anova em bcorpalt / id|bcorpalt emtype bcorpalt#emtype i.pollute1, repeated(emtype)
    Thus, my question is where a time invariant covariate goes in a repeated measures ANCOVA model? Thanks for your help in advance.

  • #2
    Originally posted by Jiahui Lu View Post
    . . . my question is where a time invariant covariate goes in a repeated measures ANCOVA model?
    It goes upfront, where other variables under which subjects are nested go.

    If you are committed to using anova to fit this model, then you can refer to this thread and references shown there for further discussion.

    Otherwise, you might want to consider something along these lines.
    Code:
    egen int fid = group(id bcorpalt)
    
    mixed em i.(pollute1 bcorpalt##emtype) || fid: , ///
        noconstant residuals(unstructured, t(emptype)) ///
            reml dfmethod(kroger)
    The first line won't be necessary if your subjects variable identifies your subjects within the entire dataset, but your use of the id|bcorpalt error term implies that id distinguishes them only within each level of the bcorpalt factor.

    Comment

    Working...
    X