I'm working on using Granger causality of some variables and I have 4 stationary time series (X1, X2, X3, X4) and one that is not (X5). I've seen here that
If (A) then first-difference each of the three variables (x1, x2, x3), and use them together with the stationary variable x4 to build a VAR model.
But if I differenciate the (X5) series, by using VAR in R:
Error in VAR(qq2) : NAs in y.
qq2 = cbind(X1,X2,X3,X4,X5).
Because I lose one observation in differencing. Do I need to remove one observation from the other series as well?
EDIT: Example provided. Let's assume three series, X1 and X2 stationary. X3 non stationary.
X1 <- arima.sim(model=list(ar=c(.9,-.2)),n=200) X2 <- arima.sim(model=list(ar=c(.5,-.2)),n=200) X3 <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200) X3d <- diff(X3) qq2 <- vars::VAR(cbind(X1,X2,X3d))