# Kres

##### Residual K Function

Given a point process model fitted to a point pattern dataset, this function computes the residual $K$ function, which serves as a diagnostic for goodness-of-fit of the model.

##### Usage

`Kres(object, ...)`

##### Arguments

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

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

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

), or the value returned by a pr - ...
- Arguments passed to
`Kcom`

.

##### Details

This command provides a diagnostic for the goodness-of-fit of a point process model fitted to a point pattern dataset. It computes a residual version of the $K$ function of the dataset, which should be approximately zero if the model is a good fit to the data.

In normal use, `object`

is a fitted point process model
or a point pattern. Then `Kres`

first calls `Kcom`

to compute both the nonparametric estimate of the $K$ function
and its model compensator. Then `Kres`

computes the
difference between them, which is the residual $K$-function.
Alternatively, `object`

may be a function value table
(object of class `"fv"`

) that was returned by
a previous call to `Kcom`

. Then `Kres`

computes the
residual from this object.

##### Value

- A function value table (object of class
`"fv"`

), essentially a data frame of function values. There is a plot method for this class. See`fv.object`

.

##### References

Baddeley, A., Rubak, E. and *Statistical Science* **26**, 613--646.
}
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

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