Announcement

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

  • Forward Lead Operators

    I want to use 5 forward period of FTSE100 to regress on my index UKIS. However when I use
    Code:
    . gen FTSE100_1F = 1F.FTSE100
    (2,128 missing values generated)
    
    . gen FTSE100_2F = 2F.FTSE100
    (2,128 missing values generated)
    I only get 0 values. I think this may have to do with the fact that my FTSE100 data is only available mon-fri and has missing values on the weekend.

    Code:
    input int date double FTSE100 float(FTSE100_1F FTSE100_2F)
    16071       . 0 0
    16072 4510.18 . .
    16073       . . .
    16074       . 0 0
    16075 4513.25 0 0
    16076 4505.22 0 0
    16077 4472.97 0 0
    16078 4494.17 0 0
    16079 4466.29 . .
    16080       . . .
    16081       . 0 0
    16082 4449.61 0 0
    16083 4440.14 0 0
    16084 4461.39 0 0
    16085 4456.08 0 0
    16086 4487.88 . .
    16087       . . .
    16088       . 0 0
    16089 4518.14 0 0
    16090 4499.27 0 0
    16091 4511.18 0 0
    16092 4476.79 0 0
    16093 4460.81 . .
    16094       . . .
    16095       . 0 0
    16096 4445.48 0 0

  • #2
    The forward operators are F1 and F2, not 1F and 2F.

    That said, you should not be getting zero values with what you have done. Stata should be giving you a syntax error and halting.

    Added: I've figured out what Stata is doing and why 1F and 2F are giving you zeroes. Stata is interpreting 1F and 2F as 1.F and 2.F. Remember that 1.varname is a notation for a (virtual) variable that indicates whether varname == 1. So 1F.FTSE100 would be 1 if the first forward value of FTSE100 = 1, and 0 otherwise. Since none of your values of FTSE100 = 1, you get all zeroes, except where the forward value is missing. You can verify this yourself by changing a few values of FTSE100 to 1 (or 2 to see how 2F is being handled) and you will see that Stata then gives you 1 in those instances.

    Now, Stata does say that its operators form an algebra. So it is perfectly reasonable for Stata to acknowledge composition of the 1. and F. operators, but I don't think that 1F is a proper notation for that. It should be 1.F, in my opinion.
    Last edited by Clyde Schechter; 06 Jan 2023, 09:30.

    Comment

    Working...
    X