Rolling multivariate regression 'for' loop
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am analysing stock returns from the CRSP database from 1996 to 2012, making a matrix of 4280 dates (rows) by 7377 stocks (columns).
I want to regress every return against the average stock return on each date, and their cross-sectional dispersion on each date, every month.
I have already computed these two columns, (columns 7378 and 7379 respectively), however, I am really struggling to run this multivariate rolling regression.
I don’t believe it should be too hard, however, I can’t seem to make anything work.
Overall, it needs to be a rolling regression, for each individual stock/column and stop at the end of each month, then start again onto the next month. From the regression, I only need to keep the beta with respect to cross sectional dispersion, since I will then sort the monthly average cross-sectional dispersion beta into monthly quintiles.
I believe using mvregress to get both betas but then only storing the CSD beta is what I need to do, in a nested ‘for’ loop.
I wondered if you could please point me in the right direction?
I would be so grateful.
Emily
1 Kommentar
Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!