On 07.05.2013 17:40, Riccardo (Jack) Lucchetti wrote:
On Sun, 5 May 2013, Sven Schreiber wrote:
> 3: About pshrink(): A version that returns a full panel series (with
> repeated values like pmean() etc.) could be useful -- practical example:
> in growth regressions one needs the initial value of output-per-worker
> as a regressor. Also maybe it should be called "pfirst()" or something
> instead.
>
> 4: Time-constant variables: I'm not sure how to create variables that
> only vary along the cross-section, like it is done with the built-in
> pmean() etc. functions. Or how to append them (like the user guide p.114
> "adding a time series", but along the other panel dimension).
This can be done quite compactly by using the "replace" function: to
illustrate this, I'll use your point 3.
<hansl>
open abdata.gdt --quiet
series first_n = replace($unit, values($unit), pshrink(n))
</hansl>
Probably not the most intuitive thing in the world, though, I must admit.
No, probably not :-) But of course I appreciate your solution. Some
remarks:
I had to look up the meaning of "values()" and AFAIU it is identical to
sort(uniq()) -- which surprises me in the sense that it seems like a
pretty trivial thing to deserve its own extra function. And (excuse me,
I know I say this a lot...) I find the name "values" not very helpful or
intuitive -- as opposed to "uniq" for example, which I find very natural.
According to the pshrink() documentation, this would fail if some unit
had no valid data.
What would be great if it could just work like this:
series initialx = x[,$t1]
similar to how in a time-series or cross-section workfile this also works:
series x = 5
But maybe it already even does?? I haven't tested yet...
...
[@ constant in FE regression:]
with an obvious degrees-of-freedom correction for the covariance matrix.
I don't like it very much either, but at some point we decided that
since the constant in a fixed effects regression is conventional anyway,
we might as well ensure compatibility with Stata.
Ah ok, I hadn't realized that Stata does it like this. I still don't
fully understand why they do, but well.
Thanks,
sven