Hi, I have a time series of stock returns with multiple event date indicators, such as the following:
date return event
01jan2015 -0.2 0
02jan2015 1.2 1
03jan2015 0.3 0
04jan2015 0.4 0
05jan2015 -0.3 1
06jan2015 -0.1 0
I would like to create a new variable (timeToEvent) that takes the value of number of days from the event within a 3-day window around each event, where day 0 is each event day. The events are all spread apart by at least 3 days. For instance, it would look like this:
date return event timeToEvent
01jan2015 -0.2 0 -1
02jan2015 1.2 1 0
03jan2015 0.3 0 1
04jan2015 0.4 0 -1
05jan2015 -0.3 1 0
06jan2015 -0.1 0 1
How may I do this?
Related Posts with Creating event time variable
Random slopes for participants in a crossed random effects model with categorical outcomesI've got a mixed effects model with both crossed and nested random effects. The data concern a serie…
Aggregating observations for different variables based on an IDHi there, I have a dataset on ownership concetration for various firms with roughly 490000 observat…
Keep font size fixed when switching displays?Stata (15.1 MP, Win 10 64) on my laptop has started changing font size wildly when switching between…
Cox proportional hazards assumption and boostrappI tested the cox proportional hazards model with bootstrap. After this I tested the proportional ass…
Getting results for a categorical variable with eststo and mi dataDear all, I am working with mi data and plan to use "coefplot". Therefor I want to save results in …
Subscribe to:
Post Comments (Atom)
0 Response to Creating event time variable
Post a Comment