Ok, regressions are working perfectly now but gretl prints out a complete
regression-output for each model and stops at i = 16 instead of 612.
Any idea?
-----Ursprüngliche Nachricht-----
Von: Sven Schreiber [mailto:svetosch@gmx.net]
Gesendet: Mittwoch, 10. März 2010 18:48
An: Peter Blömeke
Cc: Gretl list
Betreff: Re: AW: AW: [Gretl-users] Panel Data, print out estimated betas
Peter Blömeke schrieb:
Peter Blömeke schrieb:
> Hi Sven,
>
> thx for responding to my obviously misleading question. Am I right that I
> could explain my question in German to you? If not, please let me know
and
I
> try it in English again.
>
>
> Ich habe als abhängige Variable die monatlichen Aktienkursrenditen von
612
> Unternehmen über 180 Monate und als erklärende Variable die
Rendite
zweier
> Aktienindizes. Die Daten sind als Paneldaten "Stacked Cross
Section"
> organisiert. Nun möchte ich das Gretl für jedes Unternehmen die beiden
> Indexrenditen auf die Aktienrendite regressiert und mir jeweils die
beiden
> Koeffizienten ausgibt. Sodass ich schließlich eine Liste mit 612
x 2
> Koeffizienten habe.
>
> Ich hoffe mein Problem ist etwas klarer geworden.
>
Ok so this is not a panel model at all, but rather 612 times 2 different
regressions (static but along the time dimension)! (although one could
use the panel structure of the dataset for the programming)
And I guess we should understand the term "beta" in the CAPM sense. Then
indeed you need a loop construct like it was suggested before.
This example indeed uses the panel structure (via $unit -- bugs probably
included):
scalar numofunits = max($unit)
matrix betas = {}
loop for i=1..numofunits
smpl $unit=i --restrict
ols stockreturn const indexreturn1 # I made these names up...
scalar coeff1 = $coeff(indexreturn1)
ols stockreturn const indexreturn2
scalar coeff2 = $coeff(indexreturn2)
matrix betas = betas | {coeff1,coeff2}
smpl full
endloop
and the 612x2-matrix betas will hold your coefficients
HTH,
sven
Hey Sven,
thank you so much for taking time to help me. I really appreciate that.
I think we are on the right way now. There are just two Problems left.
First: In fact it should not be 612 times 2 different regressions, but
rather 612 times one regression with two variables. So it would look
roughly
like this: stockreturn = beta0 + beta1*indexreturn1 +
beta2*indexreturn2 +
errorterm
(please keep the mailing list on cc: -- reply-to-all)
So then use:
ols stockreturn const indexreturn1 indexreturn2
matrix betas = betas | $coeff # or maybe transp($coeff)
-sven