On Mon, 19 Oct 2009, Francisco Sosa wrote:

> >> Thank you very much Allin, but I still have another question, do
> >> you apply a small sample correction or something else? Because I
> >> tried to double check this formula and is not the same, in my
> >> sample I only have 7 years, let me show some of my numbers...
> >
> >If you want a definitive answer to this, please send me the
> >dataset and script that you are using, so I can see exactly where
> >your numbers are coming from.
>
> I have attached some files to this e-mail, please let me know if you can't
> see them. In the .ppt file I explain how I do the calculations.

OK, I see: your model has an AR(1) specification for the dependent
variable as well as an AR(1) for the error term via Prais-Winsten.
So then the formula I gave does not apply.  Here is how to
replicate the forecast standard errors given by gretl.

<script>
open Global_Sales_Beer.gdt
genr y = Global_Sales
ar1 y 0 y(-1) --pwe
S2 = $sigma^2
beta = $coeff[2]
rho = $rho
psi = rho + beta
addobs 1
smpl 2007 2009
fcast
series fcerr = $fcerr
scalar sum_psi_sq = 1
scalar k = 1
loop i=2007..2009 -q
  scalar err = sqrt(sum_psi_sq * S2)
  printf "check: %g - %g = %g\n", fcerr[i], err, fcerr[i] - err
  sum_psi_sq += (psi^k)^2
  k++
endloop
</script>

See Box and Jenkins, Time Series Analysis: Forecasting and
Control, 1976, p. 508, "Program 4", for the general algorithm.

Allin Cottrell


Reply via email to