Announcement

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

  • Multiple one way ANOVAs in Stata

    Hello Stata users,

    I have more than 30 independent variables with 3 category format answer (0;1;2). I would like to check if there are significant differences for those 30 v's with three levels when I have a number of continuous variables. I know, I can run all of them separate with a command like this:

    oneway CONTINUOUS1 CATEGORICAL1, bonferroni tabulate

    I wonder if there is a way/command in stata so I could run all 30 (CATEGORICAL1 to CATEGORICAL30) as predicting CONTINUOUS1 so Bonferroni correction would apply to 30 ANOVA rather than just one (see command above).

    Please help me on this if you can

    Thank you and kind regards

    Witold

  • #2
    Hello Witold. I suspect that one reason people have been a bit slow or reluctant to jump in here is that what you are proposing to do is a recipe for tremendous inflation of the the family-wise Type I error rate. And therefore, showing you how to loop through the 30 categorical explanatory variables feels a bit like handing a loaded (statistical) gun to someone without proper firearms training. For an example of what can happen when you carry out lots of tests with no adjustment for multiple tests, see this nice poster by Craig Bennett: As noted by Bennett & colleagues, when the number of tests is quite large, the false discovery rate (FDF) approach may be preferred over the Bonferroni correction, as the latter will have very low power.

    Having issued all of those cautions and disclaimers, you could do something like this to loop through your 30 explanatory variables.

    Code:
    forvalues i = 1(1)30 {
    oneway CONTINUOUS1 CATEGORICAL`i', bonferroni tabulate
    }
    Another approach would be to reshape the file from wide to long with all the group codes in one variable, all the outcomes in another variable, and and an index variable (with values 1 to 30) indicating which outcome variable is recorded on each row. With the data reshaped to long, I expect you could get what you want via statsby (although it may not retain all of the output).

    In closing, how to deal properly with multiple outcomes and multiple comparisons remains a difficult and controversial topic. The following two Lancet articles by Schulz & Grimes are among the more sensible and balanced pieces I've read on the topic. Perhaps you'll find them helpful. HTH.
    --
    Bruce Weaver
    Email: [email protected]
    Version: Stata/MP 18.5 (Windows)

    Comment


    • #3
      Hello Bruce,
      Thank you for detailed explanation. I appreciate it.

      kind regards

      Witold

      Comment

      Working...
      X