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

[no subject]

```

> So...
>
> webuse grunfeld, clear
> g x1=(inv+l.inv )/2
> g x2=(ks+l.ks )/2
> tsset
> loc tv "`r(timevar)'"
> levelsof `tv', loc(tl)
> foreach v in pred cons b1 b2 {
>  g double `v'=.
> }
> foreach t of local tl {
>  cap reg mval x1 x2 if `tv'==`t'
>  qui if _rc==0 {
>  tempvar pt
>  predict double `pt'
>  replace pred=`pt' if e(sample)
>  replace cons=_b[_cons] if e(sample)
>  replace b1=_b[x1] if e(sample)
>  replace b2=_b[x2] if e(sample)
>  drop `pt'
>  }
> }
> preserve
> collapse cons b1 b2, by(`tv')
> li `tv' cons b1 b2, noo clean
> restore
>
> or just use -rolling- for simplicity.
>
> On 10/19/07, Daniele Gori <west--@libero.it> wrote:
> > First of all, thank you very much for the time you have spent for me. I try to explain again what I'm searching for.
> >
> > The sample I use for my analysis is a panel of 1000 firms and many variables (es. earnings, investments...), from 1995 to 2005. Anyway, I don't want to estimate a panel regression (e.g. a GMM). The estimation technique I would like to use is called "cross-section average estimation". It simply consists in a set of separated cross-sections (among the firms), year-by-year, so that the regressors coefficients may vary in dimension and sign year-by-year. In particular, in my case, I wish to estimate the following regressions (the basic one being yi = x1i + x2i + ui):
> >
> > y_97i = x1_(mean-of95-96)i + x1_(mean-of95-96)i + ui
> > y_98i = x1_(mean-of96-97)i + x1_(mean-of96-97)i + ui
> > ...
> > y_05i = x1_(mean-of03-04)i + x1_(mean-of03-04)i + ui
> >
> > where the dependent variable is in level for each year of the estimation period; the two explanatory variables are averaged over the two years preceding the year of the dependent variable; ui is the error term (the first two years are lost because we are not able to calculate regressors before 1995).
> >
> > My questions are simply the following:
> >
> > - I need to get a cross section regression for each year (from 1997 to 2005, as above), being the dependent variable in level and the regressors an average over their own values in the two years preceding. An example would be very helpful.
> >
> > - find ALSO a simple representation, inside the "result window", to see the set of cross-sectional results (I mean, a sort of table with separated coefficients year-by-year).
> >
>

*
*   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–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index