Skip to content
Prev 7891 / 29559 Next

envelopes to inhomogeneous k-function based on fitted models: with spatstat

Hi Raya,


You should have provided the code that you tried 
and that "doesn't seem to recognize the lamda parameter".

Anyway, I think that the problem is that you have 
estimated the intensity at the data points only 
(your argument dataonly=TRUE). When computing the 
envelope of the Kinhom function, for each 
simulated pattern you will need an estimate of 
the intensity at the locations of each of the 
simulated points, while your "lam" object has 
only the intensity at the original point locations.

So the easiest way is using a a pixel image 
(object of class "im") assumed to contain the 
values of the intensity function at all locations 
in the window as your lambda.

Try something like this:

lam <- predict.ppm(invert.cord.model, type="trend")

or

lam <- predict.ppm(invert.cord.model, type="trend", covariates= mycovariates)

if your model includes covariates.

Then

Ki.env <- envelope( nests.ppp,  Kinhom, 
lambda=lam, simulate = expression( rpoispp(lam)), correction="translate")

if your model is an heterogeneous poisson or 
using other simulation function (rmh, rMaternI, 
rStrauss, etc) whenever appropirate.


By the way, beware of the  type of prediction 
that you want from your model. By default, 
fitted.ppm  has argument  type="lambda", which 
gives you  the conditional intensity ("lambda") . 
I think you really need the trend, i.e. you should have asked for

lam <- fitted(invert.cord.model, 
location=nestsF.ppp, dataonly=TRUE, type="trend")


Cheers,

Marcelino
At 16:37 23/03/2010, Raya A. Pruner wrote:
________________________________

Marcelino de la Cruz Rot

Departamento de  Biolog?a Vegetal
E.U.T.I. Agr?cola
Universidad Polit?cnica de Madrid
28040-Madrid
Tel.: 91 336 54 35
Fax: 91 336 56 56
marcelino.delacruz at upm.es
_________________________________