Im new to R so sorry if my questions seem a bit too rudimentary
I'm trying to estimate a VAR model consisting of two time series data, Wt and Pt
Therefore, I used VARselect to estimate the appropriate lag length and subsequently act function to check the residual autocorrelation
here are my codes
LWt <- ts(dt$LW, start=1992, end=2017)
LPt <- ts(dt$LP, start=1992, end =2017)
ts.plot(LWt,LPt,col=c("blue","red"), xlab="year", ylab="index", lwd=2)
legend("topleft", bty="n", lty=c(1,1), col=c("blue","red"), legend=c("LogWage","LogPrice"))
IC <- VARselect(cbind(LWt,LPt), type="both", lag.max=8)
print(IC$selection[1])
n <- length(LWt)
t <- 1:n
VAR.W <- dynlm(LWt~t+L(LWt,1:8)+L(LPt,1:8))
VAR.P <- dynlm(LPt~t+L(LWt,1:8)+L(LPt,1:8))
acf(VAR.W$residuals)
However, the act function returns with error warning that
> acf(VAR.W$residuals)
Error in plot.window(...) : need finite 'ylim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
the imported data of Wt and Pt have no missing values, so I wonder what exactly causes such error?