Threshold AR Models

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

donihue
Posts: 135
Joined: Wed Oct 07, 2009 8:51 am

Threshold AR Models

Postby donihue » Sat Feb 12, 2011 2:33 am

Hello,

Threshold AR (TAR) models such as STAR, LSTAR, SETAR and so on can be estimated in programmes like RATS, but I have not seen any commands or programmes to do so in EViews.

Does anyone have any experience in estimating Threshold AR (TAR) models in EViews?

Regards
Donihue

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

Re: Threshold AR Models

Postby trubador » Mon Feb 14, 2011 12:38 am

You can easily estimate TAR models in EViews via LogL object...

donihue
Posts: 135
Joined: Wed Oct 07, 2009 8:51 am

Re: Threshold AR Models

Postby donihue » Tue Feb 15, 2011 10:27 am

Thank you for your response, Trubador.

I am of course aware that the logl object could be used to set up this type of model. My question was really meant to be more along the lines of "has anyone done it?"

You have already contributed so many useful programmes to this forum, so perhaps you yourself have done so?

Regards
Donihue

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

Re: Threshold AR Models

Postby trubador » Wed Feb 16, 2011 1:20 am

Actually, if you do not have a complex model, you can estimate it with NLS instead of LogL object. Suppose that the data generation process is as follows:

Code: Select all

smpl @first @first
series y = 1
smpl @first+1 @last
y = 2 + 0.85*y(-1) + (3 - 1.5*y(-1))/(1+exp(-15*(y(-1)-6))) + nrnd
smpl @all

Since this model is a simple first order LSTAR model, the estimation can be done via NLS:

Code: Select all

c(2) = 0.5
equation nls.ls y = c(1) + c(2)*y(-1) + (c(3) + c(4)*y(-1))/(1+exp(-c(5)*(y(-1)-c(6))))

Please note that you may need to assign proper starting values for the coefficents prior to estimation in order to ensure the stability of the model. For instance, setting the autoregressive coefficent value, c(2), to something smaller than 1 could ease the convergence.

You can prefer to use log-likelihood estimation for a more general use. The model above can also be estimated via LogL object:

Code: Select all

smpl @first @first
series yf = 1

coef(2) alpha
coef(2) beta
coef(2) theta
coef(1) sig

sig(1) = 1
alpha(2) = 0.5

smpl @all
logl lstar
lstar.append @logl logl
lstar.append yf = alpha(1) + alpha(2)*y(-1) + (beta(1) + beta(2)*y(-1))/(1+exp(-theta(1)*(y(-1)-theta(2))))
lstar.append res = y - yf
lstar.append var = sig(1)^2
lstar.append z = res/@sqrt(var)
lstar.append logl =  log(@dnorm(z)) - log(var)/2

smpl @first+1 @last
lstar.ml(showopts, m=1000, c=1e-5)
show lstar.output

smpl @all

If you encounter any convergence problems, try to assign different starting values to estimated parameters. You should always be careful about the initial conditions when you are dealing with nonlinear models...

donihue
Posts: 135
Joined: Wed Oct 07, 2009 8:51 am

Re: Threshold AR Models

Postby donihue » Wed Feb 16, 2011 10:34 am

Thank you very much, Trubador!

As always, you are remarkably swift and thoughtful. Many of us with limited programming skills are heavily in your debt, not just for this, but for the many other programmes you have contributed.

Regards
Donihue

student
Posts: 2
Joined: Wed Feb 16, 2011 12:56 pm

Re: Threshold AR Models

Postby student » Mon Feb 21, 2011 10:48 am

Hello,
Thank you very much for your answer I dound it really useful, although not everything is clear for me, can I use nls to estimate unemployment rate as a dependant and gdp as a independent variable? Also what c(1), c(2) ..., c(6) stands for? I am a new user of eviews and also new to STAR models, so will highly appreciate your help,

Thanks,
Student

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

Re: Threshold AR Models

Postby trubador » Tue Feb 22, 2011 1:30 am

STAR models can be applied to many cases as long as the underlying relationship is assumed/verified to be nonlinear. You can find detailed explanation on STAR models in many econometrics textbooks.
c(.)'s are coefficients to be estimated. After the estimation EViews stores their values into a coefficent vector called c, which you can see in the workfile. For a good introduction to EViews, you can start from here: http://www.eviews.com/illustrated/illustrated.html and continue with the user's manual.

student
Posts: 2
Joined: Wed Feb 16, 2011 12:56 pm

Re: Threshold AR Models

Postby student » Thu Feb 24, 2011 11:02 am

Thank you once again for your help.

