inflation: Performs multiple type of operations on the Consumer Price...

Description Usage Arguments Details Value References

View source: R/inflation.R

Description

The function inflation carry out three operations based on the CPI series: series, metrics and validate. The first operation retrieves the CPI index and Treasury Bill series. It also returns additional series derived from algebraic transformations (e.g. inflation rate, ex post real rate) and lag operators (e.g. Treasury Bill at t-1). The metrics operation expands by returning inflation metrics estimated from three different econometric models based on \insertCiteFama;textualbindr. The last operation, validate, replicates the original results of \insertCiteFama;textualbindr for validation purposes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
inflation(
  operation = c("series", "metrics", "validate"),
  from_ = NA,
  to_ = NA,
  error_on_join_NA = TRUE,
  MA_q = 1,
  conf_level = 0.95,
  src_dir = "~/Desktop/UMich/Factor Warehouse/Uncompressed/",
  src_file = c(CPI = "FRED_CPI_US_M.csv", TB = "FF_3F_US_M.csv"),
  as_factor = FALSE
)

Arguments

operation

A string representing the requested operation. See documentation for additional details.

from_, to_

A string representing the sample start and end date, respectively. See documentation for admissible formats.

error_on_join_NA

Logical parameter governing how irregular samples are resolved. See details.

MA_q

A integer, strictly greater than 0. Controls the order of the moving-average (MA) process to model inflation and real rates in a time-series framework. See documentation for additional details.

conf_level

A double, between 0.5 and 1.0 (excluding boundary points). Controls the parameter confidence intervals in the inflation econometric models.

src_dir, src_file

A string representing the source directory and file name containing the the primary series (e.g. CPI, T-Bills). See details.

as_factor

Logical parameter (default is FALSE) to control if inflation metrics are saved on file as factors. See details.

Details

The date parameters (from_ , to_) must be of the following form:

The first operation (series) returns the observable CPI index and Treasury Bill, along with additional series derived from applying algebraic transformations and lag operators. Specifically, the monthly inflation rate is I(t) = log( CPI(t) ) - log( CPI(t-1) ), where log stands for the natural log. The ex post real rate is expressed as TB(t-1) - I(t), where TB(t-1) is the one-month interest rate observed at the end of month (t-1). See additional details below.

Note that the CPI index and Treasury Bill quotes reside in two different sources. The CPI series is sourced from the the Federal Reserve Economic Data (FRED), while the 1-month T-Bill return is hosted in the standard 3-factor French-Fama model (Kenneth R. French Data Library). It is ultimately sourced from Ibbotson and Associates (now a Morningstar Company) and goes back to 1926. These two series are not necessarily updated in a synchronous manner, leading to potential sample mismatch. The parameter error_on_join_NA governs how such sample irregularities are resolved. The call inflation(operation = 'series') generates an error when error_on_join_NA = TRUE and the series are not synchronized. When error_on_join_NA = FALSE, irregular samples generate a warning and a display of records with NA's (i.e. not updated), which will be dropped from the final sample . Also note that the operation metrics is also directly impacted by the error_on_join_NA setting as it inherits its base sample from the operation series.

The second operation (metrics) expands on operation series by returning two inflation components, expected and unexpected (e.g. shock), derived from from three different econometric models. Each model is defined by a specific dynamics governing inflation or real rates and is documented in \insertCiteFama;textualbindr as 'Interest rate model' (cf. section 2.2), 'Naive interest rate model' (cf. section 2.3) and 'Time series model' (cf. section 2.1).

