Announcement

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

  • Stata command/input for testing asymmetry in a regression model

    I want to test for asymmetric pricing in my regression, but don't know the stata command.
    I want to regress ''Inflation'' on ''gas prices'' but measure an increase in gas prices seperately from a decrease in gas prices. (That means I want 2 coefficients for the same independent variable).
    My regression would look like this;
    Inflation = B1*(Gas price increase) + B2*(Gas price decrease)

    My data on gas prices;

    (1) 139.54
    (2) 145.74
    (3) 161.18
    (4) 189.65
    (5) 206.87
    (6) 237.68
    (7) 227.11
    (8) 339.82
    (9) 314.68
    (10) 273.63
    (11) 241.73

    For example from (1) to (2) is an increase in the gas price, and from (8) to (9) is a decrease.

    How do I run a regression in stata where every increase in gas prices is measured seperately from every decrease in gas prices?

  • #2
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(time price)
     1 139.54
     2 145.74
     3 161.18
     4 189.65
     5 206.87
     6 237.68
     7 227.11
     8 339.82
     9 314.68
    10 273.63
    11 241.73
    end
    
    tsset time
    gen delta_price = D1.price
    label define incr_decr    0    "Decrease"    1    "Increase"
    gen incr_decr:incr_decr = max(sign(delta_price), 0)
    replace delta_price = abs(delta_price)
    Then you can -regress inflation i.incr_decr#c.delta_price-. Your output will show you two coefficients, one for decreases and one for increases in price.

    The expression i.incr_decr#c.delta_price is how factor-variable notation is used in Stata to represent interactions. If you are not already familiar with it, do read -help fvvarlist- for details.

    In the future, when showing data examples, please use the -dataex- command to do so, as I have done above. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment

    Working...
    X