Hello everyone,
I have been thinking about the issue below for a few hours now, I tried several things, but I started to give up.
My problem is conceptually simple: I have a variable, word_count, that measures the number of characters of newspaper headlines per day. There are several newspapers issued per day and therefore several headlines. That is, each word count takes a separate row, which creates repeated time values within panel. Then, there is some corporate event taking place on random days, and is captured using the dummy variable corporate_event. I would like to calculate the variance of the word count (word_count) over a window of 5 days (-2,-2,0,+1+2) around the corporate event (i.e., when corporate_event=1).
Below is a sample of how the data looks like:
In the above example, I have computed the variance using Excel just to show what I am trying to do in Stata.
Thank you very much for your time and possible suggestions.
Mostafa
I have been thinking about the issue below for a few hours now, I tried several things, but I started to give up.
My problem is conceptually simple: I have a variable, word_count, that measures the number of characters of newspaper headlines per day. There are several newspapers issued per day and therefore several headlines. That is, each word count takes a separate row, which creates repeated time values within panel. Then, there is some corporate event taking place on random days, and is captured using the dummy variable corporate_event. I would like to calculate the variance of the word count (word_count) over a window of 5 days (-2,-2,0,+1+2) around the corporate event (i.e., when corporate_event=1).
Below is a sample of how the data looks like:
company_id | date | corporate_event | word_count | variance |
1690 | 15-Jul-14 | 0 | 31 | . |
1690 | 15-Jul-14 | 0 | 27 | . |
1690 | 20-Jul-14 | 0 | 36 | 402.0751 |
1690 | 20-Jul-14 | 0 | 20 | 402.0751 |
1690 | 20-Jul-14 | 0 | 40 | 402.0751 |
1690 | 21-Jul-14 | 0 | 43 | 402.0751 |
1690 | 21-Jul-14 | 0 | 14 | 402.0751 |
1690 | 21-Jul-14 | 0 | 25 | 402.0751 |
1690 | 21-Jul-14 | 0 | 64 | 402.0751 |
1690 | 21-Jul-14 | 0 | 0 | 402.0751 |
1690 | 22-Jul-14 | 1 | 0 | 402.0751 |
1690 | 22-Jul-14 | 0 | 16 | 402.0751 |
1690 | 22-Jul-14 | 0 | 16 | 402.0751 |
1690 | 22-Jul-14 | 0 | 22 | 402.0751 |
1690 | 22-Jul-14 | 0 | 33 | 402.0751 |
1690 | 22-Jul-14 | 0 | 36 | 402.0751 |
1690 | 22-Jul-14 | 0 | 20 | 402.0751 |
1690 | 23-Jul-14 | 0 | 40 | 402.0751 |
1690 | 23-Jul-14 | 0 | 43 | 402.0751 |
1690 | 23-Jul-14 | 0 | 17 | 402.0751 |
1690 | 23-Jul-14 | 0 | 43 | 402.0751 |
1690 | 23-Jul-14 | 0 | 60 | 402.0751 |
1690 | 23-Jul-14 | 0 | 20 | 402.0751 |
1690 | 24-Jul-14 | 0 | 26 | 402.0751 |
1690 | 24-Jul-14 | 0 | 92 | 402.0751 |
1690 | 24-Jul-14 | 0 | 44 | 402.0751 |
1690 | 24-Jul-14 | 0 | 27 | 402.0751 |
1690 | 24-Jul-14 | 0 | 48 | 402.0751 |
1690 | 25-Jul-14 | 0 | 35 | . |
1690 | 25-Jul-14 | 0 | 32 | . |
1690 | 25-Jul-14 | 0 | 45 | . |
In the above example, I have computed the variance using Excel just to show what I am trying to do in Stata.
Thank you very much for your time and possible suggestions.
Mostafa
Comment