Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Borja Amor Tapia" <borja.amor@unileon.es> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Problem to perform Rolling regression with gaps |
Date | Wed, 25 Jan 2012 12:33:54 +0100 |
I have a Panel with 4250 firms and 32 years (1980-2011). Variables are accounting data and stock market data. As is very common in finance and accounting research, only few have data for the entire 32-years period. Its no necessary to tsfill because the time variable (year) has data for the entire period and all firms (the file has 4250 ids * 32 years = 136000 rows) I need two new variables (eg. alfa and beta) that captures, by firm and year, the constant and the coefficient of the rolling regression: reg y x using a 4 year window as the rolling period. I am trying to run some commands such as rollreg, rolling, and bcoeff, but I'm unable to obtain results because commands ends with errors indicating that variables y and x have gaps. As I said, only few have data for the entire 32-years period, and I want to perform rolling regressions in the firm-years in which I have 4 year data although the id have less than 32 obs for the period (ids. with 4 consecutive obs. are sufficient to perform the regression and obtain the constant and coefficient by single year-id). The sample is: idfirm-year-vary-varx --------------------- 1-1980-number-number (...) 1-1991- . - . 1-1992- . - number 1-1995-number-number (...) Thank you for your assistance Borja Amor-Tapia PhD., Finance & Accounting University of Leon * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/