Solved – Linear dependence problem with time covariate and time dummies (in R)

rregression

This is related to a question I asked a couple weeks ago, but I've got a new question related to the same data. You can find the data and its accompanying explanation in the link provided.

I felt that a regression including year as a covariate along with year dummies would lead to a linear dependence problem, but I was told to try it anyway as

"the year dummies as independent variables [may] pick up year-specific
random effects not accounted for by a time trend, e.g. for example the
trend over all years could be down by say 2 percent per year which
could apply to most years, but a negative macro shock in one
particular year could make that year lie way off the regression
line–a simple example of why the year dummies are not co-linear with
a time trend."

This makes sense, I suppose, so I ran a regression that simply included year and year dummies for each year as the independent variables (including AR(1) corrections). This looked like the following:

> ## Generate YearFactor and AgeGroupFactor using factor()
> 
> YearFactor <- factor(YearVar)
> AgeGroupFactor <- factor(AgeGroup)
> 
> ## Check to see that YearFactor and AgeGroupFactor are indeed factor variables
> 
> is.factor(YearFactor)
[1] TRUE
> is.factor(AgeGroupFactor)
[1] TRUE
>
> ## Run regressions with both time trend and year dummies to determine if a linear dependence problem exists.
> 
> TrendDummies <- gls(PPHPY ~ YearVar + YearFactor, correlation=corARMA(p=1))
Error in glsEstimate(object, control = control) : 
 computed "gls" fit is singular, rank 13
> summary(TrendDummies)
Error in summary(TrendDummies) : object 'TrendDummies' not found
>

I interpret the error message "Error in glsEstimate(object, control = control) :
computed "gls" fit is singular, rank 13" to mean that there indeed is a linear dependence problem in this case. Am I properly interpreting this?

Also, given the advice in quotes above, would my regression as constructed (if there were no linear dependence problems) capture the effects mentioned therein?

And finally, if I run the same regression as OLS with no AR(1) correlation structure, I do indeed get some results (instead of an error message). Any thoughts on that?

Best Answer

Typically, you wouldn't include a time trend and time dummies for exactly the reasons that you highlight. The time dummies are more flexible and are generally preferred (you can test whether they are better than the time trend alone).

I'm guessing that the OLS gives you results, but throws out one of the time dummies (one more than usual, that is).