Bpanel: Balanced panel

Description Usage Arguments References Examples

View source: R/Bpanel.R

Description

This function transforms the original monthly time series to its stationary representation following the user specification. The time series with more than 1/3 missing, i.e. NAs, are deleted and the remaining are modified such that the missings and outliers are replaced by an approximated value.

The missings and outliers are “corrected” following the same method available in the replication files of Giannone et al. 2008. Outliers are defined as observations that lie more than 4 IQR from the median. All missings and outliers are replaced by the median. A centered moving average of degree **k** is calculated, forming a new panel. Then the missings and outliers are replaced by their equivalent observations on this new panel. We've made an important modification on the outlier_correction function found in the above mentioned files: Here the median of an even-sized sample is calculated by the mean of the two most central values, rather than using the largest of those numbers. Because of this modification the results obtained with the original replication files in (USGDP) are slightly different from those found here.

Usage

1
2
Bpanel(base = NULL, trans = NULL, aggregate = F, k.ma = 3,
  na.prop = 1/3, h = 12)

Arguments

base

A mts with the series to be transformed.

trans

A vector where each coordinate is a code for the transformation of the correspondent coordinate in the base argument. The transformation is specified by codes, as follows:

  • trans = 0: the original serie is preserved;

  • trans = 1: monthly rate of change

    \frac{x_{i,t} - x_{i,t-1}}{x_{i,t-1}}

  • trans = 2: monthly difference

    x_{i,t} - x_{i,t-1}

  • trans = 3: monthly difference in year-over-year rate of change

    \frac{x_{i,t} - x_{i,t-12}}{x_{i,t-12}} - \frac{x_{i,t-1} - x_{i,t-13}}{x_{i,t-13}}

  • trans = 4: monthly difference in year difference

    (x_{i,t} - x_{i,t-12}) - (x_{i,t-1} - x_{i,t-13})

  • trans = 5: yearly difference

    (x_{i,t} - x_{i,t-12})

  • trans = 6: yearly rate of change

    \frac{x_{i,t} - x_{i,t-12}}{x_{i,t-12}}

aggregate

A boolean representing if you want aggregate the monthly variables to represent quarterly quantities. If TRUE the aggregation is made following the approximation of Mariano and Murasawsa 2003.

k.ma

A numeric representing the degree of the moving average correction.

na.prop

A numeric representing the proportion of NA allowed. Default is 1/3.

h

A numeric representing the number of steps ahead to forecasting. Default is 12.

References

Giannone, D., Reichlin, L., & Small, D. (2008). Nowcasting: The real-time informational content of macroeconomic data. Journal of Monetary Economics, 55(4), 665-676.<doi:10.1016/j.jmoneco.2008.05.010>

Mariano, R. S., & Murasawa, Y. (2003). A new coincident index of business cycles based on monthly and quarterly series. Journal of applied Econometrics, 18(4), 427-443.<doi:10.1002/jae.695>

Examples

1
2
3
# Example from database BRGDP:
data(BRGDP)
Bpanel(BRGDP$base, rep(3,ncol(BRGDP$base)))

nowcasting documentation built on Nov. 27, 2018, 5:04 p.m.