# quantess

##### Quantile Tessellation

Divide space into tiles which contain equal amounts of stuff.

##### Usage

`quantess(M, Z, n, …)`# S3 method for owin
quantess(M, Z, n, …, type=2, origin=c(0,0), eps=NULL)

# S3 method for ppp
quantess(M, Z, n, …, type=2, origin=c(0,0), eps=NULL)

# S3 method for im
quantess(M, Z, n, …, type=2, origin=c(0,0))

##### Arguments

- M
A spatial object (such as a window, point pattern or pixel image) determining the weight or amount of stuff at each location.

- Z
A spatial covariate (a pixel image or a

`function(x,y)`

) or one of the strings`"x"`

or`"y"`

indicating the Cartesian coordinates \(x\) or \(y\), or one of the strings`"rad"`

or`"ang"`

indicating polar coordinates. The range of values of`Z`

will be broken into`n`

bands containing equal amounts of stuff.- n
Number of bands. A positive integer.

- type
Integer specifying the rule for calculating quantiles. Passed to

`quantile.default`

.- …
Additional arguments passed to

`quadrats`

or`tess`

defining another tessellation which should be intersected with the quantile tessellation.- origin
Location of the origin of polar coordinates, if

`Z="rad"`

or`Z="ang"`

. Either a numeric vector of length 2 giving the location, or a point pattern containing only one point, or a list with two entries named`x`

and`y`

, or one of the character strings`"centroid"`

,`"midpoint"`

,`"left"`

,`"right"`

,`"top"`

,`"bottom"`

,`"topleft"`

,`"bottomleft"`

,`"topright"`

or`"bottomright"`

(partially matched).- eps
Optional. The size of pixels in the approximation which is used to compute the quantiles. A positive numeric value, or vector of two positive numeric values.

##### Details

A *quantile tessellation* is a division of space into
pieces which contain equal amounts of stuff.

The function `quantess`

computes a quantile tessellation and
returns the tessellation itself.
The function `quantess`

is generic, with methods for
windows (class `"owin"`

), point patterns (`"ppp"`

)
and pixel images (`"im"`

).

The first argument `M`

(for mass) specifies the spatial
distribution of stuff that is to be divided. If `M`

is a window,
the *area* of the window is to be divided into `n`

equal pieces.
If `M`

is a point pattern, the *number of points* in the
pattern is to be divided into `n`

equal parts, as far as
possible. If `M`

is a pixel image, the pixel values are
interpreted as weights, and the *total weight* is to be divided
into `n`

equal parts.

The second argument
`Z`

is a spatial covariate. The range of values of `Z`

will be divided into `n`

bands, each containing
the same total weight. That is, we determine the quantiles of `Z`

with weights given by `M`

.

For convenience, additional arguments `…`

can be given,
to further subdivide the tiles of the tessellation. These arguments
should be recognised by one of the functions
`quadrats`

or `tess`

. The tessellation
determined by these arguments is intersected with the quantile tessellation.

The result of `quantess`

is a tessellation of `as.owin(M)`

determined by the quantiles of `Z`

.

##### Value

A tessellation (object of class `"tess"`

).

##### See Also

##### Examples

```
# NOT RUN {
plot(quantess(letterR, "x", 5))
plot(quantess(bronzefilter, "x", 6))
points(unmark(bronzefilter))
plot(quantess(letterR, "rad", 7, origin=c(2.8, 1.5)))
plot(quantess(letterR, "ang", 7, origin=c(2.8, 1.5)))
opa <- par(mar=c(0,0,2,5))
A <- quantess(Window(bei), bei.extra$elev, 4)
plot(A, ribargs=list(las=1))
B <- quantess(bei, bei.extra$elev, 4)
tilenames(B) <- paste(spatstat.utils::ordinal(1:4), "quartile")
plot(B, ribargs=list(las=1))
points(bei, pch=".", cex=2, col="white")
par(opa)
# }
```

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