Create a non linear regression series

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
browner90
Posts: 1
Joined: Thu Mar 15, 2012 10:20 am

Create a non linear regression series

Unread post by browner90 »

Hi guys,
I have been given 4 equations and have been told i have to generate data for a Garch-m series. I am have a lot of trouble trying to generate this series. The equations i have are:
y_t = 2.0+3.0*x_t+0.8*(h_t)**0.5+e_t,
z_t=%RAN(1) ,
v_t=%RAN(1) ,
x_t=1.0+0.6*x_t-1+z_t ,
h_t=1.0+0.4*(e_t-1)**2+0.3*h_t-1
and e_t=v_t*((h_t)**0.5).

So far this is the code i have been working on but it keeps coming up with errors

[

Code: Select all

nonlin alpha0 alpha1 alpha2 alpha3 alpha4 alpha5 alpha6 alpha7 
frml eq1 y =alpha0+(alpha1*x_t)+(alpha2*(h_t)**0.5)+e_t

compute z=%RAN(1)
compute v=%RAN(1)
compute alpha0=2.0
compute alpha1=3.0
compute alpha2=0.8
compute aplha3=1.0
compute alpha4=0.6
compute alpha5=1.0
compute alpha6=0.4
compute alpha7=0.3

compute x_t=alpha3+alpha4*(x_t-1)+z_t
compute h_t=alpha5+alpha6*(e_t-1)**2+alpha7*(h_t-1)
compute e_t=v_t*(h_t)**0.5

nlls(frml = eq1) y_t  1 500 residuals
any help with this would be greatly appreciated.
Cheers
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: Create a non linear regression series

Unread post by moderator »

In terms of what you've already written, assuming z_t, v_t, etc. are supposed to be time series, the problem is that you are using COMPUTE where you should be using SET instead.

COMPUTE is used primarily for scalar and matrix computations, while SET is used when you want to set the values of a series over a range of entries. For example, see page 25 of the Introduction book.

However, because of the recursive relationships (i.e. dependence on lagged variance and residual terms), just doing a sequence of SET instructions is not going to be sufficient. Instead, you'll want to define additional pieces of this as FRMLs so that the data can be generated with the proper dynamics.

See:

http://www.estima.com/forum/viewtopic.php?f=11&t=1024

for a multivariate example. This uses GSET since it sets arrays of series. For a univariate case, you can either just use the same approach with a dimension of 1, or rewrite using SET instructions and regular series rather than arrays of series.

Regards,
Tom Maycock
Post Reply