I am struggling with generating a three-dimensional table with mean returns and simple t-statistics of means for portfolios constructed on various formation and holding periods, and trading volume groups.
My goal is to reproduce the structure of the Table II in https://onlinelibrary.wiley.com/doi/...022-1082.00280.
I am examining volume based momentum strategies in cryptocurrency markets. Below, find an example of my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(date p_return) str2 factor float(j k v portfolio) 20386 .42166305 "m" 4 4 . 8 20386 .12324628 "m" 4 4 . 9 20386 -.1356472 "m" 4 4 . 10 20386 -.14543106 "m" 4 4 . 101 20386 .14126293 "m" 4 5 . 1 20386 .1065591 "m" 4 5 . 2 20386 .14518213 "m" 4 5 . 3 20386 .018800067 "m" 4 5 . 4 20386 .2072041 "m" 4 5 . 5 20386 -.014721913 "m" 4 5 . 6 20386 -.004377261 "m" 4 5 . 7 20386 .6307436 "m" 4 5 . 8 20386 .2844051 "m" 4 5 . 9 20386 -.11404145 "m" 4 5 . 10 20386 -.2553044 "m" 4 5 . 101 20386 .2034114 "m" 5 3 . 1 20386 .04398503 "m" 5 3 . 2 20386 .08971964 "m" 5 3 . 3 20386 -.007479853 "m" 5 3 . 4 20386 -.02604575 "m" 5 3 . 5 20386 -.029167436 "m" 5 3 . 6 20386 -.07060675 "m" 5 3 . 7 20386 -.04626891 "m" 5 3 . 8 20386 .11131526 "m" 5 3 . 9 20386 -.0381491 "m" 5 3 . 10 20386 -.2415605 "m" 5 3 . 101 20386 -.002899919 "m" 5 4 . 1 20386 -.03183234 "m" 5 4 . 2 20386 .3218911 "m" 5 4 . 3 20386 -.032930452 "m" 5 4 . 4 20386 .008426926 "m" 5 4 . 5 20386 -.04889794 "m" 5 4 . 6 20386 -.05278589 "m" 5 4 . 7 20386 -.09037732 "m" 5 4 . 8 20386 .1731717 "m" 5 4 . 9 20386 -.07904667 "m" 5 4 . 10 20386 -.07614674 "m" 5 4 . 101 20386 .13773654 "m" 5 5 . 1 20386 .11623829 "m" 5 5 . 2 20386 .755017 "m" 5 5 . 3 20386 .08712616 "m" 5 5 . 4 20386 .08302064 "m" 5 5 . 5 20386 -.05134476 "m" 5 5 . 6 20386 .02598821 "m" 5 5 . 7 20386 .063133314 "m" 5 5 . 8 20386 .24584103 "m" 5 5 . 9 20386 -.04607767 "m" 5 5 . 10 20386 -.1838142 "m" 5 5 . 101 20386 .7669875 "vm" 3 3 1 1 20386 -.09574735 "vm" 3 3 1 2 20386 -.19485505 "vm" 3 3 1 3 20386 .08248788 "vm" 3 3 1 4 20386 -.41167516 "vm" 3 3 1 5 20386 -.04059242 "vm" 3 3 1 6 20386 .11815193 "vm" 3 3 1 7 20386 -.06500447 "vm" 3 3 1 8 20386 . "vm" 3 3 1 9 20386 -.13034143 "vm" 3 3 1 10 20386 -.8973289 "vm" 3 3 1 101 20386 .3648205 "vm" 3 3 2 1 20386 -.14306149 "vm" 3 3 2 2 20386 -.26395005 "vm" 3 3 2 3 20386 -.17665146 "vm" 3 3 2 4 20386 .04358416 "vm" 3 3 2 5 20386 . "vm" 3 3 2 6 20386 -.17464803 "vm" 3 3 2 7 20386 . "vm" 3 3 2 8 20386 .00322665 "vm" 3 3 2 9 20386 -.4303089 "vm" 3 3 2 10 20386 -.7951294 "vm" 3 3 2 101 20386 -.3153127 "vm" 3 3 3 1 20386 .11438722 "vm" 3 3 3 2 20386 -.033845622 "vm" 3 3 3 3 20386 .8352345 "vm" 3 3 3 4 20386 .16416664 "vm" 3 3 3 5 20386 .1288344 "vm" 3 3 3 6 20386 -.04806391 "vm" 3 3 3 7 20386 . "vm" 3 3 3 8 20386 .158022 "vm" 3 3 3 9 20386 .03944749 "vm" 3 3 3 10 20386 .3547602 "vm" 3 3 3 101 20386 .9825595 "vm" 3 4 1 1 20386 -.09007983 "vm" 3 4 1 2 20386 -.10294256 "vm" 3 4 1 3 20386 -.02079397 "vm" 3 4 1 4 20386 -.4573604 "vm" 3 4 1 5 20386 .2142525 "vm" 3 4 1 6 20386 .16870226 "vm" 3 4 1 7 20386 -.065469936 "vm" 3 4 1 8 20386 . "vm" 3 4 1 9 20386 -.25128433 "vm" 3 4 1 10 20386 -1.2338438 "vm" 3 4 1 101 20386 .10985465 "vm" 3 4 2 1 20386 -.04759487 "vm" 3 4 2 2 20386 -.27743867 "vm" 3 4 2 3 20386 -.22140653 "vm" 3 4 2 4 20386 .14604992 "vm" 3 4 2 5 20386 . "vm" 3 4 2 6 20386 -.2616199 "vm" 3 4 2 7 20386 . "vm" 3 4 2 8 end format %td date label values v volume_portfolio label def volume_portfolio 1 "low", modify label def volume_portfolio 2 "mid", modify label def volume_portfolio 3 "high", modify label values portfolio tenminusone label def tenminusone 101 "10 - 1", modify
p_return denotes the return of a portfolio in the given week;
factor is a variable denoting the strategy: "m" = momentum, "vm" = volume based momentum;
j denotes a formation period of portfolios (3, 4, 5);
k denotes a holding period of portfolios (3, 4, 5);
portfolio denotes a group of assets based on their ranked formation period return (1 to 10)
v denotes a formation period trading volume group (low, mid, high) and is empty if factor="m" since pure momentum does not take volume into account
Code:
// simple momentum table portfolio k j if factor=="m", contents(mean p_return) // volume based momentum table portfolio v k if factor=="vm", contents(mean p_return) by (j)
The code above produces the desired result with regards to the structure of the table and mean returns, however, table command does not support tabulating a t-statistic (ideally with asterisks denoting significance) under each mean return. I have had a look at commands such as -estout- and -esttab- but find them quite difficult to understand.
Could you please help me with generating the table?
Thank you for your help!
Kind regards,
Albert
0 Response to N-way table with means and t-statistics for sorted portfolios
Post a Comment