Hello!! I have a panel dataset where the main variables are: stockName(stock id), dExReturn(stock daily excess return) and Mkt(market excess returns). There are also daily. monthly and yearly dates( ddate, mdate, ydate). I would like to calculate the tail and downside betas from a regression of dExReturn to Mkt. Definition of the two coefficients provided below:
Downside Beta : downside beta of a stock in month t, is defined as the fitted slope coefficient from a one-factor market model
regression using daily returns from the past year (months t -11 through t, inclusive) from days
when the market return was below the average daily market return during that year.
Tail Beta: Tail beta of a stock in a given month t, is calculated as the fitted
slope coeffcient from a one-factor market model regression using daily returns from the past year
(months t -11 through t, inclusive) from days when the market return was in the bottom 10% of
market returns during that year.
For the downside beta I tried something like:
gen ydate=yofd(ddate)
format ydate %ty
rangestat (mean) mkt , interval(ydate . .) by(ydate)
bys stockName: asreg dExReturn mkt if mkt < mkt_mean,wind(mdate 12) but It didn't work properly using only the monhs where mkt was lower than mkt_mean.
For the second case I havent found a way to do it at all.
Since I am new to stata could anyone please help me with these calculations?
Downside Beta : downside beta of a stock in month t, is defined as the fitted slope coefficient from a one-factor market model
regression using daily returns from the past year (months t -11 through t, inclusive) from days
when the market return was below the average daily market return during that year.
Tail Beta: Tail beta of a stock in a given month t, is calculated as the fitted
slope coeffcient from a one-factor market model regression using daily returns from the past year
(months t -11 through t, inclusive) from days when the market return was in the bottom 10% of
market returns during that year.
For the downside beta I tried something like:
gen ydate=yofd(ddate)
format ydate %ty
rangestat (mean) mkt , interval(ydate . .) by(ydate)
bys stockName: asreg dExReturn mkt if mkt < mkt_mean,wind(mdate 12) but It didn't work properly using only the monhs where mkt was lower than mkt_mean.
For the second case I havent found a way to do it at all.
Since I am new to stata could anyone please help me with these calculations?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float mdate int stockName float(ddate mkt dExReturn ydate) 460 1 14005 .05 -1.457933 1998 530 1 16133 -1.7 -1.8914543 2004 399 1 12152 .53 . 1993 613 1 18682 .13 1.5040573 2011 553 1 16841 1.02 1.3581873 2006 370 1 11274 .65 . 1990 442 1 13460 .46 .14582731 1996 573 1 17465 1.06 1.923817 2007 581 1 17689 -.85 .30475095 2008 468 1 14257 -2.8 -4.858649 1999 660 1 20114 1.52 .9868142 2015 463 1 14117 -2.92 -3.592658 1998 460 1 14011 -1.2 -1.8662983 1998 447 1 13608 .38 -.6842163 1997 683 1 20793 .7 1.7178026 2016 653 1 19878 -.11 -1.266422 2014 457 1 13926 .8 3.282219 1998 662 1 20166 .67 .9064875 2015 483 1 14710 -.26 -2.640217 2000 457 1 13915 2.2 .4658899 1998 548 1 16698 -.67 .27410048 2005 544 1 16575 .2 1.1509026 2005 472 1 14390 -1.1 -3.0396576 1999 666 1 20284 .84 .7995971 2015 405 1 12337 -1.22 . 1993 585 1 17814 -1.48 -2.7196395 2008 537 1 16348 -.55 -1.1415064 2004 567 1 17282 -.28 -.7049015 2007 559 1 17020 -1.21 -1.2842622 2006 440 1 13422 .17 1.0056604 1996 end format %tm mdate format %td ddate format %ty ydate
Comment