Dear all,
I have searched statalist, but have not been able to find my answer. I have found possible solution within the stata.
I have two variables, variable A (dichotomous: 0/1) and variable B(8 categories, random order, coded 1-8).
I want to look an interaction between variable A and B for survival (death).
Intuitively, I am inclined to create 8 dummy variables and test for interaction for each dummy separately. Based on what I observe in differences in HRs between the 8 groups, these interactions make sense. Is this a correct way on going about this?
Alternatively, I have found this:
Here, I get a P-value for each category separately, yet these differ substantially from the p-values when I use dummy variables. Any help or feedback would be very much appreciated.
Thank you.
Best,
Jasper
I have searched statalist, but have not been able to find my answer. I have found possible solution within the stata.
I have two variables, variable A (dichotomous: 0/1) and variable B(8 categories, random order, coded 1-8).
I want to look an interaction between variable A and B for survival (death).
Intuitively, I am inclined to create 8 dummy variables and test for interaction for each dummy separately. Based on what I observe in differences in HRs between the 8 groups, these interactions make sense. Is this a correct way on going about this?
Alternatively, I have found this:
Code:
stcox i.A i.B i.A##i.B
Thank you.
Best,
Jasper

Comment