-
Notifications
You must be signed in to change notification settings - Fork 1
/
7VAR.R
39 lines (33 loc) · 1.4 KB
/
7VAR.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
####################################
####################################
###### VECTOR AUTOREGRESSIONS ######
####################################
####################################
library("svars")
var2 = VAR(USA, lag.max=4, ic="SC")
k = ncol(USA)
summary(var2)
# IMPULSE RESPONSE FUNCTIONS
plot(irf(var2, ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9),col=1)
# CUMULATIVE IMPULSE RESPONSE FUNCTIONS
plot(irf(var2, ortho=T,n.ahead=50,cumulative=T,runs=50,ci=0.9),col=1)
# FORECAST ERROR VARIANCE DECOMPOSITION
plot(fevd(var2,ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9))
### STRUCTURAL VAR MONEY MARKET (SUPPLY AND DEMAND SHOCK)
amat = diag(k)
diag(amat) = NA
amat[2, 1] = NA
amat[3, 1] = NA
amat[3, 2] = NA
svar2 = SVAR(x = var2, estmethod = "scoring", Amat = NULL, Bmat = amat,
max.iter = 100, maxls = 1000, conv.crit = 1.0e-8)
summary(svar2) # Interest is only influencing itself in t whereas Real Money Demand is influenced by both in t
plot(irf(svar2, ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9),col=1)
plot(irf(svar2, ortho=T,n.ahead=50,cumulative=T,runs=50,ci=0.9),col=1)
plot(fevd(svar2,ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9))
### BLANCHARD QUAH STRUCTURAL VAR
bq2 = BQ(var2)
plot(irf(bq2, ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9),col=1)
plot(irf(bq2, ortho=T,n.ahead=50,cumulative=T,runs=50,ci=0.9),col=1)
plot(fevd(bq2,ortho=T,n.ahead=50,cumulative=F,runs=50,ci=0.9))
### END