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?
Code in
spatstat
for linear networks is still under development, butlppm
is based uponppm
, so you can look at the help files or documents aboutppm
for explanation. The variable names appearing in the model formula can beim
orlinim
)funxy
orlinfun
)x
,y
(representing cartesian coordinates)marks
representing categorical mark valueA 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