Dear All,
I would like to use the package "vars" to get a impulse response
function of
a Structural VAR model.
However, I got a wrong message and cannot deal with it.
Here is my code:
>library(vars)
>
>data <- read.table("data.txt", header=T)
>y1 <-
data[,c("log_x1","log_x2","log_x3","log_x4","log_x5","log_x6")]
>
>var01 <- VAR(y1, p=3)
>
>A <-
as.matrix(rbind(c(NA,0,0,0,0,0),c(NA,NA,0,0,0,0),c(0,0,NA,0,0,0),c(NA,0,NA,NA,0,0),c(NA,NA,NA,0,NA,NA),c(NA,NA,NA,NA,0,NA)))>B <-
as.matrix(rbind(c(NA,0,0,0,0,0),c(0,NA,0,0,0,0),c(0,0,NA,0,0,0),c(0,0,0,NA,0,0),c(0,0,0,0,NA,0),c(0,0,0,0,0,NA)))>
>svar01 <- SVAR(var01,estmethod="scoring", Amat=A ,Bmat=B)
>
>svar01.irf <- irf(svar01, response="log_x3", n.ahead=24)
But here is the error message:
`diag<-`(`*tmp*`, value = 1) :
only matrix diagonals can be replaced
So I cannot get the impulse response function of this S-VAR model.
How should I deal with it?
Many thanks for your time and help!
Chu, Hao-pang
97258031 at nccu.edu.tw
--
View this message in context:
http://r.789695.n4.nabble.com/A-problem-of-impulse-response-function-about-S-VAR-tp4642990.html
Sent from the R help mailing list archive at Nabble.com.