Am 29.06.2010 10:46, schrieb Marcus Marktanner:
Dear Gretl-Community:
Please apologize my ignorance, but I hope that someone can help me. I would
like to classify a country as either one with some kind of a green
revolution or not. I have a panel with some 200 countries and cereal yield
for 40 years (1961-2000). What I have in mind is the following: I would like
to run a simple regression for the period of, for example, 1960-1980,
regressing cereal yield on an initial value of cereal yield and time. Then I
would like to compare the time slope coefficient of this regression with the
time slope coefficient of the same regression covering the period 1981-2000.
If the slope coefficients of either both regressions are positive and
significant or the time slope coefficient of at least the second regression
is positive and significant, I would like to identify this country as one
with a green revolution (which then serves as a dependent variable for
subsequent analyses).
I understand that I could run now some 400 regressions individually but I
hope that there may be a faster way. Would anybody have an idea how I could
program such a task in gretl?
Normally I would start by saying please start a new thread for a new
topic, but here by coincidence the solution is probably similar to the
one in the thread that you replied to.
So something like:
genr time
matrix greencountries = {}
numofunits = max($unit)
loop for i=1..numofunits
smpl $unit=i --restrict
smpl 1961 1980 # not sure if this works here
ols yield const time
temp1 = $coeff(time)
smpl $unit=i --restrict --replace
smpl 1981 2000
ols yield const time
temp2 = $coeff(time)
green = temp2>temp1 ? 1 : 0
matrix greencountries = greencountries | green
smpl full
endloop
Bugs probably included.
hth,
sven