Announcement

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

  • Variance equality test for multiple variables

    Hi,

    I want to compare variance of multiple variables of two groups (event=1 or event=0). For one variable, I know sdtest can do it: sdtest age, by(event)

    However, it cannot perform on more than on variable. I know for t test, there is command like ttable. Is there any similar command for sdtest?

    Thanks.

  • #2
    -ttable- appears to be a user-written command, and I supposed you could use -search- in Stata to try to find if someone had created a similar convenience command for -sdtest-. However, creating your own loop would be a relatively easy solution here. Here's an example with the auto data:

    Code:
    sysuse auto, clear
    foreach v of varlist price weight headroom {
       sdtest `v', by(foreign)
    }

    Comment


    • #3
      Originally posted by Mike Lacy View Post
      -ttable- appears to be a user-written command, and I supposed you could use -search- in Stata to try to find if someone had created a similar convenience command for -sdtest-. However, creating your own loop would be a relatively easy solution here. Here's an example with the auto data:

      Code:
      sysuse auto, clear
      foreach v of varlist price weight headroom {
      sdtest `v', by(foreign)
      }
      Hi Mike,

      Thank you so much. Another follow up question:

      The loop seems good. But another desired feature of ttable is its output format. Is there way to make the output into a nice table (as ttest in ttable)?

      Thanks.

      Comment


      • #4
        You can access whatever things -sdtest- puts into the return list, and do some programming to display them out in the format you desire. The following shows (in very crude form) what you could do.

        Code:
        sysuse auto, clear
        sdtest price, by(foreign)
        return list // to show you what's there
        // Example of using items in the return list
        foreach v of varlist price weight headroom {
           quiet sdtest `v', by(foreign)
           di "Variable = `v': sd1 = " r(sd_1) ", sd2 = " r(sd_2) ", p = " r(p)
        }

        Comment

        Working...
        X