Apologies if this is the wrong place to post. I'm very new here.
I'm running granger causality analysis in R/RStudio the function grangertest()
but am encountering an error about the model containing aliased variables. The error reads : "Error in waldtest.lm(fm, 2, ...) : there are aliased coefficients in the model".
From my understanding, this occurs when there is multicolinearity in the data. I would like to bypass this error if possible and run the model anyway. From some reading, it appears that setting a parameter "singular.ok=TRUE" allows for this, but I have been unable to get it to work or am missing something. I would be very grateful if someone could provide a solution to my problem.
Below is a minimal working example to reproduce the error. My real data contains many more variables and much longer, but if there is a way to get the minimal example to run, I should be able to upscale it as needed.
library(lmtest)
library(zoo)
x <- c(0,1,2,3,4,5)
y <- c(0,3,6,9,12,15)
grangertest(x,y,1) # This currently produces an error, but I would like to bypass the error and for it to run anyway.
Thanks in advance