ymdate excess_ret mom rmw cma
432 3.714887 .56 -.56 2.26
433 -9.23 .58 1.02 -1.78
434 -1.5 -1.89 1.4 -.95
... ... .... .... ....
623 3.0503345 3.9 1.46 2.96
I was looking for a calculation of monthly downside betas for every single risk factor in the table above (mom, rmw, cma), which is defined as "β= ((cov(excess return,risk factor) | risk factor < 0)/ Var(risk factor))". So, I want to calculate the covariance between the excess returns and risk factors (one after another), but only for these observations where the risk factor is negativ. Dividing this term by the variance of the respective risk factor will result in my beta "β". All in all, I will a get monthly downside betas for every single risk factor (e.g. βrmw).
If I consider my table above:
corr excess_ret rmw if rmw < 0, cov
delivers the variance-covariance matrix with the variance of the excess returns, the variance of the respective risk factor (here:rmw) and the covariance between both variables. How can I put these numbers in a command to get my downside beta as defined without copy & paste the results out of the var-cov matrix?
I also tried to work with:
corr excess_ret mktrf if mktrf < 0, cov scalar β = `r(cov_12)'/`r(Var_2)'
in oder to explicitly state that I am referring to a matrix, but the option "scalar" was not allowed. How can I put that into the same context? Is it necessary that I generate a new variable named "β" upfront?
432 3.714887 .56 -.56 2.26
433 -9.23 .58 1.02 -1.78
434 -1.5 -1.89 1.4 -.95
... ... .... .... ....
623 3.0503345 3.9 1.46 2.96
I was looking for a calculation of monthly downside betas for every single risk factor in the table above (mom, rmw, cma), which is defined as "β= ((cov(excess return,risk factor) | risk factor < 0)/ Var(risk factor))". So, I want to calculate the covariance between the excess returns and risk factors (one after another), but only for these observations where the risk factor is negativ. Dividing this term by the variance of the respective risk factor will result in my beta "β". All in all, I will a get monthly downside betas for every single risk factor (e.g. βrmw).
If I consider my table above:
corr excess_ret rmw if rmw < 0, cov
delivers the variance-covariance matrix with the variance of the excess returns, the variance of the respective risk factor (here:rmw) and the covariance between both variables. How can I put these numbers in a command to get my downside beta as defined without copy & paste the results out of the var-cov matrix?
I also tried to work with:
corr excess_ret mktrf if mktrf < 0, cov scalar β = `r(cov_12)'/`r(Var_2)'
in oder to explicitly state that I am referring to a matrix, but the option "scalar" was not allowed. How can I put that into the same context? Is it necessary that I generate a new variable named "β" upfront?
Comment