# NOT RUN {
### Method 2s (Using the Mariano and Murasawa aggregation method on the variables)
data(USGDP)
gdp_position <- which(colnames(USGDP$base) == "RGDPGR")
base <- Bpanel(base = USGDP$base[,-gdp_position],
trans = USGDP$legend$Transformation[-gdp_position],
aggregate = TRUE)
data <- cbind(USGDP$base[,"RGDPGR"], base)
colnames(data) <- c("RGDPGR", colnames(base))
frequency <- c(4, rep(12, ncol(data) -1))
now2s <- nowcast(formula = RGDPGR ~ ., data = data, r = 2, p = 2, q = 2,
method = '2s', frequency = frequency)
### Method 2s_agg (Using the Mariano and Murasawa aggregation method on the factors)
data <- Bpanel(base = USGDP$base,
trans = USGDP$legend$Transformation,
aggregate = FALSE)
frequency <- c(rep(12, ncol(data) -1), 4)
now2s_agg <- nowcast(formula = RGDPGR ~ ., data = data, r = 2, p = 2, q = 2,
method = '2s_agg', frequency = frequency)
### Method EM
# Replication of the NY FED nowcast
data(NYFED)
base <- NYFED$base
blocks <- NYFED$blocks$blocks
trans <- NYFED$legend$Transformation
frequency <- NYFED$legend$Frequency
data <- Bpanel(base = base, trans = trans, NA.replace = F, na.prop = 1)
nowEM <- nowcast(formula = GDPC1 ~ ., data = data, r = 1, p = 1,
method = "EM", blocks = blocks, frequency = frequency)
# }
Run the code above in your browser using DataLab