I am running a regression model with some heteroskedasticity and serial correlation and I am trying to solve both without changing my model specification.
First, I have generated an OLS model and realized both problems, heteroskedasticity and serial correlation. So, I tried to run a feasible generalized least square (FGLS) model with plm's pggls
command to solve both problems at the same time, but this command seems to only solve heteroskedasticity and not serial correlation.
My code is as follows:
base<-pdata.frame(base, index = c("ID","time"), drop = FALSE)
Reg<-pggls(sells~ prices + income + stock+
period1 + period2+ period3, model = c("pooling"),
data=base)
This command seems to correct heteroskedasticity, but it certainly does not correct for serial correlation as I created a simple proof. Below I generated a regression between the residuals and the lagged residuals of the regression model:
res = Reg$res
n = length(res)
mod = lm(res[-n] ~ res[-1])
summary(mod)
The res[-1]
coefficient is mod is significative. So it has not solved the serial correlation.
Does somebody know how to add some option to the pggls
command to solve this?, or does somebody know a better command for solving both problems? It does not necessarily need to be a panel data command as I only have 1 individual.