Threshold AR Models
Moderators: EViews Gareth, EViews Moderator
Threshold AR Models
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
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
Re: Threshold AR Models
You can easily estimate TAR models in EViews via LogL object...
Re: Threshold AR Models
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
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
Re: Threshold AR Models
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:
Since this model is a simple first order LSTAR model, the estimation can be done via NLS:
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 loglikelihood estimation for a more general use. The model above can also be estimated via LogL object:
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...
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 loglikelihood 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=1e5)
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...
Re: Threshold AR Models
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
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
Re: Threshold AR Models
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
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
Re: Threshold AR Models
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.
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.
Re: Threshold AR Models
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=1e5)
show lstar.output
Once again will highly appreciate your help,
Many thanks,
Student
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=1e5)
show lstar.output
Once again will highly appreciate your help,
Many thanks,
Student
Re: Threshold AR Models
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,
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,
Re: Threshold AR Models
im doing my dissertation on PPP and urgently need the codes to run threeregim TAR(1) model. btw i got three variables.
does anyone know the commands?
thanks in advance
does anyone know the commands?
thanks in advance
Re: Threshold AR Models
[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:
Since this model is a simple first order LSTAR model, the estimation can be done via NLS:
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 loglikelihood 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
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 loglikelihood 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
Re: Threshold AR Models
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...
Re: Threshold AR Models
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=1e5)
show lstar.output
smpl @all
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=1e5)
show lstar.output
smpl @all

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

 Posts: 3
 Joined: Sat Oct 21, 2017 3:01 am
Re: Threshold AR Models
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.
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.
Who is online
Users browsing this forum: No registered users and 14 guests