I am trying to estimate a simple GARCH(1,1) with maximum likelihood. My code is:
Code: Select all
%daily = "test"
!obs = @val(%1)
pageselect {%daily}
genr y = {%0}
genr x = dlog(y)
'######################################
param c(1) 0 c(2) 0.1 c(3) 0.8 c(4) 10
logl ll1
ll1.append @logl loglf
ll1.append res = x - c(1)
ll1.append sig2 = @nan ( c(4) / (1 - c(1) - c(2)) + c(2) * res(-1)^2 + c(3) * sig2(-1) , 0.1)
ll1.append loglf = -0.5 * log(2*3.14) - 0.5 * log(sig2) -0.5 * res^2 / sig2
ll1.ml(showopts)
show ll1.output
Missing values in @LOGL series at current coefficient at observation 01/04/1960 in “DO_LL1.ML(showopts)"
Well, as far as I believe the Problem is that for the first observation x = NA. Therefore I took the @nan command in front of the sig2 equation. But it still doesn't work.
What is wrong with my code?
Cheers,
Felix
