Skip to content

Computing transformations on ppp objects #8

Description

@mjemons

Dear authors

I am trying to write a small package that can extract variables from a SpatialExperiment object, transform them into a point pattern object and then compute point process models on them

A minimal example below shows a current limitation I face. Ideally, I would like to be able to specify functions/transformations on ppp objects with the R formula interface. However, mpl.get_covariates does not let me pass ppp objects in data to ppm. Could you maybe relax this assertion to allow for transformations of ppp objects which in turn are then windows or images? Precomputing would work too, but is less elegant in my opinion. Some functions like e.g. s(x) do work as being passed directly as transformations, only the functions on pppobjects pose a problem.

Thank you in advance for your help,
Martin

library("spatstat.model")
ama <- amacrine[square(0.7)]
resp <- spatstat.geom::unmark(ama[ama$marks %in% "on", drop = TRUE])
off <- spatstat.geom::unmark(ama[ama$marks %in% "off", drop = TRUE])

data <- list(response = resp,
            off = off)

ppm(response ~ distfun(off), data = data)
## fails

data[["doff"]] <- with(ama,distfun(off))

ppm(response ~ doff, data = data)
## works

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions