Dear all,
I am currently working on my last steps in my master thesis. I calculated buy and hold- and cumulative abnormal returns from a dataset with weekly periods (both stockprice and returns).
I did this on the basis of equal weighting, now as a last step i want to calculate value weighted returns and the corresponding cumulative abnormal returns. I know how to do this, but the thing is that i one to implement a weighting scheme similar to the one on this topic: https://www.statalist.org/forums/for...rns-panel-data. I tried to work with the wrapper program (_gwtmean) but it did not give me any results.
My data looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int companyid double mv int date double PricePE int week double(SP600 SP500VALUE SP500EQUALWEIGHTED) float returnPE
1 186 19899              25.75  0            677.15            895.69            3106.84            .
1   . 19913              25.75  2            676.23            898.91            3122.59    .02142007
1   . 19920 26.560000000000002  3            663.36             904.5            3122.26    .03145631
1   . 19927              24.04  4               666            904.51            3123.71   -.09487952
1   . 19934              24.25  5            659.83            896.73            3099.79   .008735441
1   . 19941              25.29  6            649.48            873.84            3028.11     .0428866
1   . 19948              25.92  7 657.1800000000001            884.59             3069.9    .02491103
1   . 19955              27.87  8             665.6 898.9200000000001 3137.7200000000003    .07523149
1   . 19962              28.19  9            671.84            906.45            3154.41    .01148188
1   . 19969              27.98 10            672.48            908.34            3162.56   -.00744945
1   . 19976 26.080000000000002 11            667.03            902.52            3145.23   -.06790565
1   . 19983 27.080000000000002 12            661.91            907.95 3144.9900000000002    .03834356
1   . 19990              25.66 13 648.9300000000001            903.87 3121.7000000000003   -.05243722
1   . 19997              25.01 14            626.61            880.46            3037.87  -.025331255
1   . 20004 26.150000000000002 15            632.33            889.84            3066.86    .04558177
1   . 20011               25.2 16            620.98            843.94            2912.69   -.03632887
1   . 20018              26.72 17            634.63            870.51             3022.8    .06031746
1   . 20025 32.230000000000004 18            663.58            891.62            3109.05     .2062126
1   . 20032              34.45 19            677.22            910.44            3178.16   .068879925
1   . 20039              33.46 20 686.0600000000001 915.4200000000001            3203.15    -.0287373
1   . 20046              30.72 21            669.21            921.37 3215.9300000000003   -.08188882
1   . 20053              31.16 22            686.48            929.37            3256.16   .014322917
1   . 20060              32.01 23            681.41            931.83             3258.6   .027278563
1   . 20067              33.71 24            670.48            908.39            3180.77     .0531084
1   . 20074              37.44 25 675.5600000000001 904.1700000000001            3176.04    .11064966
1   . 20081              36.79 26            695.08            938.13            3284.27  -.017361112
1   . 20088               37.4 27            695.08            927.97            3251.04   .016580593
1   . 20095              36.69 28            675.27            908.41 3188.2000000000003  -.018983956
1   . 20102              36.71 29             677.5            896.94            3161.06 .00054510764
1   . 20109               31.2 30             671.7            906.77            3198.55   -.15009534
end
format %tdnn/dd/CCYY date
I have a companyid that identifies both the market value (mv) of the firm and the price and returns of the corresponding company. However, this marketvalue is only for week=0 ; before offering at the exchange, while the stock prices are weekly up to three years. So again, i want value weighted returns on the basis of market values of week 0 for each company in my sample. This means that companies with a large market value should be given more prominence relative to the smaller ones. What could be the best way to start?
Thanks a lot in advance!