[R] Error in ginv(A) : 'X' must be a numeric or complex matrix

Matteo Villa lessermatter at gmail.com
Sun Jun 14 10:07:25 CEST 2015


Dear all,

I encountered a problem that has been bugging me for some hours now,
and I still can't come up with a viable solution. I tried searching
the archives, but to no avail, so here I am sending my first e-mail to
the list!
I am estimating a binary spatial autoregressive model via a Gibbs
sampler. When I do this with a neighborhood matrix, everything goes
perfectly fine, but when I switch to a distance matrix, the program
stops almost immediately, and outputs the famous (but hardly ever
occurring):
"Error in ginv(A) : 'X' must be a numeric or complex matrix"

What strikes me as odd is that when I try to compute the generalized
inverse myself, everything goes smoothly, and all the matrixes seem to
be numeric. Below you will find the data and code for the replicable
example.

Data for the replicable example:
https://gist.github.com/lessermatter/66b6488cfe6f5d7893bf

And here is the code (the error occurs after executing the final line,
which is also a toy model to be estimated through the bsar function):
https://gist.github.com/lessermatter/0284be117a19620750aa

Any ideas?

Kind regards,

Matteo Villa
Università degli Studi di Milano
Italy



More information about the R-help mailing list