Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: multiple rolling regressions


From   "Erasmo Giambona" <[email protected]>
To   [email protected]
Subject   Re: st: multiple rolling regressions
Date   Tue, 13 May 2008 16:27:19 -0400

Dear Austin,
I have spent quite some time trying to understand why the code stops
estimating d at some point. I also tried to run the code only on the
subsample including firms with id number higher than 5918. I get an
error message saying no observations. No success. The data however is
there. So I am at a loss. I hope you can be a bit more patient with
this issue. I could send you the data or a portion of the data if
necessary.
Hope you can provide a bit more help.
Regards,
Erasmo

On Tue, May 13, 2008 at 12:46 PM, Erasmo Giambona <[email protected]> wrote:
> Hi Austin,
> This code works except that it produces missing values for d starting
> from firm number 5918, despite the fact that y and x are availables. I
> thought it was a memory problem, so I set the memory to 850m, but I
> still get missing values. Does it mean that I have to run the code for
> different subsamples?
> Thanks.
> Erasmo
>
>
> On Fri, May 9, 2008 at 2:04 PM, Austin Nichols <[email protected]> wrote:
> > Erasmo--this problem seems constantly to have a "new" wrinkle.  Try this:
> >
> > clear
> > input firm year y x
> >      1 1980 20 23
> >      1 1981 22 34
> >      1 1982 20 19
> >      1 1984 22 34
> >      1 1985 20 19
> >      1 1986 28 34
> >      1 1987 30 19
> >      1 2004 33 48
> >      1 2005 30 45
> >      1 2006 35 50
> >      2 1980 15 23
> >      2 1981 55 34
> >      2 1982 29 19
> >      2 1983 15 23
> >      2 1984 55 34
> >      2 1985 29 19
> >      2 1986 28 34
> >      2 1987 30 19
> > end
> > su year, meanonly
> > loc ny=r(max)-r(min)+1
> > loc fy=r(min)
> > tempfile allyrs
> > preserve
> > drop _all
> > set obs `ny'
> > g year=`fy'+_n-1
> > save `allyrs'
> > restore
> > append using `allyrs'
> > fillin firm year
> > drop if mi(firm)
> > tsset firm year
> > sort firm year
> > g double d=.
> > qui forv i=3/`=_N-2' {
> >  loc f=`i'-2
> >  loc l=`i'+2
> >  if firm[`f']==firm[`i'] & firm[`l']==firm[`i'] {
> >  cap reg y year in `f'/`l' if firm==firm[`i']
> >  if _rc==0 {
> >  if e(N)>2 {
> >  predict double ye if e(sample), resid
> >  reg x year in `f'/`l' if firm==firm[`i']
> >  predict double xe if e(sample), resid
> >  reg ye xe
> >  replace d=_b[xe] in `l'
> >  drop ye xe
> >  }
> >  }
> >  }
> > }
> > li, noo sepby(firm)
> >
> > On Fri, May 9, 2008 at 11:58 AM, Nick Cox <[email protected]> wrote:
> > > The -fillin- does not work as you hoped because _no_ observations exist
> > > anywhere for years 1988-2003. -fillin- rectangularises, rather than
> > > "fills in"!
> > >
> > > You'd need to fix that by hand by explicitly adding some observations
> > > with those years but missings otherwise. However, for the example data
> > > given here, that sounds futile if I understand what is being tried, as
> > > your gap is too big to be bridged, anyway.
> > >
> > > Erasmo Giambona
> > >
> > > Sorry Austin. Here are the codes and outputs for my questions 1 and 2.
> >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index