# compareFit

##### Residual Diagnostics for Multiple Fitted Models

Compares several fitted point process models using the same residual diagnostic.

##### Usage

```
compareFit(object, Fun, r = NULL, breaks = NULL, ...,
trend = ~1, interaction = Poisson(), rbord = NULL,
modelnames = NULL, same = NULL, different = NULL)
```

##### Arguments

- object
- Object or objects to be analysed.
Either a fitted point process model (object of class
`"ppm"`

), a point pattern (object of class`"ppp"`

), or a list of these objects. - Fun
- Diagnostic function to be computed for each model.
One of the functions
`Kcom`

,`Kres`

,`Gcom`

,`Gres`

,`psst`

,`psstA`

or`psstG`

or a string containing one of these - r
- Optional. Vector of values of the argument $r$ at which the diagnostic should be computed. This argument is usually not specified. There is a sensible default.
- breaks
- Optional alternative to
`r`

for advanced use. - ...
- Extra arguments passed to
`Fun`

. - trend,interaction,rbord
- Optional. Arguments passed to
`ppm`

to fit a point process model to the data, if`object`

is a point pattern or list of point patterns. See`ppm`

- modelnames
- Character vector. Short descriptive names for the different models.
- same,different
- Character strings or character vectors passed to
`collapse.fv`

to determine the format of the output.

##### Details

This is a convenient way to collect diagnostic information for several different point process models fitted to the same point pattern dataset, or for point process models of the same form fitted to several different datasets, etc.

The first argument, `object`

, is usually a list of
fitted point process models
(objects of class `"ppm"`

), obtained from the
model-fitting function `ppm`

.

For convenience, `object`

can also be a list of point patterns
(objects of class `"ppp"`

).
In that case, point process models will be fitted to
each of the point pattern datasets,
by calling `ppm`

using the arguments
`trend`

(for the first order trend),
`interaction`

(for the interpoint interaction)
and `rbord`

(for the erosion distance in the border correction
for the pseudolikelihood). See `ppm`

for details
of these arguments.

Alternatively `object`

can be a single point pattern
(object of class `"ppp"`

) and one or more of the arguments
`trend`

, `interaction`

or `rbord`

can be a list. In this case, point process models will be fitted to
the same point pattern dataset, using each of the model specifications
listed.

The diagnostic function `Fun`

will be applied to each of the
point process models. The results will be collected into a single
function value table. The `modelnames`

are used to label the
results from each fitted model.

##### Value

- Function value table (object of class
`"fv"`

).

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