On Tue, 29 Jun 2010, Sven Schreiber wrote: > Am 29.06.2010 10:46, schrieb Marcus Marktanner: > > 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 [...] > > 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 [...]
Sven's idea is fine, but that last "smpl" line will work only for time-series data. Let's suppose you have a variable called "year" in your data set which identifies the year. (If you don't already, you can easily construct one, e.g. "year = time + 1960"). Here's a tested version of Sven's idea which fakes what you want to do (as I understand it), using the panel dataset greene14_1.gdt that's supplied with gretl: <script> open greene14_1.gdt genr time matrix greencountries = {} numofunits = max($unit) loop for i=1..numofunits # first time sub-sample smpl ($unit==i && year>=1970 && year<=1978) --restrict ols Q const time --quiet temp1 = $coeff(time) # second time sub-sample smpl ($unit==i && year>1978) --restrict --replace ols Q const time --quiet temp2 = $coeff(time) green = (temp2 > temp1) greencountries |= green smpl full endloop print greencountries </script> Allin Cottrell