# 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, ...)` ## S3 method for class 'formula':
kppm(X,
clusters = c("Thomas","MatClust","Cauchy","VarGamma","LGCP"),
...,
data=NULL)

## S3 method for class 'ppp':
kppm(X,
trend = ~1,
clusters = c("Thomas","MatClust","Cauchy","VarGamma","LGCP"),
data = NULL,
...,
covariates=data,
method = c("mincon", "clik"),
weightfun=NULL,
control=list(),
statistic="K",
statargs=list(),
rmax = NULL,
covfunargs=NULL,
use.gam=FALSE,
nd=NULL, eps=NULL)

## S3 method for class 'quad':
kppm(X,
trend = ~1,
clusters = c("Thomas","MatClust","Cauchy","VarGamma","LGCP"),
data = NULL,
...,
covariates=data,
method = c("mincon", "clik"),
weightfun=NULL,
control=list(),
statistic="K",
statargs=list(),
rmax = NULL,
covfunargs=NULL,
use.gam=FALSE,
nd=NULL, eps=NULL)

##### Arguments

- X
- A point pattern dataset (object of class
`"ppp"`

) to which the model should be fitted, or a`formula`

in the Rlanguage defining the model. See Details. - 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"`

. - data,covariates
- The values of spatial covariates (other than the Cartesian coordinates) required by the model. A named list of pixel images, functions, windows, tessellations or numeric constants.
- ...
- Additional arguments. See Details.
- method
- The fitting method. Either
`"mincon"`

for minimum contrast, or`"clik"`

for composite likelihood. Partially matched. - weightfun
- Optional weighting function $w$
in the composite likelihood. A
`function`

in the Rlanguage. See Details. - control
- List of control parameters passed to the optimization algorithm
`optim`

. - statistic
- Name of the summary statistic to be used
for minimum contrast estimation: either
`"K"`

or`"pcf"`

. - statargs
- Optional list of arguments to be used when calculating
the
`statistic`

. See Details. - rmax
- Maximum value of interpoint distance to use in the composite likelihood.
- covfunargs,use.gam,nd,eps
- Arguments passed to
`ppm`

when fitting the intensity.

##### Details

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

.

The model may be either a *Poisson cluster process*
or another *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.

The algorithm first estimates the intensity function
of the point process using `ppm`

.
The argument `X`

may be a point pattern
(object of class `"ppp"`

) or a quadrature scheme
(object of class `"quad"`

). The intensity is specified by
the `trend`

argument.
If the trend formula is `~1`

(the default)
then the model is *homogeneous*. The algorithm begins by
estimating the intensity as the number of points divided by
the area of the window.
Otherwise, the model is *inhomogeneous*.
The algorithm begins by fitting a Poisson process with log intensity
of the form specified by the formula `trend`

.
(See `ppm`

for further explanation).

The argument `X`

may also be a `formula`

in the
Rlanguage. The right hand side of the formula gives the
`trend`

as described above. The left hand side of the formula
gives the point pattern dataset to which the model should be fitted.
The clustering parameters of the model are then fitted
either by minimum contrast estimation, or by maximum
composite likelihood.

[object Object],[object Object]
In both methods, the optimisation is performed by the generic
optimisation algorithm `optim`

.
The behaviour of this algorithm can be modified using the
argument `control`

.
Useful control arguments include
`trace`

, `maxit`

and `abstol`

(documented in the help for `optim`

).

##### 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

Guan, Y. (2006)
A composite likelihood approach in fitting spatial point process
models.
*Journal of the American Statistical Association*
**101**, 1502--1512.

Jalilian, A., Guan, Y. and Waagepetersen, R. (2012)
Decomposition of variance for spatial Cox processes.
*Scandinavian Journal of Statistics*, in press.

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`

,
`fitted.kppm`

,
`predict.kppm`

,
`simulate.kppm`

,
`update.kppm`

,
`vcov.kppm`

,
`methods.kppm`

,
`as.ppm.kppm`

,
`Kmodel.kppm`

,
`pcfmodel.kppm`

.

Minimum contrast 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

```
# method for point patterns
kppm(redwood, ~1, "Thomas")
# method for formulas
kppm(redwood ~ 1, "Thomas")
kppm(redwood ~ 1, "Thomas", method="c")
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),
control=list(maxit=10))
}
```

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