Announcement

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

  • How to test if B1 = -B2 in stata

    Code:
    input int year float month double cpi float core_cpi double(gas electricity spending) float(delta_gas delta_electricity gas_inc electricity_inc)
    2021  1  1.6   2 -1.002676668 -4.136873465 -18.44497483          .          . 0 0
    2021  2  1.8   2  -.342335908 -2.308178469  2.579472681   .6603408   1.828695 1 1
    2021  3  1.9 1.8   .487164818 -1.048936554   18.8804385   .8295007   1.259242 1 1
    2021  4  1.9 1.6  1.202847376   .361084075 -3.695158466   .7156826  1.4100206 1 1
    2021  5  2.1 1.9  1.419278891  1.265963421 -1.746567419   .2164315   .9048793 1 1
    2021  6    2 1.9  2.156526828  2.659839861  6.907355447   .7372479  1.3938764 1 1
    2021  7  1.4  .6  4.926469299  6.385467085  -.019307741  2.7699425   3.725627 1 1
    2021  8  2.4 1.6  5.458180789  6.540522532  8.303642752   .5317115  .15505545 1 1
    2021  9  2.7 1.7  7.289756073  9.468622633  6.565700592  1.8315753     2.9281 1 1
    2021 10  3.4 1.8  11.60311872   14.4893719  1.052841712  4.3133626   5.020749 1 1
    2021 11  5.2 2.5  18.47413552   24.2904105 -9.737698019   6.871017   9.801039 1 1
    2021 12  5.7 2.4  22.13661652   30.9298982  25.55490461   3.662481   6.639488 1 1
    2022 13  6.4 2.4  27.01760014  32.37408626  22.72015077   4.880984   1.444188 1 1
    2022 14  6.2 2.5  24.60170336  28.86516761  14.33188917  -2.415897  -3.508919 0 0
    2022 15  9.7 2.6  41.73389918  45.01007141  -12.3817435  17.132196  16.144903 1 1
    2022 16  9.6 3.5  38.16267835  40.79783334 -5.324507057  -3.571221  -4.212238 0 0
    2022 17  8.8 3.6  32.11207836  33.85162604 -1.447282979    -6.0506  -6.946208 0 0
    2022 18  8.6 3.7  26.17050598  30.04309687 -10.30580345  -5.941572  -3.808529 0 0
    2022 19 10.3 4.8  33.07493007  33.56903936 -2.786964381   6.904424  3.5259426 1 1
    2022 20   12   5  43.15504638  39.72854577   .935258614  10.080116   6.159506 1 1
    2022 21 14.5 5.7  51.72460738  45.94720046   .484728101   8.569561   6.218655 1 1
    2022 22 14.3   6  47.52761203  41.75302574  10.56751428 -4.1969953  -4.194175 0 0
    2022 23  9.9 5.6  24.16520379  23.05560796  26.05127581  -23.36241 -18.697418 0 0
    2022 24  9.6 6.2  20.39073705  15.98070195 -23.41142145  -3.774467  -7.074906 0 0
    
    
    regress cpi core_cpi i.gas_inc#c.delta_gas spending
    Im running a regression of gas prices on inflation. But measure an increase in gas prices differently form a decrease in prices.
    This gives me two coefficients for gas (a positive & negative one)

    I want to test for asymmetric pricing. Meaning: if the positive coefficient is statistically different from the negative coefficient.
    Under normal circumstances i could test if B1 - B2 = 0

    But how do I test if B1 = -B2?

    Does anyone know if there is a command in stata for this?

    Kind regards,

    Leon

  • #2
    Code:
    test B1 + B2 = 0

    Comment


    • #3
      That regression command doesn’t do what you want. You need to include c.delta_gas interacted with i.gas_dec. Then

      Code:
      test 1.gas_inc#c.delta_gas = -1.gas_dec#c.delta_gas

      Comment

      Working...
      X