m1m2 = read.table(
"h6hist1.txt",
header=F,
skip=14,
comment.char = '-',
col.names=c('mon','year','m1','m2','m1.raw','m2.raw'),
)
currency = read.table(
"h6hist2.txt",
header=F,
skip=11,
comment.char = '-',
col.names=c('mon','year','currency','checks','deposits','banks','thrift','total'),
)
# Merge the data frames into one
m = merge(m1m2, currency, by=c('mon','year'))
# Grab just the year-on-year changes
yr = subset(m, mon=="Oct")
yr$m1.delta = 100 * c(0,diff(yr$m1)) / yr$m1
yr$m2.delta = 100 * c(0,diff(yr$m2)) / yr$m2
yr$currency.delta = 100 * c(0,diff(yr$currency)) / yr$currency
# Plot the year-on-year change for the three stats
par(family="Times")
plot(
m1.delta ~ year,
data=yr,
ylim=c(-5,15),
type="n",
main="Year-on-year change in the US monetary supply",
xlab="Year",
ylab="Percent change",
bty='n',
las=1
)
grid();
lines(m2.delta ~ year, data=yr, col="red")
lines(m1.delta ~ year, data=yr, col="green")
lines(currency.delta ~ year, data=yr, col="blue")
legend(
"topleft",
c("M2","M1","Currency"),
col=c("red","green","blue"),
bty='n',
lty=1
)
dev.copy(svg, "Changes in US Money supply.svg", width=8, height=6)
dev.off()
par(family="Times")
plot(
m2 ~ year,
data=yr,
type="n",
main="Components of the US monetary supply",
xlab="Year",
ylab="Billions of dollars",
bty='n',
las=1
)
grid();
lines(m2 ~ year, data=yr, col="red")
lines(m1 ~ year, data=yr, col="green")
lines(currency ~ year, data=yr, col="blue")
legend(
"topleft",
c("M2", "M1","Currency"),
col=c("red","green","blue"),
bty='n',
lty=1
)
dev.copy(svg, "Components of US Money supply.svg", width=8, height=6)
dev.off()
par(family="Times")
plot(
m2 ~ year,
data=yr,
type="n",
main="Components of the US monetary supply",
xlab="Year",
ylab="Billions of dollars",
bty='n',
las=1,
log="y",
ylim=c(10,10000)
)
grid();
lines(m2 ~ year, data=yr, col="red")
lines(m1 ~ year, data=yr, col="green")
lines(currency ~ year, data=yr, col="blue")
legend(
"topleft",
c("M2", "M1","Currency"),
col=c("red","green","blue"),
bty='n',
lty=1
)
dev.copy(svg, "Components of US Money supply (logscale).svg", width=8, height=6)
dev.off()