The 'Interest rate model' (cf. section 2.2) is underpinned by a formulation proposed by \insertCiteFisher;textualbindr, whereby the observed nominal interest rate TB(t-1) can be broken into an expected real return for month t, E[R(t-1)], and an expected inflation rate E[I(t-1)]. The compact expression of this formulation is TB(t-1) = E[R(t-1)] + E[I(t-1)]. (cf. \insertCiteFama;textualbindr, section 2.2, equation (7)). The expected inflation (E[I(t-1)]) is recovered by combining the observed nominal rate (Treasury Bill rate TB(t-1)) and the expected real rate (E[R(t-1)]), which is derived from an explicit model describing the real rate dynamics. In this case, ex post real rates are assumed to follow a random walk model (i.e. unit root), as supported by the available empirical evidence at the time (e.g. \insertCiteGarbade;textualbindr). The main features of a random walk are persistence (possibly never decaying) of shocks over very long horizons and non-stationarity of time-series (e.g. unstable volatility). The next step exploits a standard property of random walks (i.e. standard Brownian motions, see \insertCiteHamilton;textualbindr, Chap. 17), namely that their difference (say between time s and time t) follows an independent Gaussian distribution with variance s - t and s > t . It follows that the first order difference of the ex post real rates is described by Gaussian statistical white noises and can be modeled as a standard time-series moving-average (MA) process (cf. \insertCiteFama;textualbindr, section 2.2, equation (10) and \insertCiteHamilton;textualbindr, Chap. 3). To summarize the procedure, first estimate a MA model on the first order difference of ex post real rates, which yields the expected real return E[R(t-1)]. The expected inflation E[I(t-1)] is then recovered by subtracting the expected real return from the observed nominal interest rate TB(t-1).

It is worth mentioning that imparting a unit root to a time-series, either from an assumption or from statistical inference, has meaningful consequences. Indeed, '(...) the conclusion that an economic time series contains a unit root (...) has important consequences for dynamic economic models. For example, with a unit root there is no deterministic long-run growth path to which the economic variable tends to revert. Moreover, uncertainty about the level of an economic series grows larger indefinitely as one forecasts further into the future. Thus, for an integrated series (containing a unit root), it is not meaningful to discuss the long-run mean or variance of the process. In terms of business cycle modeling, a unit root means that part of the innovation to the series causes a permanent change in the level of the series'. (\insertCiteSchwert:1987;textualbindr)

Also note that the 'Interest rate model' uses an ex post measure of real rates as ex ante real rates are not directly observable for modeling purposes. This might seem problematic at first since the ex ante real rate is the relevant measure for evaluating economic decisions in asset pricing theories. An approach to solve this difficulty is to use the actual inflation rate as a proxy for inflation expectations. Under rational expectations, the ex post and ex ante real rates differ only by a white noise component, so the the ex post and ex ante measures share the same long-run properties. This result even holds under less stringent assumptions, e.g. if the expectation errors are stationary. This implies in practical terms that investors forecast inflation with some imperfections, but the magnitudes of these errors is not growing unbounded and remains stable. See \insertCiteNeely;textualbindr for a detailed discussion.

The 'Naive interest rate model' (cf. section 2.3) stands as a coarse approximation to the 'Interest rate model'. Specifically, stationary MA (moving-average) models expressed as linear combination of white noises can be transformed in AR (auto-regressive) models (\insertCiteHamilton;textualbindr, Chap. 3). For instance the MA(1) model y(t) = ε(t) + θ ε(t-1) has the equivalent AR(p) representation y(t) = (1 - θ) y(t-1) + θ (1 - θ) y(t-2) + θ^2 (1 - θ) y(t-3) + (...). The estimate obtained by \insertCiteFama;textualbindr is θ = 0.92 and the AR model with 12 terms translates into the following coefficients: (0.078, 0.072, 0.066, 0.061, 0.056, 0.052, 0.048, 0.044, 0.041, 0.038, 0.035, 0.032). This 'Naive interest rate model' takes a short cut by using an equally weighted average of the past 12 rates (ex post, monthly real rate), in effect overriding and coarsely approximating the coefficient sequence above with a sequence of equal weights (1/12 = 0.083).

The 'Time series model' (cf. section 2.1) is driven by a statistical description of the inflation and its long-run properties, summarized by a random walk (i.e. presence of unit root). The empirical results of \insertCiteMishkin;textualbindr broadly support this assumption, although debate and research are still ongoing and no definitive consensus has emerged yet. This model differs from the 'Interest rate model' in two respects: (a) inflation (as opposed to the ex post real rate) follows a random walk (b) the Fisherian view of interest rate is discarded and inflation expectations are recovered via a statistical model capturing the long-run properties of the inflation rate. In essence, the 'Time series model' is free from the structural constraint imposed by the Fisherian perspective. In this case the procedure is straightforward. First estimate a MA model on the first order difference of the inflation rate, which yields directly the expected inflation rate E[I(t-1)] (see \insertCiteHamilton;textualbindr, Chap. 3).

