Page 3 of 7

Re: Balke(2000) Threshold VAR

Posted: Tue Sep 13, 2016 11:02 am
by TomDoan
You can't have D=0---that makes a circular definition of the threshold.

The "location" doesn't really help much. You can do the "Edit-Show Last Error" to point to the loop that causes the problem, then find the line number within that.

Re: Balke(2000) Threshold VAR

Posted: Tue Sep 13, 2016 4:10 pm
by applej
TomDoan wrote:You can't have D=0---that makes a circular definition of the threshold.

The "location" doesn't really help much. You can do the "Edit-Show Last Error" to point to the loop that causes the problem, then find the line number within that.
Oh, it's good to know ! Thank you so much for examining the details. If lag=3 in VAR, does that mean threshold delay must >3, or just 1 or 2 would also workable? No problem, I am just thinking about that. I'll try this!

Re: Balke(2000) Threshold VAR

Posted: Tue Sep 13, 2016 8:03 pm
by TomDoan
It just has to be >0 (i.e. predetermined). d=0 means the threshold depends upon the current value and the current value depends upon the threshold. That's what creates the circularity so you can't solve the system.

Re: Balke(2000) Threshold VAR

Posted: Sat Sep 17, 2016 2:07 pm
by applej
TomDoan wrote:It just has to be >0 (i.e. predetermined). d=0 means the threshold depends upon the current value and the current value depends upon the threshold. That's what creates the circularity so you can't solve the system.
Dear Tom,
Thank you so much for explaining it again. It works well now after I set d=1, though lags=3.
Yet, it seems I come to another question: How I can bookkeeping the ndraws of GIRF(1)(5,1) ? Here is my explanation:
-I suppose, in current program, for "GIRF(1)(5,1) " means for+1SD shock on var1, the responses of var5.
-I want to make confidence band for this simulated series.
-In order to do so, I suppose I would need something like :

Code: Select all

dec vect[seires] GIRFall(ndraws) 
do time =istart, iend 
ewise GIRFall(i) = GIRF(ndraws)(1)(5,1) (time+1-istart)
compute  ff=%fractiles( GIRFall, || 0.16, 0.5, 0.84|| )
compute lower(t) = ff(1)
compute upper(t)= ff(3)
compute median(t) = ff(2)
end do time
- I wonder how can I get the GIRF(ndraws)(1)(5,1) from the current program?

Code: Select all


