Skip to content

Automatically resolve perfect multi-collinearity? #45

@christophsax

Description

@christophsax

In case of perfect multi-collinearity, td() runs into a ‘singular matrix’ issue (example by @felicitaskemeny):

library(tempdisagg)
y <- ts(rnorm(n = 20), start = 1995)
x <- ts(rnorm(n = 80), start = 1995, freq = 4)
dummy <- ts(rep(0, 80), start = 1995, freq = 4)
disagg <- td(y ~  x + dummy)
#> Error in backsolve(R, c1 - C1 %*% v): singular matrix in 'backsolve'. First zero in diagonal [3]

The solution of course is to drop the dummy. But lm() is smarter and does that autmatically for you.

y2 <- ts(rnorm(n=80), start=1995, freq=4)
lm(y2 ~  x + dummy)
#> 
#> Call:
#> lm(formula = y2 ~ x + dummy)
#> 
#> Coefficients:
#> (Intercept)            x        dummy  
#>     0.01285      0.19844           NA

Should we have something similar in td()?

Created on 2020-09-09 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions