Hi,
I am calculating idiosyncratic volatility based on previous 1 month and previous 3 months daily regressions. I created mdate as year*100+month. And when I run the regressions for previous 1 month I have no problem in getting my residuals using this command:
rangestat (reg) excessret mrktx smb hml , interval(mdate 0 0) by( permno )
gen residual = excessret - b_cons - b_mrktx * mrktx- b_smb* smb- b_hml* hml
However when I want the regressions to use previous 3 months data, I have a problem, let me tell you what it is. I run the following code:
rangestat (reg) excessret mrktx smb hml , interval(mdate -2 0) by( permno )
and it does the job but the problem is whenever the year changes i. e. 1986 to 1987, the mdate variable changes 198612 to 198701. So the difference is not apparently 2. And for every new year for the same firm the first 2 months of regression is only ran on the first month and first 2 month instead of going back to December of last year. In order to solve the issue, I need a continuos mdate variable that doesnt jump every beginning year. How do can I construct it? Or is there any other solution,
any comment would be appreciated.
the num of observation in each regression changes as follow for the same firm. I am not sure if my question is clear. Every new year obs used in that window is just the days in January. That way I lose the first 2 months of every year.
mdate reg_nobs
198612 64
198612 64
198612 64
198612 64
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198701 21
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198702 40
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198703 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198704 62
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198705 63
198706 50
198706 50
198706 50
198706 50
198706 50
198706 50
198706 50
198706 50
198706 50
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198601 16
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198602 35
198603 55
198603 55
198603 55
198603 55
198603 55
198603 55
198603 55
198603 55
198603 55
Related Posts with idiosyncratic volatility using rangestat
Hot deck to impute wind serieshello with everyone I am a new user in SATA, I investigated a bit about the imputation of data and I…
ID/ Index creationDear all, I would like to create country specific IDs. I have different ISOs for which I would like…
POLS, FE and REHello, I'm estimating a TFP growth convergence regression type model in a panel with 20 NUTS-2 regio…
mkspline / mkspline2Hi Statalist, I just recently started working with restricted cubic splines using the mkspline/mksp…
How do you analyze an unbalanced panel in stata?Array Hello, I would like to ask a question in stata. I want to do a panel regression. (OLS, RE, …
Subscribe to:
Post Comments (Atom)
0 Response to idiosyncratic volatility using rangestat
Post a Comment