On Thu, 7 Jun 2007, Chris wrote:
Hi,
The actual model isn't just based on the Y variable, it's of the form y = B1
+ B2*X2 + B3*X3 . in your example you seem to generate only a Y variable and
doing everything with the Y variable. I think the major problem here is I
may not be understanding what I'm doing;) in gretl, when you run an arima
model it estimates a bunch of stuff (the arima process) and then estimates
the betas on your other explanatory variables. The same happens when you
estimate a garch process. The output for the script only generates estimates
of the arma process variables and the garch process variables. I'm trying to
figure out how to estimate the coefficients on the other explanatory
variables as well...
That's easy-peasy: when you compute the forecast errors e, just subtract
from y the conditional mean too; clearly, you'll need to include the
regressors as additional parameters to the function, as in
function filter(series y, series x, \
scalar b, scalar arpar, scalar mapar, \
scalar om, scalar alpha, scalar beta, \
series *e, series *h)
scalar err = 0
scalar T = $nobs
series e = 0
series h = om/(1-alpha-beta)
loop for i=2..T --quiet
scalar e2lag = e[i-1]^2
# note the change here
e[i] = y[i] - (x[i]*b + arpar*y[i-1] + mapar*e[i-1])
h[i] = om + alpha*e2lag + beta*h[i-1]
end loop
return scalar err
end function
Better still, you may want to specify x as a list (or a matrix) and b as a
vector.
Maybe it's time to get hold of a good econometrics textbook? ;-)
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti