Announcement

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

  • Creating a positive and negative assymetric variables in panel data

    Dear Scholars, I am trying to estimate a non linear Panel VAR using oil price as the independent variable. I intend to create a positive and negative series of oil price representing an increase and a decrease in oil Price.. is there any direct command or package in stata that does this?

  • #2
    Does this help?

    Code:
    . webuse grunfeld, clear
    
    . xtset company year
    
    Panel variable: company (strongly balanced)
     Time variable: year, 1935 to 1954
             Delta: 1 year
    
    . gen change = D.invest
    (10 missing values generated)
    
    . l year invest change in 1/20
    
         +---------------------------+
         | year   invest      change |
         |---------------------------|
      1. | 1935    317.6           . |
      2. | 1936    391.8    74.19998 |
      3. | 1937    410.6    18.80002 |
      4. | 1938    257.7      -152.9 |
      5. | 1939    330.8    73.09998 |
         |---------------------------|
      6. | 1940    461.2       130.4 |
      7. | 1941      512    50.79999 |
      8. | 1942      448         -64 |
      9. | 1943    499.6    51.60001 |
     10. | 1944    547.5    47.89999 |
         |---------------------------|
     11. | 1945    561.2    13.70001 |
     12. | 1946    688.1       126.9 |
     13. | 1947    568.9      -119.2 |
     14. | 1948    529.2   -39.70001 |
     15. | 1949    555.1    25.89996 |
         |---------------------------|
     16. | 1950    642.9    87.80005 |
     17. | 1951    755.9         113 |
     18. | 1952    891.2       135.3 |
     19. | 1953   1304.4       413.2 |
     20. | 1954   1486.7    182.2999 |
         +---------------------------+

    Comment


    • #3
      Thanks a lot Prof Nick.. What I intend doing is to create 2variables
      For instance, modeling oil price shock on inflation.

      Inflation = oilprice_pos + oilprice_neg
      Where oilprice_pos is the increase in oil price and oil price neg is the fall in oil price.. The two variables will be generated from a single oil price index..

      Comment


      • #4
        Perhaps you need something like

        Code:
        gen poschange = max(0, change) 
        
        gen negchange = min(0, change)

        Comment

        Working...
        X