I have monthly observations from various funds over along amount of time but the time series are unbalanced. For each fund I have an average alpha pro fund and a turnover ratio per year and now I want to divide the turnover ratio into quintiles and then sort the mean alphas into the correct turnover quintiles to see in the end which quintile has the best alphas.(i. e. Do more active fonds perform better?)
In the end I need two panels: Panel A that divides every observation in the quintiles, so that one fund can jump into quintiles and Panel B where I measure a mean Turnover for each funds and a mean Alpha for each fund an divide each fund in one fixed quintile based on their mean Turnover Ratio and Alpha.
My data in dataex:
clear
input double(portfolioid Turnover) float mean_Turnover double AlphaCAPM float mean_AlphaCAPM
4 1.6770000457763672 1.417865 .0011276676681867825 -.0006093712
4 1.6770000457763672 1.417865 -.00066037569874813 -.0006093712
4 1.6770000457763672 1.417865 -.003203570453383219 -.0006093712
4 1.6770000457763672 1.417865 -.005067735517733929 -.0006093712
4 1.6770000457763672 1.417865 -.004276204678426189 -.0006093712
4 1.6770000457763672 1.417865 -.00264340576862393 -.0006093712
4 1.6770000457763672 1.417865 -.004977918697552257 -.0006093712
4 1.6770000457763672 1.417865 -.0013603183772131176 -.0006093712
4 1.6770000457763672 1.417865 -.0020266099299921167 -.0006093712
4 1.6770000457763672 1.417865 -.0011593780606042707 -.0006093712
4 1.6770000457763672 1.417865 -.0017615356820123058 -.0006093712
4 1.6770000457763672 1.417865 -.0024929980839788132 -.0006093712
4 1.6770000457763672 1.417865 .0028820224147934476 -.0006093712
4 1.6770000457763672 1.417865 .004593126737425821 -.0006093712
4 1.6770000457763672 1.417865 .003565814453837919 -.0006093712
4 1.6770000457763672 1.417865 .0015064737708275246 -.0006093712
4 1.6770000457763672 1.417865 -.001450077625743531 -.0006093712
4 1.3890000581741333 1.417865 .0025399518285950835 -.0006093712
4 1.3890000581741333 1.417865 -.00008314149448057293 -.0006093712
4 1.3890000581741333 1.417865 -.00264706689732443 -.0006093712
4 1.3890000581741333 1.417865 -.0046777288729113395 -.0006093712
4 1.3890000581741333 1.417865 -.00914245381680592 -.0006093712
4 1.3890000581741333 1.417865 -.00700097423044709 -.0006093712
4 1.3890000581741333 1.417865 -.008433296568919339 -.0006093712
4 1.3890000581741333 1.417865 -.013204861540199477 -.0006093712
4 1.3890000581741333 1.417865 -.014364183593742185 -.0006093712
4 1.3890000581741333 1.417865 -.015444051513141611 -.0006093712
4 1.3890000581741333 1.417865 -.01279344256693269 -.0006093712
4 1.3890000581741333 1.417865 -.009466272067912462 -.0006093712
4 1.3890000581741333 1.417865 -.007383238950604474 -.0006093712
4 1.3890000581741333 1.417865 -.006018720126566169 -.0006093712
4 1.3890000581741333 1.417865 -.006023297375925912 -.0006093712
4 1.3890000581741333 1.417865 -.0032789059631669858 -.0006093712
4 1.3890000581741333 1.417865 -.004582010000065449 -.0006093712
4 1.3890000581741333 1.417865 -.0033608506502379766 -.0006093712
4 1.100000023841858 1.417865 .03921126931429379 -.0006093712
4 1.100000023841858 1.417865 .037104918792983395 -.0006093712
4 1.100000023841858 1.417865 .036233238601829657 -.0006093712
4 1.100000023841858 1.417865 .03443272530766962 -.0006093712
4 1.100000023841858 1.417865 .02526996563362867 -.0006093712
4 1.100000023841858 1.417865 .019073450673706516 -.0006093712
4 1.100000023841858 1.417865 .018588612534819627 -.0006093712
4 1.100000023841858 1.417865 .007151904262588452 -.0006093712
4 1.100000023841858 1.417865 .014357413609561769 -.0006093712
4 1.100000023841858 1.417865 .014499444223885 -.0006093712
4 1.100000023841858 1.417865 .013921937092171734 -.0006093712
4 1.100000023841858 1.417865 .01271685737387346 -.0006093712
4 1.5399999618530273 1.417865 .012079164666963182 -.0006093712
4 1.5399999618530273 1.417865 .00716736984339204 -.0006093712
4 1.5399999618530273 1.417865 .00788063315810916 -.0006093712
4 1.5399999618530273 1.417865 .00681633879941004 -.0006093712
4 1.5399999618530273 1.417865 .006783476955592701 -.0006093712
4 1.5399999618530273 1.417865 .0008174012149019787 -.0006093712
4 1.5399999618530273 1.417865 .00277341205796916 -.0006093712
4 1.5399999618530273 1.417865 .0017975961479823905 -.0006093712
4 1.5399999618530273 1.417865 .002657955196104919 -.0006093712
4 1.5399999618530273 1.417865 .0009851211820280752 -.0006093712
4 1.5399999618530273 1.417865 .0048100191602722 -.0006093712
4 1.5399999618530273 1.417865 .005723510274338288 -.0006093712
4 1.3799999952316284 1.417865 .005084054580076671 -.0006093712
4 1.3799999952316284 1.417865 .0074259662326077325 -.0006093712
4 1.3799999952316284 1.417865 .01017841319013133 -.0006093712
4 1.3799999952316284 1.417865 .011344522290153904 -.0006093712
4 1.3799999952316284 1.417865 .0119847233815383 -.0006093712
4 1.3799999952316284 1.417865 .00846514544659567 -.0006093712
4 1.3799999952316284 1.417865 .00872006067702675 -.0006093712
4 1.3799999952316284 1.417865 .007937297081933515 -.0006093712
4 1.3799999952316284 1.417865 .008264231995338047 -.0006093712
4 1.3799999952316284 1.417865 .002626290973518384 -.0006093712
4 1.3799999952316284 1.417865 .004769733071080048 -.0006093712
4 1.3799999952316284 1.417865 .004288828037580048 -.0006093712
4 1.5099999904632568 1.417865 .0030103450348373043 -.0006093712
4 1.5099999904632568 1.417865 .0010676980608890965 -.0006093712
4 1.5099999904632568 1.417865 -.00198054981620948 -.0006093712
4 1.5099999904632568 1.417865 -.0002576709104457238 -.0006093712
4 1.5099999904632568 1.417865 .001719370536849455 -.0006093712
4 1.5099999904632568 1.417865 -.0010946970159981077 -.0006093712
4 1.5099999904632568 1.417865 -.00041203850616485654 -.0006093712
4 1.5099999904632568 1.417865 .0008502249132824116 -.0006093712
4 1.5099999904632568 1.417865 -.0010846949403825468 -.0006093712
4 1.5099999904632568 1.417865 -.003410998505710562 -.0006093712
4 1.5099999904632568 1.417865 -.0031783749851852297 -.0006093712
4 1.5099999904632568 1.417865 -.002886334290051005 -.0006093712
4 1.5499999523162842 1.417865 -.0023420224475766208 -.0006093712
4 1.5499999523162842 1.417865 -.0011567322096284784 -.0006093712
4 1.5499999523162842 1.417865 -.002413825004820118 -.0006093712
4 1.5499999523162842 1.417865 -.003561881440058567 -.0006093712
4 1.5499999523162842 1.417865 -.004437255144742497 -.0006093712
4 1.5499999523162842 1.417865 -.001321013824925759 -.0006093712
4 1.5499999523162842 1.417865 .0009930816087858965 -.0006093712
4 1.5499999523162842 1.417865 -.000030053225495138558 -.0006093712
4 1.5499999523162842 1.417865 -.00025366199256105816 -.0006093712
4 1.5499999523162842 1.417865 .0031576600593439044 -.0006093712
4 1.5499999523162842 1.417865 .0017091193316435445 -.0006093712
4 1.5499999523162842 1.417865 .002972087483720765 -.0006093712
4 1.2799999713897705 1.417865 .0015071261897042498 -.0006093712
4 1.2799999713897705 1.417865 -.000771124694131986 -.0006093712
4 1.2799999713897705 1.417865 -.002834069970186823 -.0006093712
4 1.2799999713897705 1.417865 -.0039409218708400025 -.0006093712
4 1.2799999713897705 1.417865 -.004219105288234017 -.0006093712
end
0 Response to Quintile Sorting two variables
Post a Comment