Announcement

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

  • Does wyoung allow for interactions?

    Hello,
    My goal is to include regressions from the main analysis (X is my key regressors) as well as the heterogeneity analysis (using c.X#i.male) in the same wyoung command to account for multiple testing.
    However, I did not succeed.


    I tried with this data

    Code:
    sysuse auto.dta, clear
    set seed 20
    wyoung, cmd("reg price mpg" "reg price c.mpg#c.rep78") familyp(mpg c.mpg#c.rep78) bootstraps(100) seed(20)
    local cmd1  reg price mpg
    local cmd2  reg price c.mpg#c.rep78
    wyoung, replace cmd("`cmd1'" "`cmd2'"  ) familyp(mpg c.mpg#c.rep78) bootstraps(50) seed(20)

    It worked but still the results are weird. First, if I change the way I am writing the command, the results change while it should not. Second, the adjuted p-values are not adjsuted for the interaction term: c.mpg#c.rep78

    Code:
     wyoung, cmd("reg price mpg" "reg price c.mpg#c.rep78") familyp(mpg c.mpg#c.rep78) bootstraps(100) seed(20)
    Estimating family-wise adjusted p-values for 2 hypothesis tests
    
    familyp: mpg
        reg price mpg
    
    familyp: c.mpg#c.rep78
        reg price c.mpg#c.rep78
    
         +------------------------------------------------------------------------------------------------------------------------------+
         | k                     model   outcome         familyp         coef      stderr           p   pwyoung       pbonf      psidak |
         |------------------------------------------------------------------------------------------------------------------------------|
      1. | 1             reg price mpg     price             mpg   -238.89435   53.076687   .00002546         0   .00005092   .00005092 |
      2. | 2   reg price c.mpg#c.rep78     price   c.mpg#c.rep78   -18.756467    8.987922   .04070956       .02   .04070956   .04070956 |
         +------------------------------------------------------------------------------------------------------------------------------+
    
    . local cmd1  reg price mpg
    
    . local cmd2  reg price c.mpg#c.rep78
    
    . wyoung, replace cmd("`cmd1'" "`cmd2'"  ) familyp(mpg c.mpg#c.rep78) bootstraps(50) seed(20)
    Estimating family-wise adjusted p-values for 2 hypothesis tests
    
    familyp: mpg
        reg price mpg
    
    familyp: c.mpg#c.rep78
        reg price c.mpg#c.rep78
    
         +------------------------------------------------------------------------------------------------------------------------------+
         | k                     model   outcome         familyp         coef      stderr           p   pwyoung       pbonf      psidak |
         |------------------------------------------------------------------------------------------------------------------------------|
      1. | 1             reg price mpg     price             mpg   -238.89435   53.076687   .00002546         0   .00005092   .00005092 |
      2. | 2   reg price c.mpg#c.rep78     price   c.mpg#c.rep78   -18.756467    8.987922   .04070956       .04   .04070956   .04070956 |
         +------------------------------------------------------------------------------------------------------------------------------+


  • #2
    Added: I also noticed that the interaction works when using a continuous variable (c.) but does not work with a binary variable (i.).

    Comment


    • #3
      It's the seed. You include it in the wyoung command, so drop the stand alone.

      Code:
      sysuse auto.dta, clear
      wyoung, cmd("reg price mpg" "reg price c.mpg#c.rep78") familyp(mpg c.mpg#c.rep78) bootstraps(100) seed(20)
      
      local cmd1  reg price mpg
      local cmd2  reg price c.mpg#c.rep78
      
      wyoung, replace cmd("`cmd1'" "`cmd2'"  ) familyp(mpg c.mpg#c.rep78) bootstraps(50) seed(20)

      Comment

      Working...
      X