0

I'm with spatstat package in R.I'm working on species distribution models mainly on point process models.

My goal is to evaluate the predictive performance of point process models of Gibbs, Log-Gaussian Cox, and many more, point processes.

I've fitted Gibbs models to my data and when doing prediction

predict(f.ppm, window = W, covariates=present$bio4)

an error occurs

Error in covariates[covnames.needed] : objet de type 'S4' non indicable

which means that object of type 'S4' cannot be identified.

present yields:

class      : RasterStack 
dimensions : 694, 350, 242900, 5  (nrow, ncol, ncell, nlayers)
resolution : 1000, 1000  (x, y)
extent     : 248674.5, 598674.5, 683042.6, 1377043  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=31 +ellps=WGS84 +units=m +no_defs 
names      :       bio4,       llds,       mimq,        pet,         SV 
min values :   10.02888,    4.00000,   95.45561, 1293.52945,    0.00000 
max values :   25.00000,    8.00000,  222.91389, 2062.00000,    7.80565 
Pax
  • 664
  • 4
  • 23
Luc
  • 1
  • 2
  • Can you please provide data? See https://stackoverflow.com/help/minimal-reproducible-example I think your problem arises from `present$bio4`. What is the output of it? – Pax Sep 11 '21 at 10:06

1 Answers1

0

Presumably your object f.ppm is a fitted model of class ppm. Then your code is invoking the predict method for this class, predict.ppm. The help file for predict.ppm states that the argument covariates should be "either a data frame, or a list of pixel images of class im". Your data present$bio4 does not conform to either of these formats. You will need to convert the data to the required format.

Adrian Baddeley
  • 2,534
  • 1
  • 5
  • 8