The third operation (validate) reproduces the original results published by \insertCiteFama;textualbindr, and in particular fragments of Table 2 (p. 334) and Table 4 (p. 338). Table 2 is an in-sample regression of actual monthly inflation rates on estimated expected inflation rates extracted from the econometric models governing the inflation and real rate dynamics. The 'tibble' objects diagostic_param and diagostic_stats summarize the results (see further details in the Value section). The ideal model should have a constant close to 0 and a slope estimate near 1.0, as a well-calibrated model should yield anticipations close to actual realizations. Note that statistical inference from standard regression can be highly problematic under certain conditions, such as in a time-series context with non-stationary series. More details further below.

Additional diagnostic and validation results can be found in Table 4 (\insertCiteFama;textualbindr, p. 338), which summarizes the in-sample forecasts errors of the three inflation models along seven non-overlapping sub-periods. The seven sub-periods are defined as follows:

The results are contained in the diagostic 'tibble' object and include the average monthly forecast error (mean), the t-statistic for the test of the null hypothesis that the average forecast error is equal to zero (test), the standard deviation of the monthly forecast error (sd) and the square root of the average squared forecast error (rsme). In addition, the function call produces a plot summarizing the replicated standard deviation of the monthly forecast error vs. the original corresponding figures found in \insertCiteFama;textualbindr.

The replicated results are fairly close to the original set and follow an identical pattern across the seven sub-periods, yet some minor differences can be observed. The most plausible explanation centers on the difference between the Federal Reserve Economic Data (FRED) and the ArchivaL Federal Reserve Economic Data (ALFRED) time-series for the CPI index. The ALFRED CPI series contains the original index values registered at the time of entry, hence the qualifier Archival. In contrast, the FRED CPI series overwrites the existing entries with the latest data iteration:

"ALFRED allows you to retrieve vintage versions of economic data that were available on specific dates in history. In general, economic data for past observation periods are revised as more accurate estimates become available. As a result, previous vintages of data can be superseded and may no longer be available from various data sources. Vintage or real time economic data allows academics to reproduce others' research (emphasis added), build more accurate forecasting models, and analyze economic policy decisions using the data available at the time." (Source: ALPFRED, St. Louis Fed's Economic Research Division)

Revisions can have a meaningful impact when a significant change in methodology is introduced. Changes associated with housing costs (1950, 1983, 1987, 1997 and 2005) are prime examples. See \insertCiteCarson;textualbindr for a detailed account of changes in CPI housing costs and \insertCiteGreenlees;textualbindr for other controversies.

Although the ALFRED CPI series is available and could be used to replicate more closely the original results of \insertCiteFama;textualbindr, this package does not attempt to do so, for at least three reasons: (a) the replicated standard deviations of the monthly forecast errors match the original pattern across sub-periods - elevated in the first two sub-periods, at the lowest in sub-periods 3 to 5, and at the highest in sub-periods 6 and 7. (b) the replicated standard deviations are generally lower or very close to the original corresponding figures (c) the absolute difference is at most 3 basis points (i.e. 0.0003 x 10,000) per month or 36 basis points annually.

The parameter src_dir must be a valid and existing directory. An error is generated if either one of these conditions is not satisfied. Source file src_file must have a .csv format suffix, otherwise an error is generated. Note that the underlying filing structure must have a <root> directory and at least two additional existing sub-directories: <root>/Audit and <root>/Uncompressed. The function will stop and generate an error message if any of these directories does not exist. Most likely, these sub-directories will be created (if they do not exist) by the function fetch from the package factorr.

The parameter as_factor = TRUE will cause inflation metrics from all three models ('Interest Rate', 'Naive', 'Time-Series') to be separately saved on file as factors, but only if the selected call is inflation(operation = 'metrics'). File time stamps, attributes and path directories are documented in .pdf files located in the Audit sub-directory, along with additional details maintained for auditing and monitoring purposes. Finally note that all file permissions are set to read-only to prevent unintended modifications.

Value

Return objects are contingent on the requested operation, but generally follow a 'nesting' relation ranging from the simplest (operation = 'series') to the more complex (operation = 'metrics'). When applicable, multiple 'tibble' objects are returned in a list. Specifically:

References

\insertAllCited
fognyc/bindr documentation built on Dec. 4, 2020, 12:33 p.m.