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 missings, i.e. NAs are deleted.

The missings and outliers are “corrected” following the same method avaible in the replication files of Giannone et al. 2008. Outliers are defined as observations that lies more than 4 IQR from median. All missings and outliers are replaced by the median. A centered moving average of degree k_ma 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 modifications 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 than those found here.

In the end, the monthly series can be aggregated to quarterly quantities following the Mariano and Murasawsa 2003 approximation.

Usage

1
Bpanel(base = NULL, trans = NULL, aggregate = F, k_ma = 3)

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:

  • transf = 0: the original serie is preserved;

  • transf = 1: monthly rate of change

    \frac{X_t - X_{t-1}}{X_{t-1}}

  • transf = 2: monthly difference

    X_t - X_{t-1}

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

    \frac{X_t - X_{t-12}}{X_{t-12}} - \frac{X_{t-1} - X_{t-13}}{X_{t-13}}

  • transf = 4: monthly difference of year difference

    (X_t - X_{t-12}) - (X_{t-1} - X_{t-13})

aggregate

A bolean 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 degrre of the moving average correction.

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
# Example from database BRGDP:
Bpanel(BRGDP,rep(3,dim(BRGDP)[2]))

guilbran/nowcasting documentation built on May 17, 2019, 2:09 p.m.