Stratifying by gender

Stratifying by gender

by Arti -
Number of replies: 2

For my table - I did a Kruskall-Wallis analysis to determine the association between a continuous variable (not normally distributed) and a tertile variable. For my graph, I would like to show this association. However, I would also like to stratify by gender and would like a p-value for males and a p-value for females. How can I do this? I tried using the logistic command and it didn't work. I also tried dropping the females and doing the kwallis on just males, and then doing it on females only. But that didn't work either.

Also, how can you get a superscript in STATA?

Thank you.

In reply to Arti

Re: Stratifying by gender

by Elizabeth Uy-Smith -

Hello Arti,

Sounds like you’ve gotten a good start! In order to stratify by gender, you can use the “if” option to find the overall p-value for males and females. For example, the command would look like this:

kwallis yvar if male==1, by(xvar)

kwallis yvar if male==0, by(xvar)

Like the ANOVA for normally distributed outcomes, the Kruskall-Wallis analysis only tests if there is an overall significant difference between all the different categories. If you find that there is a statistically significant overall difference in medians of the 3 different categories (in your case), then you will need to do testing of the individual pairs to determine if there is a statistical significant difference between the pairs of categories using ranksum:

ranksum yvar if xvar==1|xvar==2, by(xvar)

ranksum yvar if xvar==1|xvar==3, by(xvar)

ranksum yvar if xvar==3|xvar==2, by(xvar)

Per the Stata manual (http://www.stata.com/bookstore/pdf/g_text.pdf), you can denote the text you want to be in superscript (e.g. x2) using the following syntax –

x{superscript:2}

Hope that helps, and please let us know if you have more questions.

Thanks!

ellie

In reply to Elizabeth Uy-Smith

Re: Stratifying by gender

by Arti -

Hi Ellie,

Thank you for clarifying how to stratify by gender. It worked.

However, I am confused about the ranksum test that you mentioned. My table is pretty large and has quite a bit of data. I did the kruskall-wallis test for many of the comparisons and for several got a statistically significant p-values which is what I have reported in the table since I just wanted to know if there is a significant difference between the three groups. I understand you're saying that I need to go back to the ones that were statistically significant and test the different pairs? I ran the ranksum command on one just to see what the output looked like and I'm not sure I know how to interpret it. Also, what would I end up reporting in my table? (My understanding is that I should just report the p-value I get from the kruskall-wallis test.) 

Thank you for your help!

-Arti