Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | László Sándor <sandorl@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: xt: unit-specific trends |
Date | Fri, 13 Apr 2012 12:43:04 -0400 |
Hi all, I am trying to demean and detrend my panel data allowing for unit specific trends (using Stata 11.0 MP for Windows). I found some previous posts about this, but I am not satisfied with the speed of the solutions. I would be most happy with a "byable" solution, like this pseudocode: bys id: { reg var t pred dtrended_var, res } I know this is not possible. However, looping through my ids and if conditions is not feasible either (or I collect them into a local with -levelsof-?). Actually, with all the if conditions, it is not attractive either, let alone feasible. (Or if I sort by id, I can use in conditions in the balanced subset, which I presume to be much faster?) Or shall I just loop over a new id that will be consecutive integers if I -egen, group- the old id (or do the same with ins)? I had some hopes about -xtdata- or -areg-, but to no avail. Yet I look for some guidance on doing this the right way, if even the simple -areg- could have been made faster by "orders of magnitude" from Stata 11 to 12… Thank you for any thoughts, Laszlo * * 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/