Hello,
Could you please explain difference between lagged functions and arithmetic calculating daily returns?
Date Firm ID Close Price
9/1/2012 1 404
9/2/2012 1 403
9/3/2012 1 407
9/4/2012 1 410
9/5/2012 1 414
9/6/2012 1 418
9/1/2012 2 40
9/2/2012 2 40
9/3/2012 2 40
9/4/2012 2 41
9/5/2012 2 41
9/6/2012 2 41
9/1/2012 3 20
9/2/2012 3 10
9/3/2012 3 20
9/4/2012 3 41
9/5/2012 3 31
9/6/2012 3 21
I did use codes;
xtset FirmID Date
and then do both 1 and 2 below
1. bysort FirmID: generate DailyReturn = (Close[_n] - Close[_n-1]) / Close[_n-1]
2. bysort FirmID: generate LaggedReturn = (Close - L.Close) / L.Close
I thought 1 and 2 have same results, but when I use Lagged functions, there are too many omitted variable (missing a lot of observations)
Could you explain difference between those two?
PS) Sample given above is what I just did make up.
Thank you so much!
Sincerely,
Patrick
Could you please explain difference between lagged functions and arithmetic calculating daily returns?
Date Firm ID Close Price
9/1/2012 1 404
9/2/2012 1 403
9/3/2012 1 407
9/4/2012 1 410
9/5/2012 1 414
9/6/2012 1 418
9/1/2012 2 40
9/2/2012 2 40
9/3/2012 2 40
9/4/2012 2 41
9/5/2012 2 41
9/6/2012 2 41
9/1/2012 3 20
9/2/2012 3 10
9/3/2012 3 20
9/4/2012 3 41
9/5/2012 3 31
9/6/2012 3 21
I did use codes;
xtset FirmID Date
and then do both 1 and 2 below
1. bysort FirmID: generate DailyReturn = (Close[_n] - Close[_n-1]) / Close[_n-1]
2. bysort FirmID: generate LaggedReturn = (Close - L.Close) / L.Close
I thought 1 and 2 have same results, but when I use Lagged functions, there are too many omitted variable (missing a lot of observations)
Could you explain difference between those two?
PS) Sample given above is what I just did make up.
Thank you so much!
Sincerely,
Patrick
Comment