Could you please tell me how to expand above logl model to two variable case?
I have tried
two include it in a following way:
lstar.append yf = alpha(1) + alpha(2)*y(-1) + (beta(1) +
beta(2)*y(-1))/(1+exp(-theta(1)*(x(-1)-theta(2))))

but it does not work as it states there is a missing value in
smpl @first+1 @last
lstar.ml(showopts, m=1000, c=1e-5)
show lstar.output

Once again will highly appreciate your help,

Many thanks,
Student

anais
Posts: 2
Joined: Mon Jul 16, 2012 6:18 am

Re: Threshold AR Models

Postby anais » Mon Jul 16, 2012 6:25 am

Hello,

I would like to estimate a SETAR model, but I don't know how to estimate it with Eviews.

Can someone help me to find some procedure for this type of model?

Thanks,

nzarra
Posts: 3
Joined: Mon Aug 06, 2012 5:43 am

Re: Threshold AR Models

Postby nzarra » Mon Aug 06, 2012 5:53 am

im doing my dissertation on PPP and urgently need the codes to run three-regim TAR(1) model. btw i got three variables.
does anyone know the commands?

thanks in advance

icprag
Posts: 6
Joined: Wed Jul 25, 2012 9:06 am

Re: Threshold AR Models

Postby icprag » Tue Feb 12, 2013 12:15 am

[quote="trubador"]Actually, if you do not have a complex model, you can estimate it with NLS instead of LogL object. Suppose that the data generation process is as follows:

Code: Select all

smpl @first @first
series y = 1
smpl @first+1 @last
y = 2 + 0.85*y(-1) + (3 - 1.5*y(-1))/(1+exp(-15*(y(-1)-6))) + nrnd
smpl @all

Since this model is a simple first order LSTAR model, the estimation can be done via NLS:

Code: Select all

c(2) = 0.5
equation nls.ls y = c(1) + c(2)*y(-1) + (c(3) + c(4)*y(-1))/(1+exp(-c(5)*(y(-1)-c(6))))

Please note that you may need to assign proper starting values for the coefficents prior to estimation in order to ensure the stability of the model. For instance, setting the autoregressive coefficent value, c(2), to something smaller than 1 could ease the convergence.

You can prefer to use log-likelihood estimation for a more general use. The model above can also be estimated via LogL object:
[code]smpl @first @first
series yf = 1


Hi! please allow me a naive question. Although i've understood how logL works, i cannot figure out what "series y=1" stands for

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

Re: Threshold AR Models

Postby trubador » Tue Feb 12, 2013 3:33 am

It is necessary for initialization, which you would experience a "missing value (NA)" problem otherwise. Note that the equation includes the first lag of dependent variable and the estimation period starts from the second observation...

icprag
Posts: 6
Joined: Wed Jul 25, 2012 9:06 am

Re: Threshold AR Models

Postby icprag » Tue Feb 12, 2013 5:42 am

Dear Trubador,

thank you for your directe response. It is clear now.

Please let me one more question. I wrote down this in the Logl object and when i try to estimate it, it responds as "Syntax error in smpl @first @first"

Could you please help me?

smpl @first @first
series fedratef=1

coef(4) alpha
coef(4) beta
coef(2) theta
coef(1) sig

sig(1) = 1
alpha(4) = 0.5
beta(4)=0.5
theta(2)=3

smpl @all
logl lstar
lstar.append @logl logl
lstar.append fedratef = alpha(1) + alpha(2)*coreinfl(12) + alpha(3)*outputgap(3)+ alpha(4)*fedrate(-1) +(beta(1)+beta(2)*coreinfl(12)+beta(3)*outputgap(3)+beta(4)*fedrate(-1))*(1-@exp(-theta(1)*(coreinfl(-1)-theta(2))^2))
lstar.append res = fedrate - fedratef
lstar.append var = sig(1)^2
lstar.append z = res/@sqrt(var)
lstar.append logl = log(@dnorm(z)) - log(var)/2

smpl @first+1 @last
lstar.ml(showopts, m=1000, c=1e-5)
show lstar.output

smpl @all

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

Re: Threshold AR Models

Postby EViews Gareth » Tue Feb 12, 2013 7:16 am

You need to put all that in a program.
Follow us on Twitter @IHSEViews

irfan alam
Posts: 3
Joined: Sat Oct 21, 2017 3:01 am

Re: Threshold AR Models

Postby irfan alam » Mon Nov 20, 2017 12:46 am

I need your guidance regarding Threshold autoregressive model in eview.
My course of research is dependent variable "Real effective exchange rate"and follow a list of independent variables such as "Debt to Gdp, Nfa etc. and my data consist of 8 countries during the period of 2001 to 2016. I want to know that who can i estimate TAR model in eviews.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 24 guests