diagnostic: Performs multiple diagnostic checks (by period) on the...

Description Usage Arguments Details Value References

View source: R/diagnostic.R

Description

The function diagnostic perform checks to validate three models proposed by \insertCiteFama;textualbindr. One diagnostic set is applied to the in-sample forecasting errors, i.e. the difference between actual and expected inflation. The second diagnostic set evaluates the results obtained from regressing actual inflation against a constant and the expected inflation, with the ideal model showing a constant term of zero and an expected inflation coefficient of one.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
diagnostic(
  metrics,
  diag_type = c("period", "rolling"),
  wnd_sz = 60,
  show_plot = F,
  y_plot = c("mean", "test", "sd", "rmse", "term"),
  select_ = c("constant", "slope"),
  conf_level = 0.95,
  truncate_at = 0.75
)

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 statistic will be calculated (and displayed if show_plot = TRUE). See details.

select_

A string identifying which regression term will be selected. Applies only if y_plot == 'term', otherwise ignored. See details.

conf_level

A double, between 0.5 and 1.0 (excluding boundary points). Controls the parameter confidence intervals in the regression of actual inflation against a constant and the expected inflation.

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 .

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 diagnostic set applied to the in-sample forecasting errors, i.e. the difference between actual and expected inflation, can be viewed as imposing the dual constraint α = 0, β = 1. The second diagnostic set applied on the results obtained from regressing actual inflation against a constant and the expected inflation can be viewed as a fitted difference I(t) - α - β E[I(t-1)], where α and β are estimated.

The parameter y_plot = c("mean", "test", "sd", "rmse") pertains to the difference between actual and expected inflation, whereas y_plot = "term" performs diagnostic checking on results obtained from regressing actual inflation against a constant and the expected inflation. The latter choice requires setting select_ = 'constant' or select_ = 'slope'.

The wnd_sz parameter unit must implicitly match the underlying data frequency. For instance, wnd_sz = 60 corresponds to a 5-year window/period in monthly frequency. However, if the underlying frequency is quarterly the same parameter value yields a 15-year window/period.

Note that when y_plot == c('mean', 'test', 'sd', 'rmse'), three list-columns (stats::lm, tidy_param, tidy_ols) are also returned. 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. All three list-columns (stats::lm, tidy_param, tidy_ols) contain results associated with regressing actual inflation against a constant and the expected inflation.

Value

References

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