nowcast: Nowcasting of a quarterly time series using a dynamic factor...

Description Usage Arguments Value References See Also Examples

View source: R/nowcast.R

Description

Estimate nowcasting and forecasting for a quarterly series. For more details read the Vignettes.

Usage

1
2
nowcast(y, x, q = NULL, r = NULL, p = NULL, method = "2sq",
  blocks = NULL, oldFactorsParam = NULL, oldRegParam = NULL)

Arguments

y

Stationary quarterly time series.

x

A monthly time series matrix (mts) representing regressors variables. The series must be stationary.

q

Dynamic rank. Number of error terms.

r

number of commom factors.

p

AR order of factor model.

method

There are three options: "2sq": "Two stages: quarterly factors" as in Giannone et al. 2008; "2sm": "Two stages: monthly factors" as in Bańbura and Runstler 2011; "EM": Expected Maximization as in Bańbura et al. 2011.

blocks

a binary matrix Nx3 that characterizes the regressors variables in global (1st column), nominal (2nd column) and real (3rd column). If NULL, the matrix assume 1 for all cells.

oldFactorsParam

a list containing estimated factors parameters from nowcast function.

oldRegParam

a list containing estimated regression parameters from nowcast function.

Value

A list containing two elements:

yfcst

the original y series and its in-sample and out-of-sample estimations.

reg

regression model between y and the estimated factors. Not available for EM method.

factors

the estimated factors and DFM model coefficients.

xfcst

the original regressors and their out-of-sample estimations.

month_y

the monthly measure for quarterly y variable. Only available for EM method.

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>

Bańbura, M., & Rünstler, G. (2011). A look into the factor model black box: publication lags and the role of hard and soft data in forecasting GDP. International Journal of Forecasting, 27(2), 333-346. <doi:10.1016/j.ijforecast.2010.01.011>

Bańbura M., Giannone, D. & Reichlin, L. (2011). Nowcasting, in Michael P. Clements and David F. Hendry, editors, Oxford Handbook on Economic Forecasting, pages 193-224, January 2011. <doi:10.1093/oxfordhb/9780195398649.001.0001>

See Also

base_extraction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## Not run: 
### Method 2sq (two stages: quarterly factors)
gdp <- month2qtr(x = USGDP$base[,"RGDPGR"])
gdp_position <- which(colnames(USGDP$base) == "RGDPGR")
base <- Bpanel(base = USGDP$base[,-gdp_position],
               trans = USGDP$legend$Transformation[-gdp_position],
               aggregate = TRUE)
now2sq <- nowcast(y = gdp, x = base, r = 2, p = 2, q = 2, method = '2sq')

### Method 2sm (two stages: monthly factors)
base <- Bpanel(base = USGDP$base[,-gdp_position],
               trans = USGDP$legend$Transformation[-gdp_position],
               aggregate = F)
now2sm <- nowcast(y = gdp, x = base, r = 2, p = 2, q = 2, method = '2sm')

### Method EM
# selecting and transforming y  
gdp <- month2qtr(x = USGDPshort$base[,"GDPUS"])
gdp <- ts(c(gdp,NA,NA,NA,NA), start = start(gdp), frequency = 4)
gdp_stationary <- gdp/lag(gdp, k = -1) -1
gdp_position <- which(colnames(USGDPshort$base) == "GDPUS")

# selecting and transforming x 
base <- USGDPshort$base[,-gdp_position]
trans <- USGDPshort$legend[-gdp_position,"transformation"]
stationaryBase <- cbind(base[,trans == 1]/lag(base[,trans == 1], k = -1) - 1,
                        diff(base[,trans == 2]))
colnames(stationaryBase) <- colnames(base)[c(which(trans == 1),which(trans == 2)) ]
stationaryBase <- stationaryBase[,colnames(base)]

# DFM estimation via EM
blocks <- matrix(c(1,0,1,1,0,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,
                   0,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,1,
                   1,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,1,0), byrow = T, ncol = 3)
nowEM <- nowcast(y = gdp_stationary, x = stationaryBase, r = 1, p = 1, q = 1,
                 method = 'EM', blocks = blocks)

## End(Not run)

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