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