Closed karolinakamuda closed 2 years ago
The error happens in pwaldtest
(called by summary
):
summary(model.obj) # errors
pwaldtest(model.obj) # errors
# Error in solve.default(vcov(x)[names.coefs_wo_int, names.coefs_wo_int], :
# system is computationally singular: reciprocal condition number = 5.70506e-18
This is due to the specific data constellation as the variance-covariance matrix is not invertible, more precisely this (simplified) code in pwaldtest
yields the error: solve(vcov(model.obj))
.
When manipulating the tolerance, the matrix is invertible:
solve(vcov(model.obj), tol = .Machine$double.eps^2)
Versions up to plm 2.2-2 used a different approach to calculate the Wald statistic ((tss-ssr)/(ssr/df2)) but we saw issues with that as well. I do not think we can do much about it. Manipulating the tolerance will likely yield to computational precission issues for other data constellations. Maybe some scaling of your variables or a slightly different model won't have the computational issues as the data constellation will be a different one.
Making as question and closing this - feel free to post your thoughts and re-open
There is a problem with covariance matrix when regressors values' levels differ from one another. Problem appears in few recent versions of plm package.
Code below works in some older package versions (there is no error when running it with plm package version 2.2-2) but does not work in recent plm versions, including version 2.6-0.
regressors.csv