Balke(2000) Threshold VAR

Use this forum for posting example programs or short bits of sample code.
applej
Posts: 20
Joined: Thu May 14, 2015 9:17 am

Re: Balke(2000) Threshold VAR

Unread post by applej »

Hi, Tom,
I got the upper and lower regime covariance\correlation matrices. I want to put it in my paper to demonstrate regime difference. However, almost all covariance pair show zeors, which does not show regime-distinctive enough. Does that look acceptable? Or, how can I increase the decimals in the matrices ?
Thank you,
J
Attachments
tvar_vcv.JPG
tvar_vcv.JPG (120.35 KiB) Viewed 22421 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

If you're using logged variables, the simplest solution is to switch to 100*log's which will shift the scale on the variances by 10^4. However, you can reformat the existing numbers by using Window-Report Windows to reload the report, and then View-Change Layout.
stan076
Posts: 9
Joined: Mon Mar 27, 2017 10:37 pm

Re: Balke(2000) Threshold VAR

Unread post by stan076 »

Dear TomDoan

I have a question. Let say I take V as my threshold variable, since its level has a unit root, I decide to take first difference of V, as denoted by DV. I then take the absolute value of DV and name it as AV.

In this case, the threshold variable is in fact AV, but the variable that should enter the VAR model is DV.

So I just replace the threshold variable 'credit' as 'AV' in your tvar_estimate.rpf and tvar_irf.rpf, but for the VAR system, I put DV as dependent variable.

Is that all I need to do? Will I run into any potential problem for doing so?

Thanks.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

I'm a bit confused. The threshold variable should be whatever you think triggers the change in regime---if it has a unit root, it has a unit root. The estimation itself only requires that you are able to compute the threshold variable so in that sense it doesn't matter how it relates to the actual data. Where that matters is when try to do impulse responses since that has to include an identity for defining the threshold based upon the simulated data.
applej
Posts: 20
Joined: Thu May 14, 2015 9:17 am

Re: Balke(2000) Threshold VAR

Unread post by applej »

Hi, Tom,
I got another question about Covariance\Correlation Matrix. I'm not sure whether what I got looks right. I have five series in percent.
five_series.JPG
five_series.JPG (89.3 KiB) Viewed 22343 times
After estimation, their vcv in upper, lower and linear,regimes:
vcv
vcv
vcv.JPG (145.09 KiB) Viewed 22343 times

Does it seem right in terms of magnitudes?

Thank you,
J
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

Obviously a .00004 correlation is really small, but if you look at all three correlations for that pair, they're effectively zero so it may be a bit of a fluke, but isn't unreasonable.
applej
Posts: 20
Joined: Thu May 14, 2015 9:17 am

Re: Balke(2000) Threshold VAR

Unread post by applej »

TomDoan wrote:Obviously a .00004 correlation is really small, but if you look at all three correlations for that pair, they're effectively zero so it may be a bit of a fluke, but isn't unreasonable.
Thank you. Is the "7014" co-variance/variance ok? :roll:
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

Why wouldn't it be? This is your model and your data---it looks like a noisy series and the three values for that 1st variable variance are all relatively similar, so I'm not sure what you think is the problem.
applej
Posts: 20
Joined: Thu May 14, 2015 9:17 am

Re: Balke(2000) Threshold VAR

Unread post by applej »

TomDoan wrote:Why wouldn't it be? This is your model and your data---it looks like a noisy series and the three values for that 1st variable variance are all relatively similar, so I'm not sure what you think is the problem.
Thanks. It's just too large. But I think the calculation is right.(It's real oil return. )
yizhuorui
Posts: 8
Joined: Tue Aug 23, 2016 4:17 am

Re: Balke(2000) Threshold VAR

Unread post by yizhuorui »

Dear tom,
my modified nonlinear impulse response of Balke(2000) runs OK,but i find the IRFs lacks of confidence interval, so i wonder if there is a way to construct the confidence interval or regarding code?
Best Regards,
Zhuorui YI
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

The IRF's themselves are generated as the mean of a double bootstrap. I haven't seen anyone describe how to do confidence bands on those.
yizhuorui
Posts: 8
Joined: Tue Aug 23, 2016 4:17 am

Re: Balke(2000) Threshold VAR

Unread post by yizhuorui »

Dear tom,
i am confused about the following code:

set fiddlef = %ran(1.0)
do i=1,%nvar
set fiddled(i) = fiddlef*u(i)
end do i
why do you multiply fiddlef by u(i)?
thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

That's part of the fixed regressor bootstrap. If you want to understand that better, you'll have to read Hansen's paper or get the 2nd edition of the Structural Breaks and Switching Models course, which covers that.
Jules89
Posts: 140
Joined: Thu Jul 14, 2016 5:32 am

Re: Balke(2000) Threshold VAR

Unread post by Jules89 »

Dear Tom,

I have two questions related to the Balke IRF code:

First:

what does the "&" infromt of the loop index ("i") within the following loop do?

do i=1,nvar
frml tvarf(i) depvars(i) = %if(thrfrml{d}>thresh,$
fitud(&i,1)+%dot(%xrow(sup,&i),bootres),$
fitud(&i,2)+%dot(%xrow(sdn,&i),bootres))
end do i


Second:

Within the bootstrap, when the residals are drawn from their empirical distribution (gset bootuv wstart wend = %if(%ranflip(.5),+1,-1)*stdu(rentries(t))), why do we need this factor %if(%ranflip(.5),+1,-1)? It draws from a binominal a 1 or a -1 both with probability 0.5. Why do we need this random sign flip of the residual draws?


Thanks

Best Jules
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Balke(2000) Threshold VAR

Unread post by TomDoan »

Jules89 wrote:Dear Tom,

I have two questions related to the Balke IRF code:

First:

what does the "&" infromt of the loop index ("i") within the following loop do?

do i=1,nvar
frml tvarf(i) depvars(i) = %if(thrfrml{d}>thresh,$
fitud(&i,1)+%dot(%xrow(sup,&i),bootres),$
fitud(&i,2)+%dot(%xrow(sdn,&i),bootres))
end do i
See Defining FRML's in a loop. It forces the I references to be resolved immediately, while the FRML's are being defined.
Jules89 wrote: Second:

Within the bootstrap, when the residals are drawn from their empirical distribution (gset bootuv wstart wend = %if(%ranflip(.5),+1,-1)*stdu(rentries(t))), why do we need this factor %if(%ranflip(.5),+1,-1)? It draws from a binominal a 1 or a -1 both with probability 0.5. Why do we need this random sign flip of the residual draws?
We don't need to do the random sign flip. That's a simple case of a wild bootstrap, which adjusts the raw residuals to produce a set which has particular properties---symmetry in this case.
Post Reply