Hi Sven and Allin,
finally everything is working und results are as expected. Indeed, for some
companies no values where attached by construction. After eliminating round
about 100 of 600 companies, the code you gave me worked perfect. My fault!
You helped me a lot, thanks. I already tried to solve the problem in Excel,
but this way is much easier and more elegant.
Thanks again,
Peter
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces@lists.wfu.edu] Im Auftrag von Allin Cottrell
Gesendet: Donnerstag, 11. März 2010 22:12
An: Gretl list
Betreff: Re: [Gretl-users] Panel Data, print out estimated betas
On Thu, 11 Mar 2010, [iso-8859-1] Peter Blömeke wrote:
Thank you Allin for the code. After running the code the output looks
like
this now:
gretl version 1.8.7
Current session: 2010-03-11 21:09
? scalar numofunits = max($unit)
Generated scalar numofunits = 612
? matrix betas = {}
Generated matrix betas
? loop for i=1..numofunits
> smpl $unit=i --restrict
> ols Aktie const Leitregion CDAX --quiet
> b1 = $coeff[2]
> b2 = $coeff[3]
> betas |= { b1, b2 }
> smpl full
> endloop
loop: i = 1
? smpl $unit=i --restrict
Full data set: 110160 observations
Current sample: 180 observations
? ols Aktie const Leitregion CDAX --quiet
? b1 = $coeff[2]
? b2 = $coeff[3]
? betas |= { b1, b2 }
? smpl --full
Full data range: 1:001 - 612:180 (n = 110160)
loop: i = 2
...
loop: i = 16
? smpl $unit=i --restrict
Full data set: 110160 observations
Current sample: 180 observations
? ols Aktie const Leitregion CDAX --quiet
Missing values encountered
>> ols Aktie const Leitregion CDAX --quiet
Unfortunately it stops here and I don't know why. Is it a problem with
missing values? Does Gretl has to know somehow how to work with missing
values?
Gretl can generally handle missing observations fine. I suspect
there's a serious hole in the dataset -- something like all
observations missing for Aktie for unit 16? Using current CVS
gretl you could do:
catch ols Aktie const Leitregion CDAX --quiet
if $error
printf "error running OLS for unit %d\n", i
else
b1 = $coeff[2]
b2 = $coeff[3]
betas |= { $i, b1, b2 }
endif
The first column of betas would hold the unit number for units
where the regression was successful.
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users