brock brock - 3 months ago 16
R Question

Cannot comprehend this error message in Spatstat in R while using kppm function

I am trying to fit a cluster process model using the

kppm
function in the
spatstat
package in R. I am using the "thomas cluster" process based on the output of the inhomogeneous K-function plot.

Now, I am getting an error message:


system is computationally singular: reciprocal condition number = 6.62594e-21"


along with a warning message:


Cannot compute variance: Fisher information matrix is singular


What does it mean? Is my choice of model wrong? Or should I just use a ppm model? Here`s the screen shot of the error message:-

fit_actual <- kppm(pp2, ~x + y)
fit_actual
#Inhomogeneous cluster point process model Fitted to point pattern dataset ‘pp2’
#Fitted by minimum contrast
# Summary statistic:
# inhomogeneous K-function

#Error in solve.default(M) : system is computationally singular: reciprocal condition number = 6.62594e-21
#Error in solve.default(M) : system is computationally singular:
#reciprocal condition number = 6.62594e-21 In addition: Warning

# message: Cannot compute variance: Fisher information matrix is
# singular Log intensity: ~x + y
# Fitted trend coefficients: (Intercept) -1.037242e+03

# x 4.144605e-06
# y 1.353254e-04

# Cluster model: Thomas process Fitted cluster parameters:
# kappa 4.024328e-09
# Scale 6.245828e+02

#Mean cluster size: [pixel image]

#Warning message: Cannot compute variance: Fisher information matrix is singular


Please help!

Answer

This is a frequently asked question, but I'm sorry the answer is not very easy to find in the spatstat help (I will fix that).

Quick answer: rescale your dataset from metres to kilometres:

pp2 <- rescale(pp2, 1000)

then re-fit the model as in your original post.

A matrix is 'singular' if its determinant is zero, so that it cannot be inverted. It is 'computationally singular' if the determinant is very close to zero, so that a computer can't invert the matrix using its standard numerical procedures.

The Fisher information matrix is a fundamental property of a fitted model, and it must be inverted if we want to calculate the standard error of a parameter estimate, or confidence intervals, etc.

The most likely explanation for your problem is that the coordinates in your dataset are very large numbers (e.g. expressed in metres) so that the fitted model coefficients are correspondingly small numbers, so that the Fisher information matrix has very small entries, so it is computationally singular. Although the model can be fitted, when you print it the software tries to calculate standard errors, and then it falls over.

There are several other possible explanations for getting a singular matrix, such as confounding or collinearity, which are explained in the help files for vcov.ppm or anova.ppm. But these probably do not apply in your case.

Comments