library(tsDyn) library(tvarGIRF) library(readxl) #read the whole sample data data1 <- read_excel("C:/Users/Desktop/data1.xlsx") #select the external trasition variable MA2_Paper.Bill tvn<-data1$MA2_Paper_Bill #estimate the threshold value # the VAR equations consist only of variable Output,Price,Fed Funds,Paper-Bill and their lagged variable res1 <- TVAR(data1[c(1:4)], lag=2, nthresh=2, thDelay=1, thVar = tvn, plot=FALSE) # select variable price as the shock shock<-rep(0,4) shock[2]<-1 #Generalised impulse response function for a threshold VAR girfs <- GIRF(res1,shock,horizon = 10, H = 10, R = 50, restrict.to = NA)