Hello Statalisters,
I'm currently writing my master thesis in Finance and I want to do a persistence test. I have found a few ways to do this but for this I need dummy variables which I do not know how to create. So I have this data set containing excess return data of 254 funds over a time period of 12 years. I indicated winners and losers for each fund observation by generating dummy variables. Winner (W) which takes the value of 1 if the excess return is above the median and loser (L) which takes the value of 1 if the excess return is below the median. For the persistence test I want to generate a new dummy taking the value of 1 if a fund is a winner in month t & a winner in month t+1. This dummy will be indicated by WW. The same sort of dummy variables are needed for Winner-Loser (WL) and Loser-Loser (LL). I tried to use tsspell but I did not manage to get the results I need.
I hope you understand what I try to do.
hanks in advance for any answer/suggestion!
I'm currently writing my master thesis in Finance and I want to do a persistence test. I have found a few ways to do this but for this I need dummy variables which I do not know how to create. So I have this data set containing excess return data of 254 funds over a time period of 12 years. I indicated winners and losers for each fund observation by generating dummy variables. Winner (W) which takes the value of 1 if the excess return is above the median and loser (L) which takes the value of 1 if the excess return is below the median. For the persistence test I want to generate a new dummy taking the value of 1 if a fund is a winner in month t & a winner in month t+1. This dummy will be indicated by WW. The same sort of dummy variables are needed for Winner-Loser (WL) and Loser-Loser (LL). I tried to use tsspell but I did not manage to get the results I need.
I hope you understand what I try to do.
hanks in advance for any answer/suggestion!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long time int(_j date) float(excessReturn median_excessReturn W L) 1 1 16802 3.4313195 5.486612 0 1 1 2 16802 6.981278 5.486612 1 0 1 3 16802 . 5.486612 . . 1 4 16802 . 5.486612 . . 1 5 16802 . 5.486612 . . 1 6 16802 . 5.486612 . . 1 7 16802 8.563093 5.486612 1 0 1 8 16802 . 5.486612 . . 1 9 16802 . 5.486612 . . 1 10 16802 7.770547 5.486612 1 0 1 11 16802 . 5.486612 . . 1 12 16802 . 5.486612 . . 1 13 16802 . 5.486612 . . 1 14 16802 7.977136 5.486612 1 0 1 15 16802 . 5.486612 . . 1 16 16802 6.994602 5.486612 1 0 1 17 16802 4.5341887 5.486612 0 1 1 18 16802 . 5.486612 . . 1 19 16802 . 5.486612 . . 1 20 16802 3.94336 5.486612 0 1 1 21 16802 . 5.486612 . . 1 22 16802 . 5.486612 . . 1 23 16802 . 5.486612 . . 1 24 16802 . 5.486612 . . 1 25 16802 . 5.486612 . . 1 26 16802 3.907271 5.486612 0 1 1 27 16802 . 5.486612 . . 1 28 16802 . 5.486612 . . 1 29 16802 3.7624195 5.486612 0 1 1 30 16802 . 5.486612 . . 1 31 16802 . 5.486612 . . 1 32 16802 . 5.486612 . . 1 33 16802 . 5.486612 . . 1 34 16802 . 5.486612 . . 1 35 16802 . 5.486612 . . 1 36 16802 . 5.486612 . . 1 37 16802 . 5.486612 . . 1 38 16802 . 5.486612 . . 1 39 16802 . 5.486612 . . 1 40 16802 . 5.486612 . . 1 41 16802 . 5.486612 . . 1 42 16802 . 5.486612 . . 1 43 16802 . 5.486612 . . 1 44 16802 . 5.486612 . . 1 45 16802 . 5.486612 . . 1 46 16802 . 5.486612 . . 1 47 16802 . 5.486612 . . 1 48 16802 . 5.486612 . . 1 49 16802 . 5.486612 . . 1 50 16802 . 5.486612 . . 1 51 16802 . 5.486612 . . 1 52 16802 . 5.486612 . . 1 53 16802 . 5.486612 . . 1 54 16802 8.679188 5.486612 1 0 1 55 16802 . 5.486612 . . 1 56 16802 . 5.486612 . . 1 57 16802 8.707003 5.486612 1 0 1 58 16802 . 5.486612 . . 1 59 16802 8.579934 5.486612 1 0 1 60 16802 . 5.486612 . . 1 61 16802 . 5.486612 . . 1 62 16802 . 5.486612 . . 1 63 16802 . 5.486612 . . 1 64 16802 3.4701564 5.486612 0 1 1 65 16802 . 5.486612 . . 1 66 16802 . 5.486612 . . 1 67 16802 3.168994 5.486612 0 1 1 68 16802 . 5.486612 . . 1 69 16802 . 5.486612 . . 1 70 16802 . 5.486612 . . 1 71 16802 . 5.486612 . . 1 72 16802 . 5.486612 . . 1 73 16802 . 5.486612 . . 1 74 16802 . 5.486612 . . 1 75 16802 . 5.486612 . . 1 76 16802 . 5.486612 . . 1 77 16802 . 5.486612 . . 1 78 16802 . 5.486612 . . 1 79 16802 . 5.486612 . . 1 80 16802 . 5.486612 . . 1 81 16802 . 5.486612 . . 1 82 16802 . 5.486612 . . 1 83 16802 . 5.486612 . . 1 84 16802 . 5.486612 . . 1 85 16802 . 5.486612 . . 1 86 16802 . 5.486612 . . 1 87 16802 . 5.486612 . . 1 88 16802 2.7816935 5.486612 0 1 1 89 16802 2.7989986 5.486612 0 1 1 90 16802 . 5.486612 . . 1 91 16802 . 5.486612 . . 1 92 16802 . 5.486612 . . 1 93 16802 . 5.486612 . . 1 94 16802 2.790924 5.486612 0 1 1 95 16802 3.9475884 5.486612 0 1 1 96 16802 . 5.486612 . . 1 97 16802 . 5.486612 . . 1 98 16802 . 5.486612 . . 1 99 16802 . 5.486612 . . 1 100 16802 . 5.486612 . . end format %tdnn/dd/CCYY date
Comment