Announcement

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

  • ttest over multiple subsamples

    Hi,
    I have three variables, x, y, and z. x and y are categorical variables, x takes 0 and 1, but y takes 1, 2, and 3.

    I want to do a t-test on z as follows:

    (z if x==0 and y==1) == (z if x==0 and y==2)
    (z if x==0 and y==3) == (z if x==0 and y==2)

    (z if x==1 and y==1) == (z if x==1 and y==2)
    (z if x==1 and y==3) == (z if x==1 and y==2)

    How can I conduct such tests? I'd appreciate your help. Thanks,

  • #2
    One way is to model these in a single model.

    Code:
    regress z i.x i.y

    Comment


    • #3
      Originally posted by Leonardo Guizzetti View Post
      One way is to model these in a single model.

      Code:
      regress z i.x i.y
      trying to figure out how to get if, for example, the following difference is significant?
      (z if x==0 and y==1) - (z if x==0 and y==2)

      Comment


      • #4
        Originally posted by Saber Feizy View Post

        trying to figure out how to get if, for example, the following difference is significant?
        (z if x==0 and y==1) - (z if x==0 and y==2)
        To keep it simple, you can run this as a t-test. Foor more formal testing, a combined model approach would be better but an intro background to regression would be useful.

        Code:
        ttest z if inlist(y, 1, 2) & x==0, by(y)

        Comment

        Working...
        X