On Wed, 17 Feb 2010, Sylvain Petit wrote:
I want to estimate a distributed lag model by using the Almon
polynomial. Is it possible to use this method with Gretl ? And
if yes, how ?
It's not a built-in routine, but yes, it is possible. In the
sample script below I use the notation from the account of the
Almon polynomial method given by D.S.G. Pollock, at
http://webspace.qmul.ac.uk/dsgpollock/public_html/courses/mesomet/topics/...
The example is bracketed by the tags <script> and </script>, which
are not themselves part of the gretl script.
<script>
open data3-6.gdt
series x = Yt # independent variable: income
scalar k = 5 # maximum lag length
scalar q = 2 # order of Almon polynomial
# form the variables z_0 to z_q
loop j=0..q --quiet
series z_$j = 0
loop i=0..k --quiet
z_$j += (i^j) * x(-$i)
endloop
endloop
# regress the dependent variable on the z's and
# retrieve the coefficients on the z's as gamma
ols Ct 0 z_*
matrix gamma = $coeff[2:]
print gamma
# recover and print the constrained betas
matrix beta = zeros(k+1,1)
loop i=0..k --quiet
loop j=0..q --quiet
beta[i+1] += gamma[j+1] * i^j
endloop
endloop
print beta
</script>
Allin Cottrell