nberDates
returns a matrix with two columns of yyyymmdd dates
giving the Start and End dates of recessions fixed by the NBER.
nber.xy
returns a list of x and y coordinates that can be fed
to polygon
to draw NBER shadings on the current plot.
It executes get("nberDates", pos = 1)()
to do so. This means
that if you have defined a local version of nberDates
, it will
be used rather than the one supplied by the nberDates()
has a Start entry but an "NA"
End entry and openShade
is FALSE
, the returned list will
not have coordinates for the last row, but will instead include a
vLine element that gives the x coordinate of the last Start. If
openShade
is TRUE
(the default), the list includes x
and y coordinates for the most recent recession, using the second
element of the horizontal range determined by the xrange
parameter as its end time.
nberShade
is a generic method for shading recession areas
on the current plot. The default version calls
nber.xy
to get x and y coordinates for the areas to be shaded
and then passes those coordinates along with its own arguments to
polygon
to do the shading. It also draws a vertical
line at the appropriate location if the list returned by
nber.xy
has a vLine element. romerLines
draws vertical lines on the current plot at the
"Romer and Romer" dates when monetary policy is said to have become
contractionary.
## S3 method for class 'default':
nberShade(col = grey(0.8), border = FALSE, xpd = FALSE,
xrange = NULL, openShade = TRUE, ...)
nberDates()
nber.xy(xrange = NULL, openShade = TRUE)
romerLines()
FALSE
) omits borders on the shaded
regions. TRUE
draws borders in the foreground color.
Alternatively, specify a border color.polygon
NULL
uses the entire range of the
plot. Note however the tisPlot
uses the range of the data,
which will generally differ the plot range unless tnber.xy
and consequently
nberShade
handle the case where the last row of the matrix returned by
nberDates
has an NA
in the "End" column, indicating
that the end date of the most recent renber.xy
returns a list. The other
functions described do not return anything useful.National Bureau of Economic Research. http://www.nber.org.
polygon
, nberShade.ggplot
require("datasets")
plot(presidents, type='n', ylab="Presidents approval rating")
nberShade()
lines(presidents)
Run the code above in your browser using DataLab