Constraint on dependent variable in log-likelihood estimatio

For questions regarding programming in the EViews programming language.

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

rui.ascenso
Posts: 1
Joined: Fri Jan 02, 2015 1:46 pm

Constraint on dependent variable in log-likelihood estimatio

Postby rui.ascenso » Fri Jan 02, 2015 2:03 pm

Hi!
I was computing a garch-in-mean model, so I have 2 equations: one for mean to obtain residuals (res) and another for variance (sig2).
The problem is that the model computes negative variance at some points and therefore I cannot take a square root of it.
So my question is how to put a non-negative constraint on the sig2 variable which is dependent.
Anyone knows? Thanks!

Here´s the part of the code I am using:

Code: Select all

logl ll4 ll4.append @logl logl ll4.append sig2 = omega(1)+alpha(1)*res(-1)^2 +alpha2(1)*res(-1)^2*dummyshocks(-1)+beta(1)*sig2(-1) ll4.append dummyshocks=@recode(res(-1)>0,1,0) ll4.append res = marketVW-exp(mu(1))-param(1)*sig2-param(2)*dummysentiment-param(3)*dummysentiment*sig2 ll4.append z = res/@sqrt(sig2) ll4.append logl = log(@dnorm(z)) - log(sig2)/2 ' estimate and display results ll4.ml(showopts, m=1000, c=1e-5) show ll4.output

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Constraint on dependent variable in log-likelihood estim

Postby trubador » Mon Jan 05, 2015 1:04 am

You can find plenty of examples if you search the forum. It is hard to say which one will be useful in your case without seeing your data.

strypste
Posts: 53
Joined: Tue Jan 24, 2012 8:54 am

Re: Constraint on dependent variable in log-likelihood estim

Postby strypste » Thu Apr 30, 2015 4:09 am

Hi Trubador

I have looked on the forum, but did not find anything about constraining a dependent variable such as the variance in a GARCH-M model.

Would it be possible to point us in the good direction?

Cheers
S

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Constraint on dependent variable in log-likelihood estim

Postby trubador » Thu Apr 30, 2015 12:28 pm

In my response to the original post, I did mean searching for examples of maximum likelihood estimation via LogL object in general and GARCH/GARCH-M models in particular.

You are referring to a more general problem. Since EViews does not have any constrained optimization routine, you have to find a workaround for any kind of restriction. And it probably would require the data, the preferred model and the research question.

strypste
Posts: 53
Joined: Tue Jan 24, 2012 8:54 am

Re: Constraint on dependent variable in log-likelihood estim

Postby strypste » Tue May 05, 2015 7:29 am

I tried a number of things (using @recode, if structure...), but unsuccessful :(

So my problem occurs when I want to estimate up to an ARCH(6) model with output growth data. My program first estimates an ARCH(1), then an ARCH(2)... When it wants to estimate the ARCH(5) model then it breaks down. The program breaks down because the variance becomes negative and so it is impossible to calculate log1.

I have the following set up of the logl object (assuming an ARCH(5) model):

Code: Select all

logl model model.append @logl logl1 model.append var = alpha0_u(1) "+ eta1_u(1)*res(-1)^2 + eta2_u(1)*res(-2)^2 + eta3_u(1)*res(-3)^2 + eta4_u(1)*res(-4)^2 + eta5_u(1)*res(-5)^2 model.append res = g_{%country} - c0_u(1) model.append logl1 = -(1/2)*@log(2*@acos(-1))-(1/2)*@log(var)-(1/(2*(var)))*res^2 ' Normal distribution
What could be a workaround for this particular problem? It would be great that the program discards models where the variance becomes negative. For example it gives the output for ARCH(1)-ARCH(4), discards ARCH(5) because of negative variance and gives output for ARCH(6) (provided the variance is positive).

Any help would be much appreciated!

Best
s


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests