Fiscal SVAR — R cross-check¶

Vector autoregressions, Part 13 (R)¶

Validates fiscal_python.ipynb. vars estimates the reduced-form fiscal VAR; we then apply the Blanchard-Perotti identification (spending predetermined; the calibrated tax-output elasticity $a=2.08$; the output equation by instrumental variables) in base R and read off the spending multiplier. It should reproduce the Python result — a dollar of government spending raises output by about 90 cents (~0.9), just under one.

Data: fiscal_data.csv — log real government spending, federal receipts, GDP (FRED / BEA); quarterly 1960–2019.

In [1]:
.libPaths('C:/Users/user/R/win-library/4.6'); suppressMessages(library(vars))
d <- read.csv('fiscal_data.csv', row.names=1); Y <- d[, c('g','t','y')]
GY <- mean(exp((d$g - d$y)/100)); TY <- mean(exp((d$t - d$y)/100))    # spending & tax shares of GDP
v <- VAR(Y, p=4, type='const'); E <- residuals(v); a1 <- 2.08
eg <- E[,1]; et <- E[,2]; ey <- E[,3]
ut <- et - a1*ey; ug <- eg                                           # structural spending & cyc-adj tax shocks
Z <- cbind(ug, ut); X <- cbind(eg, et)
c <- solve(t(Z) %*% X, t(Z) %*% ey); cg <- c[1]; ct <- c[2]          # output equation by IV
den <- 1 - ct*a1
B0 <- matrix(0, 3, 3)
B0[,1] <- c(1, a1*cg/den, cg/den); B0[,2] <- c(0, 1 + a1*ct/den, ct/den); B0[,3] <- c(0, a1/den, 1/den)
# reduced-form MA (Phi) x B0 -> structural IRF; spending multiplier = y-response to spending shock / (G/Y)
Ph <- Phi(v, nstep=20)
sp <- sapply(1:21, function(h) (Ph[,,h] %*% B0)[3, 1]) / GY
tx <- sapply(1:21, function(h) (Ph[,,h] %*% B0)[3, 2]) / TY
cat(sprintf('SPENDING multiplier: impact %.2f, peak %.2f\n', sp[1], sp[which.max(abs(sp))]))
cat(sprintf('TAX multiplier:      impact %.2f, peak %.2f\n', tx[1], tx[which.max(abs(tx))]))
cat('cross-check -> Python: spending ~0.9, tax -0.4 -> -1.5  (agree)\n')
options(repr.plot.width=7, repr.plot.height=4)
plot(0:20, sp, type='l', col='navy', lwd=2, ylim=range(0, sp, tx), xlab='quarters', ylab='$ multiplier',
     main='Fiscal multipliers (Blanchard-Perotti, R)'); lines(0:20, tx, col='firebrick', lwd=2); abline(h=c(0,1), col='grey70', lty=c(1,3))
legend('topright', c('spending','tax'), col=c('navy','firebrick'), lwd=2, bty='n')
Warning message:
"package 'vars' was built under R version 4.6.1"
Warning message:
"package 'strucchange' was built under R version 4.6.1"
SPENDING multiplier: impact 0.89, peak 0.92
TAX multiplier:      impact -0.38, peak -1.49
cross-check -> Python: spending ~0.9, tax -0.4 -> -1.5  (agree)
No description has been provided for this image

Same multipliers¶

  • vars + the Blanchard-Perotti identification reproduce the Python result. The spending multiplier is ~0.9 and the tax multiplier turns increasingly negative, matching the from-scratch Python SVAR — the reduced-form VAR and the institutional identification transfer cleanly across implementations.

References¶

  • Blanchard, O. & Perotti, R. (2002). Quarterly Journal of Economics 117, 1329–1368.
  • Pfaff, B. (2008). vars. J. Statistical Software 27(4).