0

I am trying to fit a cluster process model using the kppm function in the spatstat package in R. 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:-

#Inhomogeneous cluster point process model Fitted to point pattern dataset 
#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!

brock
  • 181
  • 2
  • 10
  • As mentioned by Marcel in the answer below it would indeed be interesting to know the size and units of your study region (and the number of points). Your estimate of kappa is 4 cluster centres per billion square units, and the scale parameter of the Gaussian kernel is 600 units, so maybe the estimation procedure has fitted a model which often produces empty point patterns and then every once in a while gives you a pattern with a single heavy cluster. If you can provide data it might be possible to say more. – Ege Rubak Sep 04 '16 at 13:01

2 Answers2

1

Just a guess but internally the kppm function uses solve, see:

https://github.com/cran/spatstat/blob/master/R/kppm.R#L907

If you have very small numbers in your calculation the algorithm of the solve function leads to the assumption of a singular matrix (if not using a special function attribute to set the tolerance), see:

Mahalonobis distance in R, error: system is computationally singular

What happens if you change your unit to another scale to avoid small numbers?

Community
  • 1
  • 1
Marcel
  • 502
  • 3
  • 11
  • This seems to be a plausible explanation. Thank you! I will change the unit to another scale and see if it works. – brock Sep 04 '16 at 09:39
1

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.

Adrian Baddeley
  • 1,956
  • 1
  • 8
  • 7
  • Thank you so much! I rescaled my dataset to kilometers and ran the same model again. This time I didn`t get any error messages and was able to get the se and vcov of the estimate! – brock Sep 05 '16 at 03:22