I'm running the following regression on my data set called data
y ~ x1 + x2 + x3 + x4 + t
I know that the residuals are serially correlated, so I create a model that takes that into account with prais_winsten(), let's call this model model1 (he is of type "prais").
pw <- prais_winsten(y ~ x1 + x2 + x3 + x4 + t, data = data, index = "t")
I am trying to decide whether or not x3 and x4 are jointly statistically significant. I will do so by letting model2 be the one without x3 and x4, i.e.
model1 <- lm(y ~ x1 + x2 + x3 + x4 + t, data = data)
To decide whether or not x3 and x4 are jointly statistically significant, I wanted to do
anova(pw, model1)
But I get
Error in eval(predvars, data, env) : object 'y' not found
I think the problem is that pw is not of type "lm" but of type "prais", hence anova() cannot run correctly. How would I go about making pw of type "lm" ?
To be clear, I run:
pw <- prais_winsten(y ~ x1 + x2 + x3 + x4 + t, data = data, index = "t")
model1 <- lm(y ~ x1 + x2 + x3 + x4 + t, data = data)
anova(pw, model1)
and wanted to get a normal output from anova, but it doesn't work