Announcement

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

  • Test of Mean Differences by Categorical Variable

    Hello Stata users,

    I would like to perform a test of mean differences between two independent variables (q1 and q2), however, I would like to test the mean differences between 5 age categories i.e. test the mean differences in q1 and q2 between age_cat == 1 and age_cat == 2, age_cat == 1 and age_cat == 3, age_cat == 2 and age_cat == 4, etc (just to name a few). In total, this would mean 10 mean difference comparisons.

    However, using the ttest function, you cannot perform: ttest q1 = q2, by (age_cat) since the error message gives: r(420): "more than 2 groups, only 2 allowed".

    Is there a way to code the testing that what I would like to do?

    Thank you in advance!

  • #2
    it is not completely clear to me what you want but you should start with -anova- and then use either -contrast- or -pwcompare-; see
    Code:
    help anova
    help anova postestimation

    Comment


    • #3
      Louis:
      can't you -regress- (q1-q2) onto -i.agecat- and then use -test-?
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        You didn't inform the pattern of distribution of q1 and q2, and I'm wondering whether they are Likert scales.
        Best regards,

        Marcos

        Comment

        Working...
        X