I am supposed to show the hazard ratio (HR) stratified by gender (1= female vs. 2= male) and age groups (quartiles, 1-4)*. The combination "female" and "first quartile of age" is supposed to be the reference, i.e. having a HR of 1.
The plot should look like that:
Since every group combination (2nd quartile and female, 1st quartile and male,...) is supposed to show the HR in comparison to the refernce (female and 1st quartile of age group), I am wondering whether I can firstly code both variables as one joint variable and afterwards make dummy variables (D1- D7) out of it like that:
Age groups Gender Joint variable D1 D2 D3 D4 D5 D6 D7
(quartiles) (1=f,2=m)
1 1 1 0 0 0 0 0 0 0
1 2 2 1 0 0 0 0 0 0
2 1 3 0 1 0 0 0 0 0
2 2 4 0 0 1 0 0 0 0
3 1 5 0 0 0 1 0 0 0
3 2 6 0 0 0 0 1 0 0
4 1 7 0 0 0 0 0 1 0
4 2 8 0 0 0 0 0 0 1
My idea is to use those dummy variables as predictors in a Cox model. The interpretation of HR= 2 for D7, for example, would be something like "Being old (4th quartile) and male is associated with a twofold risk of mortality versus being young (first quartile) and female". Is this a valid approach? I haven't read about cases where a joint dummy coding was used for two different variables and can't find any resource online.
* Notice to the usage of age groups: I know that there are problems associated with splitting up a continuous variable in groups, but this is what I am supposed to do.