# NOT RUN {
# }
# NOT RUN {
####################################################
### Standard Nonparametric Vector Autoregression ###
####################################################
set.seed(123)
x <- rnorm(100) ; y <- rnorm(100) ; z <- rnorm(100)
A <- cbind(x = x, y = y, z = z)
### Using lags 1:4 for each variable
NNS.VAR(A, h = 12, tau = 4, status = TRUE)
### Using lag 1 for variable 1, lag 3 for variable 2 and lag 3 for variable 3
NNS.VAR(A, h = 12, tau = c(1,3,3), status = TRUE)
### Using lags c(1,2,3) for variables 1 and 3, while using lags c(4,5,6) for variable 2
NNS.VAR(A, h = 12, tau = list(c(1,2,3), c(4,5,6), c(1,2,3)), status = TRUE)
#########################################
### NOWCASTING with Mixed Frequencies ###
#########################################
library(Quandl)
econ_variables <- Quandl(c("FRED/GDPC1", "FRED/UNRATE", "FRED/CPIAUCSL"),type = 'ts',
order = "asc", collapse = "monthly", start_date="2000-01-01")
### Note the missing values that need to be imputed
head(econ_variables)
tail(econ_variables)
NNS.VAR(econ_variables, h = 12, tau = 12, status = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab