From 2009 to 2015, we bought companies with a median investment greater than or equal to TMFO1 based on TMFO1 of the current year, and sold companies with a median less than TMFO1.If TMFO1 is less than the median, GROUP is defined as 0; if TMOF1 is greater than or equal to the median, GROUP is defined as 1. The hedging gain is the average of the stock investment returns for the GROUP=1 group minus the stock investment return average for the GROUP=0 group.How to calculate whether the difference in the hedging portfolio income of T, T+1 and T+2 years is significant.(Mean T test)
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double code int year float(TMFO1 Wbhar1)
 2 2009  12.838    -.289044
 2 2010  5.4083    -.289044
 2 2011 14.2149   .04855503
 2 2012 15.7463     .248891
 2 2013 21.4571   .30862805
 2 2014 15.0044  -.26526746
 2 2015  8.7581   -.3385077
 4 2011       .    .1623955
 4 2014       .    .2725245
 4 2015       0   -.4078253
 5 2009       .    .1516894
 5 2010       0    .1516894
 5 2014       .   -.1151184
 5 2015       0   1.0438666
 6 2009       0  -.23634174
 6 2010  2.3596  -.23634174
 6 2011   .3341   .19227333
 6 2012       0    .2477622
 6 2013       0  -.02993672
 6 2014  2.1679   .19068775
 6 2015       0    .1993493
 7 2011       .  .064144365
 7 2012       0    .4322636
 7 2014       .  -.24683416
 7 2015       0   .16854896
 8 2014       .    .3622303
 8 2015       0    2.025581
 9 2009       0 -.006594859
 9 2010    .871 -.006594859
 9 2011  11.625    .5159734
 9 2012  6.4265   -.1863238
 9 2013   .0445  -.04475773
 9 2014   .0001   .17672633
 9 2015   .0001    .6202015
10 2015       .   .50645643
11 2011       .   .07298819
11 2012       0   .05488733
11 2013       0  -.03120725
11 2014       0  -.06829076
11 2015       0  -.06516124
12 2009  2.4769 -.032068882
12 2010    .104 -.032068882
12 2011  2.4346    .4078096
12 2012       0   -.2873124
12 2013   .0142  -.14837095
12 2014  1.2339   .03415271
12 2015   .1142   -.1667335
14 2009       0   -.3741179
14 2010       0   -.3741179
14 2011       0  -.23779057
14 2014       .    .2076225
14 2015       0  -.17424917
16 2009       0  -.07955894
16 2010  3.6083  -.07955894
16 2011   .2216  -.22057442
16 2012  1.9354  -.09650463
16 2013   .0258   .05161239
16 2014   .0449    .2253235
16 2015   .0038    1.582201
17 2015       .    .2144066
18 2011       .  -.06813081
18 2014       .   .15034373
18 2015       0    1.540502
19 2010       .   .12932295
19 2011       0    .0837687
19 2012       0  .018850734
19 2013       0  -.18008693
19 2014       0   .11390718
19 2015       0 -.010579924
20 2011       .  -.03762912
20 2013       . -.065739244
20 2015       .    .4048073
21 2009       0    .5683905
21 2010       0    .5683905
21 2011       0 -.012761776
21 2012   .0001   -.1911286
21 2013       0  -.26817977
21 2014   .0249    .2602411
21 2015   .6497     .405893
22 2009       0 -.033070732
22 2010       0 -.033070732
22 2011       0   .07011167
22 2012       0  -.12587474
22 2013       0     .611657
22 2014       0     -.11453
22 2015       0   -.1977103
23 2011       . -.018041983
24 2009  5.4897   -.5136776
24 2010  2.4221   -.5136776
24 2011  4.8599  -.03094362
24 2012 10.3956    .4622364
24 2013 13.2136   .18629785
24 2014 11.6417  -.33723265
25 2011       .  -.23248793
25 2014       .     .471831
25 2015       0  -.07338826
26 2009       0    .7453964
26 2010       0    .7453964
26 2011   .0356    .1601941
26 2012   .0356   .10928397
end