# kppm

##### Fit Cluster or Cox Point Process Model

Fit a homogeneous or inhomogeneous cluster process or Cox point process model to a point pattern.

##### Usage

```
kppm(X, trend = ~1, clusters = "Thomas", covariates = NULL, ...,
statistic="K", statargs=list())
```

##### Arguments

- X
- Point pattern (object of class
`"ppp"`

) to which the model should be fitted. - trend
- An Rformula, with no left hand side, specifying the form of the log intensity.
- clusters
- Character string determining the cluster model.
Partially matched.
Options are
`"Thomas"`

,`"MatClust"`

,`"Cauchy"`

,`"VarGamma"`

and`"LGCP"`

. - covariates
- The values of any spatial covariates (other than the Cartesian coordinates) required by the model. A named list of pixel images, functions, windows or numeric constants.
- ...
- Arguments passed to
`thomas.estK`

or`thomas.estpcf`

or`matclust.estK`

or - statistic
- The choice of summary statistic: either
`"K"`

or`"pcf"`

. - statargs
- Optional list of arguments to be used when calculating the summary statistic. See Details.

##### Details

This function fits a Cox point process model to the
point pattern dataset `X`

. Cox models are suitable for
spatially clustered point patterns.

The model may be either a *Poisson cluster process*
or a *Cox process*.
The type of model is determined by the argument `clusters`

.
Currently the options
are `clusters="Thomas"`

for the Thomas process,
`clusters="MatClust"`

for the Matern cluster process,
`clusters="Cauchy"`

for the Neyman-Scott cluster process
with Cauchy kernel,
`clusters="VarGamma"`

for the Neyman-Scott cluster process
with Variance Gamma kernel,
and `clusters="LGCP"`

for the log-Gaussian Cox process.
The first four models are Poisson cluster processes.
If the trend is constant (`~1`

)
then the model is *homogeneous*.
The empirical $K$-function of the data is computed
using `Kest`

,
and the parameters of the cluster model are estimated by
the method of minimum contrast (matching the theoretical
$K$-function of the model to the empirical $K$-function
of the data, as explained in `mincontrast`

).

Otherwise, the model is *inhomogeneous*.
The algorithm first estimates the intensity function
of the point process, by fitting a Poisson process with log intensity
of the form specified by the formula `trend`

.
Then the inhomogeneous $K$ function is estimated
by `Kinhom`

using this fitted intensity.
Finally the parameters of the cluster model
are estimated by the method of minimum contrast using the
inhomogeneous $K$ function. This two-step estimation
procedure is due to Waagepetersen (2007).
If `statistic="pcf"`

then instead of using the
$K$-function, the algorithm will use
the pair correlation function `pcf`

for homogeneous
models and the inhomogeneous pair correlation function
`pcfinhom`

for inhomogeneous models.
In this case, the smoothing parameters of the pair correlation
can be controlled using the argument `statargs`

,
as shown in the Examples.

##### Value

- An object of class
`"kppm"`

representing the fitted model. There are methods for printing, plotting, predicting, simulating and updating objects of this class.

##### References

Jalilian, A., Guan, Y. and Waagepetersen, R. (2011) Decomposition of variance for spatial Cox processes. Manuscript submitted for publication.

Waagepetersen, R. (2007)
An estimating function approach to inference for
inhomogeneous Neyman-Scott processes.
*Biometrics* **63**, 252--258.

##### See Also

methods for `kppm`

objects:
`plot.kppm`

,
`predict.kppm`

,
`simulate.kppm`

,
`update.kppm`

,
`vcov.kppm`

,
`methods.kppm`

,
`Kmodel.kppm`

,
`pcfmodel.kppm`

.

Fitting algorithms:
`thomas.estK`

,
`matclust.estK`

,
`lgcp.estK`

,
`cauchy.estK`

,
`vargamma.estK`

,
`thomas.estpcf`

,
`matclust.estpcf`

,
`lgcp.estpcf`

,
`cauchy.estpcf`

,
`vargamma.estpcf`

,
`mincontrast`

.

Summary statistics:
`Kest`

,
`Kinhom`

,
`pcf`

,
`pcfinhom`

.

See also `ppm`

##### Examples

```
data(redwood)
kppm(redwood, ~1, "Thomas")
kppm(redwood, ~x, "MatClust")
kppm(redwood, ~x, "MatClust", statistic="pcf", statargs=list(stoyan=0.2))
kppm(redwood, ~1, "LGCP", statistic="pcf")
kppm(redwood, ~x, cluster="Cauchy", statistic="K")
kppm(redwood, cluster="VarGamma", nu.ker = 0.5, statistic="pcf")
if(require(RandomFields)) {
kppm(redwood, ~x, "LGCP", statistic="pcf",
covmodel=list(model="matern", nu=0.3))
}
```

*Documentation reproduced from package spatstat, version 1.25-5, License: GPL (>= 2)*