Computes the Receiver Operating Characteristic curve for a point pattern on a linear network or a fitted point process model on a linear network.
# S3 method for lpp
roc(X, covariate,
...,
baseline = NULL, high = TRUE, weights = NULL,
method = "raw",
CI = "none", alpha=0.05,
subset=NULL)# S3 method for lppm
roc(X, covariate=NULL,
..., baseline=NULL, high=TRUE,
method = "raw",
CI = "none", alpha=0.05,
leaveoneout=FALSE, subset=NULL)
Function value table (object of class "fv"
)
which can be plotted to show the ROC curve.
Also belongs to class "roc"
.
Point pattern on a network (object of class "lpp"
)
or fitted point process model on a network
(object of class "lppm"
).
Spatial covariate. Either a function(x,y)
,
a pixel image (object of class "im"
or "linim"
), or
one of the strings "x"
or "y"
indicating the
Cartesian coordinates.
Traditionally omitted when X
is a fitted model.
Arguments passed to as.mask
controlling the
pixel resolution for calculations.
Optional. A spatial object giving a baseline intensity.
Usually a function(x,y)
or
a pixel image (object of class "im"
or "linim"
)
giving the baseline intensity at any location on the network.
Alternatively a point pattern on the network
(object of class "lpp"
)
giving the locations of the reference population.
Logical value indicating whether the threshold operation should favour high or low values of the covariate.
Optional. Numeric vector of weights attached to the data points.
The method or methods that should be used to estimate the ROC curve.
A character vector: current choices are
"raw"
, "monotonic"
, "smooth"
and "all"
.
See Details.
Character string (partially matched) specifying whether confidence intervals should be computed, and for which method. See Details.
Numeric value between 0 and 1. The confidence intervals will have
confidence level 1-alpha
. The default gives 95%
confidence intervals.
Optional. A spatial window (object of class "owin"
)
specifying a subset of the data, from which the ROC should be
calculated.
Logical value specifying (for roc.lppm
) whether the fitted intensity
of the model at each of the original data points should be computed
by the leave-one-out procedure
(i.e. by removing the data point in question from the point pattern,
re-fitting the model to the reduced point pattern, and computing the
intensity of this modified model at the point in question)
as described in Baddeley et al (2025).
It is also possible to specify leaveoneout=c(TRUE,FALSE)
so that both versions are calculated.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
The command roc
computes the Receiver Operating
Characteristic curve.
The area under the ROC is computed by auc
.
The function roc
is generic,
with methods for point patterns, fitted point process models
and other kinds of data.
This help file describes the methods for classes "lpp"
and
"lppm"
.
For a point pattern X
and a covariate Z
, the
ROC is a plot showing the ability of the
covariate to separate the spatial domain
into areas of high and low density of points.
For each possible threshold \(z\), the algorithm calculates
the fraction \(a(z)\) of area in the study region where the
covariate takes a value greater than \(z\), and the
fraction \(b(z)\) of data points for which the covariate value
is greater than \(z\). The ROC is a plot of \(b(z)\) against
\(a(z)\) for all thresholds \(z\).
For a fitted point process model, the ROC shows the ability of the fitted model intensity to separate the spatial domain into areas of high and low density of points. The ROC is not a diagnostic for the goodness-of-fit of the model (Lobo et al, 2007).
Baddeley, A., Rubak, E., Rakshit, S. and Nair, G. (2025) ROC curves for spatial point patterns and presence-absence data. tools:::Rd_expr_doi("10.48550/arXiv.2506.03414")..
Lobo, J.M., Jimenez-Valverde, A. and Real, R. (2007) AUC: a misleading measure of the performance of predictive distribution models. Global Ecology and Biogeography 17(2) 145--151.
Nam, B.-H. and D'Agostino, R. (2002) Discrimination index, the area under the ROC curve. Pages 267--279 in Huber-Carol, C., Balakrishnan, N., Nikulin, M.S. and Mesbah, M., Goodness-of-fit tests and model validity, Birkhauser, Basel.
auc
plot(roc(spiders, "x"))
fit <- lppm(spiders ~ x)
plot(roc(fit))
Run the code above in your browser using DataLab