Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

spatialcdf

Spatial Cumulative Distribution Function


Description

Compute the spatial cumulative distribution function of a spatial covariate, optionally using spatially-varying weights.

Usage

spatialcdf(Z, weights = NULL, normalise = FALSE, ..., W = NULL, Zname = NULL)

Arguments

Z

Spatial covariate. A pixel image or a function(x,y,...)

weights

Spatial weighting for different locations. A pixel image, a function(x,y,...), a window, a constant value, or a fitted point process model (object of class "ppm" or "kppm").

normalise

Logical. Whether the weights should be normalised so that they sum to 1.

...

Arguments passed to as.mask to determine the pixel resolution, or extra arguments passed to Z if it is a function.

W

Optional window (object of class "owin") defining the spatial domain.

Zname

Optional character string for the name of the covariate Z used in plots.

Details

If weights is missing or NULL, it defaults to 1. The values of the covariate Z are computed on a grid of pixels. The weighted cumulative distribution function of Z values is computed, taking each value with weight equal to the pixel area. The resulting function F is such that F(t) is the area of the region of space where Z <= t.

If weights is a pixel image or a function, then the values of weights and of the covariate Z are computed on a grid of pixels. The weights are multiplied by the pixel area. Then the weighted empirical cumulative distribution function of Z values is computed using ewcdf. The resulting function F is such that F(t) is the total weight (or weighted area) of the region of space where Z <= t.

If weights is a fitted point process model, then it should be a Poisson process. The fitted intensity of the model, and the value of the covariate Z, are evaluated at the quadrature points used to fit the model. The weights are multiplied by the weights of the quadrature points. Then the weighted empirical cumulative distribution of Z values is computed using ewcdf. The resulting function F is such that F(t) is the expected number of points in the point process that will fall in the region of space where Z <= t.

If normalise=TRUE, the function is normalised so that its maximum value equals 1, so that it gives the cumulative fraction of weight or cumulative fraction of points.

The result can be printed, plotted, and used as a function.

Value

A cumulative distribution function object belonging to the classes "spatialcdf", "ewcdf", "ecdf" (only if normalise=TRUE) and "stepfun".

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

with(bei.extra, {
     plot(spatialcdf(grad))
     fit <- ppm(bei ~ elev)
     plot(spatialcdf(grad, predict(fit)))
     plot(A <- spatialcdf(grad, fit))
     A(0.1)
  })
  plot(spatialcdf("x", W=letterR))

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.