On Wed, 4 Mar 2009, Stephen Motluk wrote:
I cannot seem to reproduce the predicted values GRETL calculates
from the estimated parameters from the pwe procedure. Can anyone
describe to me how GRETL is calculating the y-hat for the
in-sample predicted values from the pwe procedure? Any help is
much apprecated. Thanks.
Here's an example.
<script>
open data9-7
list XL = 0 PRICE INCOME PRIME
matrix X = { XL }
# get PWE estimates
ar1 QNC XL --pwe
# save various things
uh1 = $uhat
yh1 = $yhat
scalar r = $rho
matrix b = $coeff
# series for manual computations
series uh2
series yh2
# PWE special for first obs
scalar pw1 = sqrt(1.0 - r * r)
scalar T = $T
scalar et
loop i=1..T --quiet
if (i == 1)
et = pw1 * (QNC[i] - X[i,] * b)
else
et = QNC[i] - r * QNC[i-1]
et -= (X[i,] - r * X[i-1,]) * b
endif
uh2[i] = et;
yh2[i] = QNC[i] - et;
endloop
# compare automatic and manual values
print QNC yh1 yh2 uh1 uh2 --byobs
</script>
Allin Cottrell