Model fitting in Spatstat

Parameter explanation

To begin with, I will continue with the rescaling Guassian Random field part. Talk it in more detail and interpret the parameter which is discussed in the last week.

  1. Why we want to rescale the GRF

The GRF is a stochastic process that can be characterized by its mean function \(\mu(u)\) and covariance function \(C(u,v)\), which specify the expected value and covariance between observations at different locations. The problem is the scale of the covariate values and the covariance function may not be consistent with the scale of the observed point pattern. This can result in poorly scaled and difficult-to-interpret parameter estimates.

To solve the problem, we need to rescale the covariate values and covariance function to be on a comparable scale to the observed point pattern. We could rescale the GRF using a “standardization” factor, K function parameter, that depends on the covariance function and the intensity of the point pattern.

  1. The K function parameter

\[Z(s) = \frac{\sqrt {\lambda(s)} }{\pi}\int_w\frac{exp\{-\frac{d(s,u)^2}{\sigma^2}\}}{\sqrt\pi\sigma}[f(u)-\alpha-v^Tx(u)]du\]

\(\mathbf{Z}(s)\) : the value of the rescaled GRF at location \(s\). \(\lambda(s)\): the intensity function of the point pattern at location \(s\). \(\mathcal{W}\) : the spatial domain in which the point pattern is observed. \(d(s,u)\) : the distance between locations \(s\) and \(u\). \(\sigma\) : the spatial scale parameter that controls the range of spatial dependence in the GRF. \(f(u)\) : the unknown underlying Gaussian random field that generates the point pattern data. \(\alpha\) : the intercept parameter that represents the baseline intensity of the point pattern. \(\mathbf{v}\) : a vector of coefficients that represent the effects of covariates on the spatial trend. \(\mathbf{x}(u)\) : a vector of covariate values at location \(u\).

Model fit the log-Gaussian Cox process

I tried to use the RandomFieldUtils last time to simulate a dataset first, however, my anaconda have some probelm, and continuing updating. So here I tried the dataset in package first.

  1. Load library and dataset
library(spatstat)
## Loading required package: spatstat.data
## Loading required package: spatstat.geom
## spatstat.geom 3.0-6
## Loading required package: spatstat.random
## spatstat.random 3.1-3
## Loading required package: spatstat.explore
## Loading required package: nlme
## spatstat.explore 3.0-6
## Loading required package: spatstat.model
## Loading required package: rpart
## spatstat.model 3.2-1
## Loading required package: spatstat.linnet
## spatstat.linnet 3.0-6
## 
## spatstat 3.0-3 
## For an introduction to spatstat, type 'beginner'
library(spatstat.utils)
data("swedishpines")
X=swedishpines

2.Explore the dataset

plot(X)

summary(X)
## Planar point pattern:  71 points
## Average intensity 0.007395833 points per square unit (one unit = 0.1 metres)
## 
## Coordinates are integers
## i.e. rounded to the nearest unit (one unit = 0.1 metres)
## 
## Window: rectangle = [0, 96] x [0, 100] units
## Window area = 9600 square units
## Unit of length: 0.1 metres
plot(allstats(X))

  1. Fit model

So here is the problem, after the research, it seems do not have a specific process for log-Guassian. Here it gave the process of Strauss, which is maximum pseudolikelihood. However, the ppm method do have arguement interaction to define the model. I still need to try this part to fit the log-Guassian model.

fit = ppm(X, ~1,Strauss(r=7))
fit
## Stationary Strauss process
## Fitted to point pattern dataset 'X'
## 
## First order term:  beta = 0.02741274
## 
## Interaction distance:    7
## Fitted interaction parameter gamma:  0.1607745
## 
## Relevant coefficients:
## Interaction 
##   -1.827753 
## 
## For standard errors, type coef(summary(x))
plot(fit)