Hello everyone,
For my Replication Study, I am replicating a study for which I need the variable 'Return Volatility'. This is measured as the 'standard deviation of monthly stock returns over three years prior to t'. I am new to STATA, and I have no clue how to calculate the standard deviation over 3 preceding years. My data looks like this:
Cusip Permno Permco Companyname fyear month........date ......vwreturn
30710 .................................................. 2007 .....1......29/01/2007.......x ..........
30710 .................................................. 2007 .....2......29/02/2007.......x ..........
30710 .................................................. 2007..3/4/5 etc......x...............x ..........
30710 .................................................. 2007 .....12....29/12/2007.......x ..........
30710 .................................................. 2008 .....1......29/01/2008.......x ..........
30710 .................................................. 2007 .....2......29/02/2008.......x ..........
et cetera. I have data from 2007 till 2019, and thousands of unique companies.
From the monthly returns, I already calculated the annual returns (using by cusip fyear: egen yearendret = total(vwreturn). (Then using collapse function) Then my data looks like this:
Cusip Permno Permco Companyname fyear yearendret
30710 .................................................. 2007......x.........
30710 .................................................. 2008......x .........
30710 .................................................. 2009......x..........
30710 .................................................. 2010......x..........
30710 .................................................. 2011......x ..........
Now my question is, how do I calculate the SD for this yearendret?
I already tried: egen sd_yearendret= sd(yearendret), by(cusip fyear)
However, I only get values of 0.
In addition, how do I get the standard deviation of the three preceding years all together? Is it even useful to calculate the SD per year, or is there another way to calculate the SD of yearendret three years prior to t?
Kind regards,
Laura Banken
Related Posts with Computing Standard Deviation of annual returns over three years.
Overlay two lowess-functions?Hello, everyone, is there a method to display (overlay) two lowess-functions at the same time in one…
Using weights with xtheckman | xtheckman's fixed effects equivalentHi, I am using six waves of the PSID to estimate several determinants (particularly wealth) of the …
Panel table, initial value as regressorDear all, I would like to examine the effect of initial leverage ratio on leverage ratio. I've got a…
Please can someone helpHi, having to use STATA as an Economics Undergrad for Economics to write my dissertation and keep c…
Fixed effects probit and logit models with marginal coefficients evaluated at means I have some survey data and a dummy outcome variable. The data includes the region in which each in…
Subscribe to:
Post Comments (Atom)
0 Response to Computing Standard Deviation of annual returns over three years.
Post a Comment