Aggregate a monthly shock series to quarterly frequency
Source:R/mp_to_quarterly.R
mp_to_quarterly.RdConverts a monthly mp_shock object to quarterly observations using one
of three aggregation methods.
Usage
mp_to_quarterly(shock, method = c("sum", "mean", "end"))Arguments
- shock
An
mp_shockobject frommp_shock()at monthly frequency.- method
Character(1). One of
"sum"(the default, usual choice for additive shocks),"mean"(arithmetic mean of months in the quarter), or"end"(last month's value, useful for stock-like measures such as shadow rates).
Value
A data frame with one row per quarter, containing a date
column set to the first day of the quarter, the aggregated shock
column, and the series identifier. Class c("mp_shock", "data.frame").
Details
Method selection. For identified shocks (nakamura_steinsson,
bauer_swanson, jarocinski_karadi_mp, miranda_agrippino_ricco),
"sum" is the standard choice because the underlying objects are
additive surprises at FOMC events. For the shadow rate (wu_xia),
"end" returns end-of-quarter stance and matches the convention used
in most zero-lower-bound regressions. "mean" is appropriate when
the dependent variable is itself a quarterly-average interest rate.
NA handling. Missing monthly values are dropped within each
quarter before aggregation. If a whole quarter is missing, the result
is zero under "sum" / "mean" and NA under "end".
Examples
ns_q <- mp_to_quarterly(mp_shock("nakamura_steinsson"), method = "sum")
head(ns_q)
#> <mp_shock> nakamura_steinsson [quarterly, 6 obs, 2000-01-01 to 2001-04-01]
#> date shock
#> 2000-01-01 0.0187061
#> 2000-04-01 0.0274602
#> 2000-07-01 0.0126884
#> 2000-10-01 0.0537947
#> 2001-01-01 -0.1058595
#> 2001-04-01 0.0328807