Error message while performing MLE

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Zappa_F
Posts: 14
Joined: Wed Sep 28, 2011 5:27 am

Error message while performing MLE

Postby Zappa_F » Mon Oct 31, 2011 6:40 am

Hello.

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
As %0 I want to use a Dow Jones Industrial Average series starting from 01/04/1960 until 10/27/2011. Each time I want to run the program, though, Eviews tells me:

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Error message while performing MLE

Postby EViews Gareth » Mon Oct 31, 2011 7:42 am

More likely sig2 goes negative, then you take the log of it.

Zappa_F
Posts: 14
Joined: Wed Sep 28, 2011 5:27 am

Negative sig2

Postby Zappa_F » Wed Nov 02, 2011 1:42 am

Hi Gareth,

thank's for your thoughts on this so far. I took the absolute value of sig2

Code: Select all

ll1.append loglf = -0.5 * log(2*3.14) - 0.5 * log(@abs(sig2)) -0.5 * res^2 / @abs(sig2)
But still the same error message pops up...

If I wanted to take only the second until last observation of x, what command would I have to use? I'm asking because the first entry in x is a "NA". I still believe that this causes the problem...

Felix

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Error message while performing MLE

Postby EViews Gareth » Wed Nov 02, 2011 8:09 am

Set the workfile sample prior to estimating.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests