Announcement

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

  • Testing equality of two coefficients

    I run the following regression

    Code:
    reg y x1 x2
    If I want to test whether the coefficients are equal I use

    Code:
    test x1=x2
    Can someone please help me with how I test if the interacted coefficients are equal if I interact x1 and x2 with variable drought? drought=1 if the household suffered from drought and 0 otherwise.

    Code:
    reg y c.x1##i.drought c.x2##i.dought

  • #2
    Consider:

    Code:
    sysuse auto, clear
    reg price c.mpg##i.rep78 c.weight##i.rep78
    forval i=2/5{
        test `i'.rep78#c.mpg=`i'.rep78#c.weight
    }
    Res.:

    Code:
    . forval i=2/5{
      2.
    .     test `i'.rep78#c.mpg=`i'.rep78#c.weight
      3.
    . }
    
     ( 1)  2.rep78#c.mpg - 2.rep78#c.weight = 0
    
           F(  1,    55) =    2.02
                Prob > F =    0.1604
    
     ( 1)  3.rep78#c.mpg - 3.rep78#c.weight = 0
    
           F(  1,    55) =    1.23
                Prob > F =    0.2727
    
     ( 1)  4.rep78#c.mpg - 4.rep78#c.weight = 0
    
           F(  1,    55) =    0.76
                Prob > F =    0.3863
    
     ( 1)  5.rep78#c.mpg - 5o.rep78#co.weight = 0
    
           F(  1,    55) =    1.32
                Prob > F =    0.2554
    
    .
    I am sure that test has some syntax to directly do this, but it is not immediately apparent to me. Note that for a binary variable, there is only 1 test, so

    Code:
    test 1.drought#c.x1 = 1.drought#c.x2
    Last edited by Andrew Musau; 10 Feb 2023, 10:46.

    Comment

    Working...
    X