Error: 'X' must be a numeric or complex matrix [in a binary spatial autoregressive model]

730 views Asked by At

I am estimating a binary spatial autoregressive model via a Gibbs sampler in R. When I do this using a neighborhood matrix, everything goes perfectly fine, but when I switch to a distance matrix, the program stops almost immediately, and outputs the infamous:

"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 Link

Code (the error occurs after executing the final line, which is also a toy model to be estimated through the bsar function):

Code Link

Any ideas?

0

There are 0 answers