On Tue, 12 Nov 2013, Sven Schreiber wrote: > Am 12.11.2013 16:13, schrieb Claudio Shikida (敷田治誠 クラウジオ): >> Thanks, Sven. >> >> I just got it in R (well, but it would be great to do it in Gretl too, >> at least for comparison of algorithms) but the features of lag-lead and >> sandwich for the t-statistics could be two good reasons to create a time >> series submenu. >> >> > > BTW, so far I was only thinking about the point estimates, and there > it's just a matter of how to create the needed regressors. For the > adjustment of the t-stats of course a package that does it all-in-one > could be useful. This would actually be an excellent use case of > user-contributed function packages, now that those can also be plugged > into the menus. > > I can commit to producing this in the Christmas break, if someone > reminds me ;-) Or if you cannot wait, do it yourself...
Maybe this could help: <hansl> set echo off set messages off function matrix dols(series y, list X, scalar order) scalar k = nelem(X) list extra = null list dX = diff(X) loop foreach i dX --quiet loop for j=1..order --quiet extra += $i(-j) extra += $i(+j) end loop end loop ols y X dX extra --robust --quiet b = {1} | -$coeff[1:k] bs = $coeff[1:k] ~ $stderr[1:k] vn = varname(X) printf "\n-------------- DOLS ESTIMATION --------------\n" modprint bs vn return b end function open hamilton.gdt --quiet # log of US price level genr p = 100*(log(PZUNEW)-log(PZUNEW[1973:01])) # log of exchange rate genr s = -100*(log(EXRITL)-log(EXRITL[1973:01])) # log of Italian price level genr pf = 100*(log(PC6IT)-log(PC6IT[1973:01])) # Set the sample period used by Hamilton smpl 1974:2 ; # Estimate VECM: lag order 12, cointegration rank 1 Hamilton <- vecm 12 1 p s pf --quiet # Estimate cointegration relationship via DOLS list X = s pf beta_dols = dols(p, X, 12) print beta_dols </hansl> ------------------------------------------------------- Riccardo (Jack) Lucchetti Dipartimento di Scienze Economiche e Sociali (DiSES) Università Politecnica delle Marche (formerly known as Università di Ancona) r.lucchetti(a)univpm.it http://www2.econ.univpm.it/servizi/hpp/lucchetti -------------------------------------------------------