SpatialQuantile.ppp {spatstat.explore}R Documentation

Spatially Weighted Quantile of Values at Points

Description

Given a spatial point pattern with numeric marks, compute a weighted quantile of the mark values, with spatially-varying weights that depend on distance to the data points.

Usage

 ## S3 method for class 'ppp'
SpatialQuantile(X, prob = 0.5, sigma = NULL, ...,
        type = 1, at = c("pixels", "points"), leaveoneout = TRUE,
        weights = NULL, edge = TRUE, diggle = FALSE, verbose = FALSE)

Arguments

X

A spatial point pattern (object of class "ppp") with numeric marks.

prob

Probability for which the quantile is required. A single numeric value between 0 and 1.

sigma

Smoothing bandwidth, passed to density.ppp.

...

Further arguments passed to density.ppp controlling the spatial smoothing.

type

Integer specifying the type of median (using the convention of quantile.default; see Details). Only types 1 and 4 are currently implemented.

at

Character string indicating whether to compute the quantile at every pixel of a pixel image (at="pixels", the default) or at every data point of X (at="points").

leaveoneout

Logical value indicating whether to compute a leave-one-out estimator. Applicable only when at="points".

weights

Optional vector of numeric weights attached to the points of X.

edge, diggle

Arguments passed to density.ppp to determine the edge correction.

verbose

Logical value specifying whether to print progress reports during the calculation.

Details

The argument X should be a spatial point pattern (object of class "ppp") with numeric marks.

The algorithm computes the weighted quantile of the mark values at each desired spatial location, using spatially-varying weights which depend on distance to the data points.

Suppose the data points are at spatial locations x_1,\ldots,x_n and have mark values y_1,\ldots,y_n. For a query location u, the smoothed quantile is defined as the weighted quantile of the mark values y_1,\ldots,y_n with weights w_1(u),\ldots,w_n(u), where

w_i(u) = \frac{k(u,x_i)}{\sum_{j=1}^n k(u,x_j)}

where k(u,v) is the smoothing kernel with bandwidth sigma.

If at="points" and leaveoneout=TRUE, then a leave-one-out calculation is performed, which means that when the query location is a data point x_i, the value at the data point is ignored, and the weighted quantile is computed from the values y_j for all j not equal to i.

The calculation of the quantile value depends on the argument type which is interpreted in the same way as for quantile.default. Currently, only types 1 and 4 are implemented. If type=1 (the default), the quantile value is one of the mark values (one of the values in marks(x)). If type=4, the quantile value is obtained by linearly interpolating between mark values. Note that the default values of type in SpatialQuantile.ppp and SpatialMedian.ppp are different.

Value

If X has a single column of marks:

If X has a data frame of marks:

The return value has attributes "sigma" and "varcov" which report the smoothing bandwidth that was used.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

See Also

SpatialMedian.ppp, SpatialMedian.

Examples

   X <- longleaf
   if(!interactive()) {
    ## mark values rounded to nearest multiple of 10 to reduce check time
    marks(X) <- round(marks(X), -1)
   }
   Z <- SpatialQuantile(X, prob=0.25, sigma=30)
   ZX <- SpatialQuantile(X, prob=0.25, sigma=30, at="points")

[Package spatstat.explore version 3.2-7 Index]