diagnostic_ur: Performs unit root tests (by period) on the difference...

Description Usage Arguments Details Value References

View source: R/diagnostic_ur.R

Description

The function diagnostic_ur perform unit root tests to validate three econometric models proposed by \insertCiteFama;textualbindr. One set of unit root tests is applied to the in-sample forecasting errors, i.e. the difference between actual and expected inflation. The second set of unit root tests is applied to fitted differences, or equivalently, the residuals obtained from regressing actual inflation against expected inflation, which is derived from an econometric model. Absence of a unit root (i.e. rejecting the null hypothesis of a unit root in the augmented Dickey-Fuller test) would suggest a long-term connection between actual and expected inflation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
diagnostic_ur(
  metrics,
  diag_type = c("period", "rolling"),
  wnd_sz = 60,
  show_plot = F,
  y_plot = c("difference", "fitted difference"),
  truncate_at = 0.75,
  adf_conf_level = c("5pct", "1pct", "10pct"),
  adf_lags = 12,
  adf_type = c("none", "drift", "trend")
)

Arguments

metrics

The 'metrics' 'tibble' object in the list returned by inflation(operation = 'metrics', ...).

diag_type

A string controlling the time intervals: period defines non-overlapping period of wnd_sz months in length, whereas rolling generates rolling windows of width wnd_sz.

wnd_sz

A integer, strictly greater than 0, defining period length or rolling windows width. The unit should match the underlying series frequency. See details.

show_plot

Logical (default is FALSE). Plot the results if set to TRUE

y_plot

A string identifying which measure will be tested (and displayed if show_plot = TRUE). See details.

truncate_at

A double, between 0 and 1.0 (including boundary points). Applicable only when diag_type == 'period', show_plot == TRUE. Controls the minimum proportion of wnd_sz required to include the last period in the plot of results.

adf_conf_level

A string, indicating the confidence level for the augmented Dickey-Fuller unit root test.

adf_lags

A integer, between 0 and 12 (inclusively) indicating the number of lags applicable in the augmented Dickey-Fuller unit root test. Default value is 12. See details.

adf_type

A string, indicating the alternative model specification in the augmented Dickey-Fuller unit root test. Default value is none. See details.

Details

The measured difference between actual and expected inflation is captured by the general expression I(t) - α - β E[I(t-1)], where I(t) is the actual inflation and E[I(t-1)] stands for the expected inflation derived from three different econometric models found in \insertCiteFama;textualbindr. The first set of unit root tests (y_plot = 'difference') concerns the in-sample forecasting errors, i.e. the difference between actual and expected inflation, and can be viewed as imposing the dual constraint α = 0, β = 1. The second set of unit root tests (y_plot = 'fitted difference') is applied on the residuals obtained from regressing actual inflation against a constant and the expected inflation. The residuals in this test can be viewed as a fitted difference I(t) - α - β E[I(t-1)], where α and β are estimated.

Unit root tests are motivated by the findings of \insertCiteGranger;textualbindr who demonstrated how spurious regression results emerge when time series display dependence at very long range, including the most extreme case of Brownian process (i.e. unit root) where dependence persists at any horizon. Unreliable results arise as the uncertainty about the level of an economic series grows larger indefinitely as one forecasts further into the future. Thus for a series containing a unit root, the long-run variance is not a meaningful concept and the assumptions underpinning the standard regression inference are no longer valid. For instance, \insertCiteFama;textualbindr (cf. Table 2, p.334) contain regression results of actual inflation against expected inflation derived from three econometric models which merit further examination in the current context. Indeed, \insertCiteMishkin;textualbindr found that inflation is characterized by a unit root, even after adjusting for a finite sample effect and possible test misspecification as documented in \insertCiteSchwert:1987,Schwert:1989;textualbindr. Independent unit root tests on expected inflation performed while developing this package yielded similar conclusions.

Despite this statistical quandary, some simple adjustments can be made in specific contexts (e.g. \insertCiteHjalmarsson;textualbindr for overlapping data) to allow for meaningful inference in a regression framework - but this is not the case in this particular context. The other avenue is to consider a measure of association which applies in the long-run, such as co-integration. Tests for co-integration involve estimating a regression of actual inflation against expected inflation using ordinary least squares and then conducting unit root tests on the residuals. In other words, the co-integration of I(t) and E[I(t-1)] implies that a linear combination of these variables is stationary in the long-run. See \insertCiteMishkin;textualbindr for an application and the Appendix in \insertCiteNeely;textualbindr showing how co-integration tests are closely related to unit root tests.

The model specification adf_type = c("none", "drift", "trend") and its corresponding critical values for the augmented Dickey-Fuller (ADF) test are derived in \insertCiteHamilton;textualbindr, Chap. 17. In the current context, the recommended value is none as the test is performed on residuals. See \insertCiteNeely;textualbindr, pp. 640-641. The argument adf_lags is the input to l = int(adf_lags * (T/100)^(0.25)), where l is the number of lags in the augmented Dickey-Fuller test formulation. Extensive numerical simulations by \insertCiteSchwert:1987,Schwert:1989;textualbindr show that ADF tests with adf_lags = 12 on the regression t test (as opposed to a test on T(ρ - 1)) are the most robust to misspecification from MA-type disturbances, even in sample size as small as 25 observations. Hence, every ADF unit root tests are performed on regression t test and adf_lags = 12 is the recommended value.

Note that the function also returns at least one list-column (data). List-columns are used in nested data frames and are stored as a column vector of a data frame. They are part of the tidyverse framework, and specifically documented in the package tidyr. List-columns are typically created by calling group_by(...) on a tibble/data frame object followed by nest(). See tidyr package documentation and/or purrr cheat sheet for details.

Value

References

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