# clusterfit

##### Fit Cluster or Cox Point Process Model via Minimum Contrast

Fit a homogeneous or inhomogeneous cluster process or Cox point process model to a point pattern by the Method of Minimum Contrast.

##### Usage

```
clusterfit(X, clusters, lambda = NULL, startpar = NULL,
q = 1/4, p = 2, rmin = NULL, rmax = NULL, …,
statistic = NULL, statargs = NULL, algorithm="Nelder-Mead")
```

##### Arguments

- X
Data to which the cluster or Cox model will be fitted. Either a point pattern or a summary statistic. See Details.

- clusters
Character string determining the cluster or Cox model. Partially matched. Options are

`"Thomas"`

,`"MatClust"`

,`"Cauchy"`

,`"VarGamma"`

and`"LGCP"`

.- lambda
Optional. An estimate of the intensity of the point process. Either a single numeric specifying a constant intensity, a pixel image (object of class

`"im"`

) giving the intensity values at all locations, a fitted point process model (object of class`"ppm"`

or`"kppm"`

) or a`function(x,y)`

which can be evaluated to give the intensity value at any location.- startpar
Vector of initial values of the parameters of the point process mode. If

`X`

is a point pattern sensible defaults are used. Otherwise rather arbitrary values are used.- q,p
Optional. Exponents for the contrast criterion.

- rmin, rmax
Optional. The interval of \(r\) values for the contrast criterion.

- …
Additional arguments passed to

`mincontrast.`

- statistic
Optional. 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.- algorithm
Character string determining the mathematical optimisation algorithm to be used by

`optim`

. See the argument`method`

of`optim`

.

##### Details

This function fits the clustering parameters of a cluster or Cox point
process model by the Method of Minimum Contrast, that is, by
matching the theoretical \(K\)-function of the model to the
empirical \(K\)-function of the data, as explained in
`mincontrast`

.

If `statistic="pcf"`

(or `X`

appears to be an
estimated pair correlation function) then instead of using the
\(K\)-function, the algorithm will use the pair correlation
function.

If `X`

is a point pattern of class `"ppp"`

an estimate of
the summary statistic specfied by `statistic`

(defaults to
`"K"`

) is first computed before minimum contrast estimation is
carried out as described above. In this case the argument
`statargs`

can be used for controlling the summary statistic
estimation. The precise algorithm for computing the summary statistic
depends on whether the intensity specification (`lambda`

) is:

- homogeneous:
If

`lambda`

is`NUll`

or a single numeric the pattern is considered homogeneous and either`Kest`

or`pcf`

is invoked. In this case`lambda`

is**not**used for anything when estimating the summary statistic.- inhomogeneous:
If

`lambda`

is a pixel image (object of class`"im"`

), a fitted point process model (object of class`"ppm"`

or`"kppm"`

) or a`function(x,y)`

the pattern is considered inhomogeneous. In this case either`Kinhom`

or`pcfinhom`

is invoked with`lambda`

as an argument.

After the clustering parameters of the model have been estimated by
minimum contrast `lambda`

(if non-null) is used to compute the
additional model parameter \(\mu\).

##### Value

An object of class `"minconfit"`

. There are methods for printing
and plotting this object. See `mincontrast`

.

##### References

Diggle, P.J. and Gratton, R.J. (1984)
Monte Carlo methods of inference for implicit statistical models.
*Journal of the Royal Statistical Society, series B*
**46**, 193 -- 212.

Moller, J. and Waagepetersen, R. (2003). Statistical Inference and Simulation for Spatial Point Processes. Chapman and Hall/CRC, Boca Raton.

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

##### See Also

##### Examples

```
# NOT RUN {
fit <- clusterfit(redwood, "Thomas")
fit
if(interactive()){
plot(fit)
}
# }
```

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