Thin plate spline on Linear Network with Spatstat

89 Views Asked by At

I have been using lppm from spatstat and I want to fit a log-linear model. I can define covariates as linfun object and use in the model. Let's say we are interested in modeling the car theft problem in Australia. let's assume cov1 is the distance to the nearest school and cov2 is the distance to the nearest police department.

We want to use X and Y coordinates in the model.

lppm(L~cov1+cov2+x+y} would work? X and Y's in the model are the location of events?

how can I use thin-plate spline on the linear network? I can create grids on ppp but lpp is not as straight forward as I think. Can I pass a matrix to lppm object?

1

There are 1 best solutions below

2
On

Code in spatstat for linear networks is still under development, but lppm is based upon ppm, so you can look at the help files or documents about ppm for explanation. The variable names appearing in the model formula can be

  • the names of images (of class im or linim)
  • the names of spatial functions (class funxy or linfun)
  • the symbols x, y (representing cartesian coordinates)
  • the symbol marks representing categorical mark value

A term in the model formula may be just the name of one of these variables, or an expression involving these variable names, including functions applied to these variables.

Your example would work.

You can get B-splines of the cartesian coordinates by including a term such as bs(x)

If you need more help, first read chapter 9 of the spatstat book