Im sorry to post something similar as my post yesterday, however it is really important that i can figure this out. I want to calculate weighted returns on the basis of the market value of a firm at week=0 (mv2). I duplicated this value for every firm(companyid) over their whole timeperiod up to week 156.
As a next step i calculated the returns with the _gwtmean package. After this i used the following code in order to determine the valueweighted returns.
Code: bys companyid(week): egen wmean_ret = wtmean(returnPE), weight(mv2)
However, this gave the same mean return as without using the weighted mean code.
bys Companyid(week): egen mean_ret = mean(returnco) . So in the end there doesnt seem to be any weighting applied to the returns. Any ideas on how i could get different returns based on firm prominence by market value at time=0?
I'd really appreciate your help!
My data looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Date double PriceCO byte Companyid int week float(returnco mv2 wmreturnPE mean_ret) 18611 9.9 1 0 . 290.7 .0041245334 .0041245334 18618 9.89 1 1 -.001010101 290.7 .0041245334 .0041245334 18625 10 1 2 .011122346 290.7 .0041245334 .0041245334 18632 10.34 1 3 .034 290.7 .0041245334 .0041245334 18639 10.21 1 4 -.012572533 290.7 .0041245334 .0041245334 18646 10.57 1 5 .03525955 290.7 .0041245334 .0041245334 18653 11.27 1 6 .06622516 290.7 .0041245334 .0041245334 18660 12.35 1 7 .09582964 290.7 .0041245334 .0041245334 18667 12 1 8 -.02834008 290.7 .0041245334 .0041245334 18674 12.51 1 9 .0425 290.7 .0041245334 .0041245334 18681 12.24 1 10 -.021582734 290.7 .0041245334 .0041245334 18688 12.59 1 11 .02859477 290.7 .0041245334 .0041245334 18695 12.49 1 12 -.007942812 290.7 .0041245334 .0041245334 18702 11.86 1 13 -.05044035 290.7 .0041245334 .0041245334 18709 12.55 1 14 .05817875 290.7 .0041245334 .0041245334 18716 12.05 1 15 -.03984064 290.7 .0041245334 .0041245334 18723 11.71 1 16 -.02821577 290.7 .0041245334 .0041245334 18730 11.61 1 17 -.008539709 290.7 .0041245334 .0041245334 18737 11.33 1 18 -.02411714 290.7 .0041245334 .0041245334 18744 11.88 1 19 .04854369 290.7 .0041245334 .0041245334 18751 11.41 1 20 -.03956229 290.7 .0041245334 .0041245334 18758 11.82 1 21 .03593339 290.7 .0041245334 .0041245334 18765 12.92 1 22 .0930626 290.7 .0041245334 .0041245334 18772 13.01 1 23 .006965944 290.7 .0041245334 .0041245334 18779 13.07 1 24 .004611837 290.7 .0041245334 .0041245334 18786 13.03 1 25 -.003060444 290.7 .0041245334 .0041245334 18793 12.1 1 26 -.07137375 290.7 .0041245334 .0041245334 18800 13.14 1 27 .08595041 290.7 .0041245334 .0041245334 18807 13.35 1 28 .015981736 290.7 .0041245334 .0041245334 18814 13.07 1 29 -.020973783 290.7 .0041245334 .0041245334 end format %tdnn/dd/CCYY Date
0 Response to Value weighted returns are the same as equal weighted returns
Post a Comment