Hi there! I'd really appreciate some feedback on some code I wrote (below). Basically, I'd like to run Kruskal-Wallis tests on a long list of variables, and display only those with p-values less than 0.05.
After running the KW test on each variable individually, I can see that this code seems to have produced the correct result (i.e., no p-values less than 0.05). But it's hard to confirm without having a significant p-value to check against.
Thanks for any/all feedback!
Code:
sysuse auto, clear foreach var of varlist price mpg rep78 { display "`var'" quietly kwallis `var', by(weight) if chi2tail(r(df), r(chi2)) < 0.05 { local test `test' `var' } } display `"`test'"'
Thanks for any/all feedback!
Comment