infobox(action=define,lower=1,upper=nrep,progress) "Bootstrapping Across Initial Values"
do jrep=1,nrep
   infobox(current=jrep)
   *
   * Copy observed data into depvar slots
   *
   compute basedate=rdates(jrep)
   do i=1,nvar
      set depvars(i) wstart-maxlag wstart-1 = data(i)(t-wstart+basedate)
   end do i
   *
   * Loop over bootstrap replications
   *
   do krep=1,nkrep
      *
      * Generate the bootstrap shuffle
      *
      boot rentries wstart wend rstart rend
      *
      * Generate the base set of shocks by premultiplying the
      * bootstrapped standardized shocks by the factor of the overall
      * covariance matrix.
      *
      gset bootuv wstart wend  = %if(%ranflip(.5),+1,-1)*stdu(rentries(t))
      *
      gset bootres wstart wend = bootuv
      *
      forecast(model=tvar,from=wstart,to=wend,results=base)
      compute ifill=0
      dofor sign = 1 -1
         dofor size = 1 2
            compute ifill=ifill+1
            do jshock=1,nvar
               *
               * Patch over the component for which are computing the
               * response with the selected size and sign.
               *
               compute bootres(wstart)=bootuv(wstart)
               compute bootres(wstart)(jshock)=sign*size
               *
               forecast(model=tvar,from=wstart,to=wend,results=withshock)
               do i=1,nvar
                  [color=#0000FF]set girfs(ifill)(i,jshock) wstart wend = girfs(ifill)(i,jshock)+withshock(i)-base(i)[/color]
               end do i
            end do jshock
         end do sign
      end do size
   end do krep
end do jrep
infobox(action=remove)

The girfs(ifill)(i,jshock) gives me one series not ndraw=1000 series. And the "ifill" seems to be only 1, 2,3 or 4? "ifill" is not the "ndraws", am I right? But I think it should be in somewhere background, but not bookkept, could you show me how?

Please let me know if my question is not clear. Thank you so much if you could help on this part!!
Regards,
J

Re: Balke(2000) Threshold VAR

Posted: Sat Sep 17, 2016 9:51 pm
by applej
Dear Tom,
Following my previous post, I made some efforts in bookkeeping all simulated series for one GIRF series. And I did 1SD shock only.

Code: Select all

* Set up target series. There is one for each combination of test sign
* and sizes on the shock, variable shocked and target variable.
*
*declare real size sign
*compute nexp=%size(shocksizes)*%size(shocksigns)
*display nexp 
compute ndraws=100
dec vect[rect[series]] girfsall(ndraws)
do draw=1,ndraws
   dim girfsall(draw)(nvar,nvar)
   set girfsall(draw)(i,j) = 0.0 
end do i

compute wstart=rstart, wend=rstart+horizon-1

infobox(action=define,lower=1,upper=ndraws,progress) "Bootstrapping Across Initial Values"

do jrep =1,nrep
   infobox(current=jrep)  

   compute basedate = rdates(jrep) 
   do i=1, nvar
   set depvars(i) wstart-maxlag wstart-1 =data(i)(t-wstart+basedate) 
   end do i 
     
    * Loop over bootstrap replications
    * 
      do krep=1, nkrep
        *Generate the bootstrap shuffle 

          boot rentries wstart wend rstart rend

        *Generate the base set of shocks by premultiplying the bootstrapped 
        *standardized shocks by the factor of the overall coveriance. 
            
         gset bootuv wstart wend  = %if(%ranflip(.5),+1,-1)*stdu(rentries(t))
         gset bootres wstart wend = bootuv
         forecast(model=tvar,from=wstart,to=wend,results=base) 
        
         do jshock=1,nvar
            compute bootres(wstart)=bootuv(wstart)
            [color=#0000FF]compute bootres(wstart)(jshock)=1[/color]
         forecast(model=tvar,from=wstart,to=wend,results=withshock)
          do i=1,nvar
           set girfsall(krep)(i,jshock) wstart wend = girfsall(krep)(i,jshock)+withshock(i)-base(i)
          end do i
         end do jshock
  end do krep 
end do jrep 
infobox(action=remove) 
However, I could only get girfsall(1)(i,jshock), i.e. the girf from the first draw.

It would be great to have you pointing out anything wrong.

Thank you,
J.J

Re: Balke(2000) Threshold VAR

Posted: Mon Sep 19, 2016 11:36 am
by TomDoan
I'm not sure what you mean by "confidence band for this simulated series". The point estimates for the non-linear IRF's come from taking the average of the responses over a double loop of draws for initial conditions and bootstrapped residuals. That's necessary because the model is fundamentally non-linear. Other than the central measure (mean in particular), the statistics on those draws don't really have any meaning---they certainly don't correspond at all to the error bands from a linear model.

Re: Balke(2000) Threshold VAR

Posted: Thu Oct 20, 2016 1:47 pm
by applej
Dear Tom,
Another question:
If I set my shock size on var2 equals to 1, by the following code:
compute bootres(wstart)(jshock) = 1
BTW,
-why "1" means 1SD of var2?
-By full sample basic descriptive stat, for the var2, the mean is 0.00 and S.E. is 0.09. Does that mean " 1SD" shock to var2 is 9% increase in var2?

How can I explain the magnitudes of GIRF output?
For example, I got the GIRF of var5 to 1SD shock var2 is
Horizon GIRF
1 0.006
2 0.004
3 0.002
Can I say 1SD shock on var2 cause 0.6% increase on var5, contemporaneously? (Does that mean 9% increase in var2 cause 0.6% increase in var5?)

Thank you,
J.J

Re: Balke(2000) Threshold VAR

Posted: Thu Oct 20, 2016 3:40 pm
by TomDoan
It means 1 s.d. based upon the shocks in that branch of the model. The sample statistics are irrelevant.

You can't scale responses in a non-linear model. That's why 1 s.d. ,-1 s.d., 2 s.d. and -2 s.d. are computed separately.

Re: Balke(2000) Threshold VAR

Posted: Wed Oct 26, 2016 3:46 pm
by Bach
Hi Tom ,
Thanks for sharing the replication materials.

I am running the program using my data. The program appears to working as expected to create the threshold value and the IRF for the upper regime . However when I try to switch the command " comp upper =0" to estimate the lower regime ( i.e., normal regime in the paper of Balke" , I am receiving an error message. Please note that when I reduce my model to 3 var instead of my 4 variable model I do get some IRF plot. I am not sure what is causing that ?
I would appreciate your advice/suggested edits ( I am attaching my programs) .

Thanks in advance

Re: Balke(2000) Threshold VAR

Posted: Wed Oct 26, 2016 6:46 pm
by TomDoan
Your R and INVES series are missing the 2000:3 data point, so your entire range for estimation and bootstrapping needs to be shifted up an entry.

Re: Balke(2000) Threshold VAR

Posted: Sat Oct 29, 2016 12:06 am
by applej
Dear Tom,
I notice in the tvar_estimate.rpf , it is using loglikelihood ratio(LR) test for the non-linearity test and threshold value search. I wonder whether there is existing literature that also follow this approach in this step? I believe it is valid :) , as many other nonlinearity tests and the WALD tests in Balke(2000). I just didn't find others did it, though most use Balke(2000) or Tsay(1989), etc.

Best,
J

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 31, 2016 10:50 am
by TomDoan
I'm very confused about what you're saying. It uses the likelihood ratio, but uses the fixed regressor bootstrap to evaluate the significance level since the standard asymptotics don't apply. The fixed regressor bootstrap is from Bruce Hansen's work, and is used in some of his other papers such as Hansen and Seo(2002), which is also included with RATS (though it's quite a bit different application that the threshold VAR).

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 31, 2016 11:09 am
by Bach
Thanks Tom,
Do I understand correctly that test built into the shared program for the threshold identification has its Ho = "non-linearity assumption" as opposed to Tsay 's H0 = "Linearity".

Thanks

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 31, 2016 11:19 am
by TomDoan
No. The null is linearity (i.e. no threshold).

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 31, 2016 11:27 am
by Bach
Thanks Tom,
In this case, is there a reason why when we run the replication materials for Balke (2000) to estimate threshold test , all values ( Sup, Avg, and EXP) have a P-Value > 0.1 , which I interpret as I can not reject the H0. Am I missing something ?
Thanks