Title: | Spatial Point Patterns Analysis |
---|---|
Description: | Perform first- and second-order multi-scale analyses derived from Ripley K-function (Ripley B. D. (1977) <doi:10.1111/j.2517-6161.1977.tb01615.x>), for univariate, multivariate and marked mapped data in rectangular, circular or irregular shaped sampling windows, with tests of statistical significance based on Monte Carlo simulations. |
Authors: | Raphael Pelissier [aut], Francois Goreaud [aut], Dominique Lamonica [cre] |
Maintainer: | Dominique Lamonica <[email protected]> |
License: | GPL-2 |
Version: | 1.5-10 |
Built: | 2024-11-04 05:34:23 UTC |
Source: | https://github.com/cran/ads |
Spatial pattern of sound and split oaks (Quercus petraea) suffering from frost shake in a 2.35-ha plot in Allogny, France.
data(Allogny)
data(Allogny)
A list with 4 components:$rect
is a vector of coordinates of the origin and the opposite corner of a 125 by 188 m square plot.
$trees
is a list of tree coordinates .
$status
is a factor with 2 levels .
Grandjean, G., Jabiol, B., Bruchiamacchie, M. and Roustan, F. 1990. Recherche de correlations entre les parametres edaphiques, et plus specialement texture, hydromorphie et drainage interne, et la reponse individuelle des chenes sessiles et pedoncules ? la gelivure. Rapport de recherche ENITEF, Nogent sur Vernisson, France.
Goreaud, F. & Pelissier, R. 2003. Avoiding misinterpretation of biotic interactions with the intertype K12-function: population independence vs. random labelling hypotheses. Journal of Vegetation Science, 14: 681-692.
data(Allogny) allo.spp <- spp(Allogny$trees, mark=Allogny$status, window=Allogny$rect) plot(allo.spp)
data(Allogny) allo.spp <- spp(Allogny$trees, mark=Allogny$status, window=Allogny$rect) plot(allo.spp)
Function area.swin
computes the area of a sampling window.
area.swin(w)
area.swin(w)
w |
an object of class |
For "simple"
sampling windows, returns simply the area of the rectangle or circle delineating the study region.
For "complex"
sampling windows, returns the area of the initial rectangle or circle, minus the total area of the
triangles to remove (see swin
).
The area of the sampling window.
swin
.
## Not run: rectangle of size [0,110] x [0,90] wr<-swin(c(0,0,110,90)) area.swin(wr) ## Not run: circle with radius 50 centred on (55,45) wc<-swin(c(55,45,50)) area.swin(wc) ## Not run: polygon (diamond shape) t1 <- c(0,0,55,0,0,45) t2 <- c(55,0,110,0,110,45) t3 <- c(0,45,0,90,55,90) t4 <- c(55,90,110,90,110,45) wp <- swin(wr, rbind(t1,t2,t3,t4)) area.swin(wp)
## Not run: rectangle of size [0,110] x [0,90] wr<-swin(c(0,0,110,90)) area.swin(wr) ## Not run: circle with radius 50 centred on (55,45) wc<-swin(c(55,45,50)) area.swin(wc) ## Not run: polygon (diamond shape) t1 <- c(0,0,55,0,0,45) t2 <- c(55,0,110,0,110,45) t3 <- c(0,45,0,90,55,90) t4 <- c(55,90,110,90,110,45) wp <- swin(wr, rbind(t1,t2,t3,t4)) area.swin(wp)
Spatial pattern of 162 beeches, 72 oaks and 3 hornbeams in a 1-ha 140 yr-old temperate forest plot in Haye, France.
data(BPoirier)
data(BPoirier)
A list with 8 components:$rect
is a vector of coordinates of the origin and the opposite corner of a 110 by 90 m rectangular plot.
$tri1
is a list of vertex coordinates of contiguous triangles covering the denser part of the plot.
$tri2
is a list of vertex coordinates of contiguous triangles covering the sparser part of the plot.
$poly1
is a list of vertex coordinates of the polygon enclosing
BPoirier$tri1
.$poly2
is a list of two polygons vertex coordinates enclosing
BPoirier$tri2
.$trees
is a list of tree coordinates .
$species
is a factor with 3 levels corresponding to species names of the trees.
$dbh
is a vector of tree size (diameter at breast height in cm).
Parde, J. 1981. De 1882 a 1976/80 : les places d'experience de sylviculture du hetre en foret domaniale de Haye. Revue Forestiere Francaise, 33: 41-64.
Goreaud, F. 2000. Apports de l'analyse de la structure spatiale en foret temperee a l'etude et la modelisation des peuplements complexes. These de doctorat, ENGREF, Nancy, France.
Pelissier, R. & Goreaud, F. 2001. A practical approach to the study of spatial structure in simple cases of heterogeneous vegetation. Journal of Vegetation Science, 12: 99-108.
data(BPoirier) BP.spp <- spp(BPoirier$trees, mark=BPoirier$species, window=BPoirier$rect) plot(BP.spp)
data(BPoirier) BP.spp <- spp(BPoirier$trees, mark=BPoirier$species, window=BPoirier$rect) plot(BP.spp)
Spatial pattern of 34 mature individuals and 173 young individuals of the tree species Couepia caryophylloides (Chrysobalanaceae) in a 25-ha forest plot in Paracou, French Guiana.
data(Couepia)
data(Couepia)
A list with 4 components:$rect
is a vector of coordinates of the origin and the opposite corner of a 500 by 500 m rectangular plot.
$tri
is a list of vertex coordinates of contiguous triangles covering swampy parts of the plot.
$trees
is a list of tree coordinates .
$stage
is a factor with 2 levels .
Collinet, F. 1997. Essai de regroupement des principales especes structurantes d'une foret dense humide d'apres l'analyse de leur repartition spatiale (foret de Paracou - Guyane). These de doctorat, Universite Claude Bernard, Lyon, France.
Goreaud, F. & P?Pelissier, R. 2003. Avoiding misinterpretation of biotic interactions with the intertype K12-function: population independence vs. random labelling hypotheses. Journal of Vegetation Science, 14: 681-692.
data(Couepia) coca.spp <- spp(Couepia$trees, mark=Couepia$stage, window=Couepia$rect, triangles=Couepia$tri) plot(coca.spp)
data(Couepia) coca.spp <- spp(Couepia$trees, mark=Couepia$stage, window=Couepia$rect, triangles=Couepia$tri) plot(coca.spp)
spatstat.data
package.This is an artificial dataset, for use in testing and demonstrating compatibility between spatstat
and ads
objects. It is a multitype point pattern in an irregular polygonal window.
There are two types of points. The window contains a polygonal hole.
data(demopat)
data(demopat)
An object of class "ppp" representing a spatstat.core
point pattern.
data(demopat) in spatstat.data
data(demopat) demo.spp<-ppp2spp(demopat) plot(demo.spp)
data(demopat) demo.spp<-ppp2spp(demopat) plot(demo.spp)
Computes local density estimates of a spatial point pattern, i.e. the number of points per unit area,
within sample circles of regularly increasing radii , centred at the nodes of
a grid covering a simple (rectangular or circular) or complex sampling window (see Details).
dval(p, upto, by, nx, ny)
dval(p, upto, by, nx, ny)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nx , ny
|
number of sample circles regularly spaced out in |
The local density is estimated for a regular sequence of sample circles radii given by seq(by,upto,by)
(see seq
).
The sample circles are centred at the nodes of a regular grid with size by
. Ripley's edge effect correction is applied when
the sample circles overlap boundary of the sampling window (see Ripley (1977) or Goreaud & P?Pelissier (1999) for an extension to circular and complex
sampling windows). Due to edge effect correction,
upto
, the maximum radius of the sample circles, is half the longer side for a rectangle sampling
window (i.e. ) and the radius
for a circular sampling window (see
swin
).
A list of class c("vads","dval")
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
xy |
a data frame of |
cval |
a matrix of size |
dval |
a matrix of size |
In its current version, function dval
ignores the marks of multivariate and marked point patterns (they are all considered to be univariate patterns).
There are printing, summary and plotting methods for "vads"
objects.
Goreaud, F. and P?Pelissier, R. 1999. On explicit formula of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
P?Pelissier, R. and Goreaud, F. 2001. A practical approach to the study of spatial structure in simple cases of heterogeneous vegetation. Journal of Vegetation Science, 12:99-108.
Ripley, B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-212.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) dswr <- dval(swr,25,1,11,9) summary(dswr) plot(dswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) dswc <- dval(swc,25,1,9,9) summary(dswc) plot(dswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) dswrt <- dval(swrt,25,1,11,9) summary(dswrt) plot(dswrt)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) dswr <- dval(swr,25,1,11,9) summary(dswr) plot(dswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) dswc <- dval(swc,25,1,9,9) summary(dswc) plot(dswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) dswrt <- dval(swrt,25,1,11,9) summary(dswrt) plot(dswrt)
Function inside.swin
tests whether points lie inside or outside a given sampling window.
inside.swin(x, y, w, bdry=TRUE)
inside.swin(x, y, w, bdry=TRUE)
x |
a vector of |
y |
a vector of |
w |
an object of class |
bdry |
by default |
A logical vector whose ith
entry is TRUE
if the corresponding point is inside w,
FALSE
otherwise.
For "complex"
sampling windows, points inside the triangles to remove or on their boundary, are considered outside.
swin
.
data(BPoirier) BP <- BPoirier wr <- swin(BP$rect) sum(inside.swin(BP$trees$x, BP$trees$y, wr)) wc <- swin(c(55,45,45)) sum(inside.swin(BP$trees$x, BP$trees$y, wc)) wrt <- swin(BP$rect, triangles=BP$tri1) sum(inside.swin(BP$trees$x, BP$trees$y,wrt))
data(BPoirier) BP <- BPoirier wr <- swin(BP$rect) sum(inside.swin(BP$trees$x, BP$trees$y, wr)) wc <- swin(c(55,45,45)) sum(inside.swin(BP$trees$x, BP$trees$y, wc)) wrt <- swin(BP$rect, triangles=BP$tri1) sum(inside.swin(BP$trees$x, BP$trees$y,wrt))
Computes estimates of the intertype K12-function and associated neighbourhood functions from a bivariate spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypotheses of population independence or random labelling (see Details).
k12fun(p, upto, by, nsim=0, H0=c("pitor","pimim","rl"), prec=0.01, nsimax=3000, conv=50, rep=10, alpha=0.01, marks)
k12fun(p, upto, by, nsim=0, H0=c("pitor","pimim","rl"), prec=0.01, nsimax=3000, conv=50, rep=10, alpha=0.01, marks)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the selected null hypothesis (see Details).
By default |
H0 |
one of |
prec |
if |
nsimax |
if |
conv |
if |
rep |
if |
alpha |
if |
marks |
by default c(1,2), otherwise a vector of two numbers or character strings identifying the types (the |
Function k12fun
computes the intertype function of second-order neighbourhood analysis and the associated functions
,
and
.
For a homogeneous isotropic bivariate point process of intensities and
,
the second-order property could be characterized by a function
(Lotwick & Silverman 1982), so that the expected
number of neighbours of type 2 within a distance
of an arbitrary point of type 1 is:
.
is an intensity standardization of
:
.
is an area standardization of of
:
, where
is the area of the disc of radius
.
is a linearized version of
, which has an expectation of 0 under population independence:
.
becomes positive when the two population show attraction and negative when they show repulsion.
Under the null hypothesis of random labelling, the expectation of
is
. It becomes greater than
when the types tend to be positively correlated and lower when they tend to be negatively correlated.
is the derivative of
or bivariate pair density function, so that the expected
number of points of type 2 at a distance
of an arbitrary point of type 1 (i.e. within an annuli between two successive circles with radii
and
) is:
(Wiegand & Moloney 2004).
The program introduces an edge effect correction term according to the method proposed by Ripley (1977)
and extended to circular and complex sampling windows by Goreaud & Pelissier (1999).
Theoretical values under the null hypothesis of either population independence or random labelling as well as
local Monte Carlo confidence limits and p-values of departure from the null hypothesis (Besag & Diggle 1977) are estimated at each distance .
The population independence hypothesis assumes that the location of points of a given population is independent from the location
of points of the other. It is therefore tested conditionally to the intrinsic spatial pattern of each population. Two different procedures are available:
H0="pitor"
just shifts the pattern of type 1 points around a torus following Lotwick & Silverman (1982); H0="pimim"
uses a mimetic point process (Goreaud et al. 2004)
to mimic the pattern of type 1 points (see mimetic
.
The random labelling hypothesis "rl"
assumes that the probability to bear a given mark is the same for all points of the pattern and
doesn't depends on neighbours. It is therefore tested conditionally to the whole spatial pattern, by randomizing the marks over the points'
locations kept unchanged (see Goreaud & Pelissier 2003 for further details).
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
g12 |
a data frame containing values of the bivariate pair density function |
n12 |
a data frame containing values of the bivariate local neighbour density function |
k12 |
a data frame containing values of the intertype function |
l12 |
a data frame containing values of the modified intertype function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the selected null hypothesis. |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
There are printing and plotting methods for "fads"
objects.
Besag J.E. & Diggle P.J. 1977. Simple Monte Carlo tests spatial patterns. Applied Statistics, 26:327-333.
Goreaud F. & Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Goreaud, F. & Pelissier, R. 2003. Avoiding misinterpretation of biotic interactions with the intertype K12-function: population independence vs. random labelling hypotheses. Journal of Vegetation Science, 14: 681-692.
Lotwick, H.W. & Silverman, B.W. 1982. Methods for analysing spatial processes of several types of points. Journal of the Royal Statistical Society B, 44:403-413.
Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.
Wiegand, T. & Moloney, K.A. 2004. Rings, circles, and null-models for point pattern analysis in ecology. Oikos, 104:209-229.
Goreaud F., Loussier, B., Ngo Bieng, M.-A. & Allain R. 2004. Simulating realistic spatial structure for forest stands: a mimetic point process. In Proceedings of Interdisciplinary Spatial Statistics Workshop, 2-3 December, 2004. Paris, France.
plot.fads
,
spp
,
k12val
,
kfun
,
kijfun
,
ki.fun
,
mimetic
,
kmfun
.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) #testing population independence hypothesis k12swrm.pi <- k12fun(swrm, 25, 1, 500, marks=c("beech","oak")) plot(k12swrm.pi) #testing random labelling hypothesis k12swrm.rl <- k12fun(swrm, 25, 1, 500, H0="rl", marks=c("beech","oak")) plot(k12swrm.rl) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$species) k12swc.pi <- k12fun(swc, 25, 1, 500, marks=c("beech","oak")) plot(k12swc.pi) ## Not run: spatial point pattern in a complex sampling window swrt.rl <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) k12swrt.rl <- k12fun(swrt.rl, 25, 1, 500, H0="rl",marks=c("beech","oak")) plot(k12swrt.rl) ## Not run: testing population independence hypothesis requires minimizing the outer polygon xr<-range(BP$tri3$ax,BP$tri3$bx,BP$tri3$cx) yr<-range(BP$tri3$ay,BP$tri3$by,BP$tri3$cy) rect.min<-swin(c(xr[1], yr[1], xr[2], yr[2])) swrt.pi <- spp(BP$trees, window = rect.min, triangles = BP$tri3, marks=BP$species) k12swrt.pi <- k12fun(swrt.pi, 25, 1, nsim = 500, marks = c("beech", "oak")) plot(k12swrt.pi)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) #testing population independence hypothesis k12swrm.pi <- k12fun(swrm, 25, 1, 500, marks=c("beech","oak")) plot(k12swrm.pi) #testing random labelling hypothesis k12swrm.rl <- k12fun(swrm, 25, 1, 500, H0="rl", marks=c("beech","oak")) plot(k12swrm.rl) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$species) k12swc.pi <- k12fun(swc, 25, 1, 500, marks=c("beech","oak")) plot(k12swc.pi) ## Not run: spatial point pattern in a complex sampling window swrt.rl <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) k12swrt.rl <- k12fun(swrt.rl, 25, 1, 500, H0="rl",marks=c("beech","oak")) plot(k12swrt.rl) ## Not run: testing population independence hypothesis requires minimizing the outer polygon xr<-range(BP$tri3$ax,BP$tri3$bx,BP$tri3$cx) yr<-range(BP$tri3$ay,BP$tri3$by,BP$tri3$cy) rect.min<-swin(c(xr[1], yr[1], xr[2], yr[2])) swrt.pi <- spp(BP$trees, window = rect.min, triangles = BP$tri3, marks=BP$species) k12swrt.pi <- k12fun(swrt.pi, 25, 1, nsim = 500, marks = c("beech", "oak")) plot(k12swrt.pi)
Computes local second-order neighbour density estimates for a bivariate spatial point pattern, i.e. the number of neighbours of type 2 per unit area
within sample circles of regularly increasing radii , centred at each type 1 point of the pattern (see Details).
k12val(p, upto, by, marks)
k12val(p, upto, by, marks)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
marks |
by default |
Function K12val
returns individual values of K12(r) and associated functions (see k12fun
)
estimated at each type 1 point of the pattern. For a given distance r, these values can be mapped within the sampling window, as in
Getis & Franklin 1987 or P?Pelissier & Goreaud 2001.
A list of class c("vads","k12val")
with essentially the following components:
r |
a vector of regularly spaced distances ( |
xy |
a data frame with 2 components giving |
g12val |
a matrix of size |
n12val |
a matrix of size |
k12val |
a matrix of size |
l12val |
a matrix of size |
There are printing, summary and plotting methods for "vads"
objects.
Getis, A. and Franklin, J. 1987. Second-order neighborhood analysis of mapped point patterns. Ecology, 68:473-477.
P?Pelissier, R. and Goreaud, F. 2001. A practical approach to the study of spatial structure in simple cases of heterogeneous vegetation. Journal of Vegetation Science, 12:99-108.
plot.vads
,
k12fun
,
dval
,
kval
.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) k12vswrm <- k12val(swrm, 25, 1, marks=c("beech","oak")) summary(k12vswrm) plot(k12vswrm) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$species) k12vswc <- k12val(swc, 25, 1, marks=c("beech","oak")) summary(k12vswc) plot(k12vswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) k12vswrt <- k12val(swrt, 25, 1, marks=c("beech","oak")) summary(k12vswrt) plot(k12vswrt)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) k12vswrm <- k12val(swrm, 25, 1, marks=c("beech","oak")) summary(k12vswrm) plot(k12vswrm) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$species) k12vswc <- k12val(swc, 25, 1, marks=c("beech","oak")) summary(k12vswc) plot(k12vswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) k12vswrt <- k12val(swrt, 25, 1, marks=c("beech","oak")) summary(k12vswrt) plot(k12vswrt)
Computes distance-dependent estimates of Shen et al. (2014) phylogenetic or functional mark correlation functions from a multivariate spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of species equivalence (see Details).
kdfun(p, upto, by, dis, nsim=0, alpha = 0.01)
kdfun(p, upto, by, dis, nsim=0, alpha = 0.01)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
dis |
a |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of a random allocation of species distances (species equivalence; see Details).
By default |
alpha |
if |
Function kdfun
computes Shen et al. (2014) and gd-functions. For a multivariate point pattern consisting of
species with intensity
p, such functions can be estimated from the bivariate
-functions between each pair of different species
and
.
Function
kdfun
is thus a simple wrapper of k12fun
(P?Pelissier & Goreaud 2014):
.
.
where and
are distance-dependent versions of Simpson's diversity index,
(see
ksfun
), and
are distance-dependent versions of Rao's diversity coefficient (see
krfun
);
is the distance between species
and
defined by matrix
dis
, typically a taxonomic, phylogenetic or functional distance. The advantage here is that as the edge effects vanish between and
,
implementation is fast for a sampling window of any shape.
provides the expected phylogenetic or functional distance of two heterospecific individuals a distance less than r apart (Shen et al. 2014), while
provides the same within an annuli between two consecutive distances of r and r-by.
Theoretical values under the null hypothesis of species equivalence as well as local Monte Carlo confidence limits and p-values of departure from the null hypothesis (Besag & Diggle 1977) are estimated at each distance ,
by randomizing the between-species distances, keeping the point locations and distribution of species labels unchanged. The theoretical expectations of
and
are thus
.
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
gd |
a data frame containing values of the function |
kd |
a data frame containing values of the function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the null hypothesis of species equivalence. |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
There are printing and plotting methods for "fads"
objects.
Shen, G., Wiegand, T., Mi, X. & He, F. (2014). Quantifying spatial phylogenetic structures of fully stem-mapped plant communities. Methods in Ecology and Evolution, 4, 1132-1141.
P?Pelissier, R. & Goreaud, F. ads package for R: A fast unbiased implementation of the K-function family for studying spatial point patterns in irregular-shaped sampling windows. Journal of Statistical Software, in press.
plot.fads
,
spp
,
ksfun
,
krfun
,
divc
.
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(175, 175, 250, 250), marks = P15$species) ## Not run: testing the species equivalence hypothesis kdswmr <- kdfun(swmr, dis = P15$spdist, 50, 2, 100) ## Not run: running more simulations is slow kdswmr <- kdfun(swmr, dis = P15$spdist, 50, 2, 500) plot(kdswmr) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125,125,50), marks = P15$species) kdswmc <- kdfun(swmc, dis = P15$spdist, 50, 2, 100) ## Not run: running more simulations is slow kdswmc <- kdfun(swmc, dis = P15$spdist, 50, 2, 500) plot(kdswmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125,125,250,250), tri = P15$tri, marks = P15$species) kdswrt <- kdfun(swrt, dis = P15$spdist, 50, 2, 100) ## Not run: running simulations is slow kdswrt <- kdfun(swrt, dis = P15$spdist, 50, 2, 500) plot(kdswrt)
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(175, 175, 250, 250), marks = P15$species) ## Not run: testing the species equivalence hypothesis kdswmr <- kdfun(swmr, dis = P15$spdist, 50, 2, 100) ## Not run: running more simulations is slow kdswmr <- kdfun(swmr, dis = P15$spdist, 50, 2, 500) plot(kdswmr) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125,125,50), marks = P15$species) kdswmc <- kdfun(swmc, dis = P15$spdist, 50, 2, 100) ## Not run: running more simulations is slow kdswmc <- kdfun(swmc, dis = P15$spdist, 50, 2, 500) plot(kdswmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125,125,250,250), tri = P15$tri, marks = P15$species) kdswrt <- kdfun(swrt, dis = P15$spdist, 50, 2, 100) ## Not run: running simulations is slow kdswrt <- kdfun(swrt, dis = P15$spdist, 50, 2, 500) plot(kdswrt)
Computes estimates of Ripley's K-function and associated neighbourhood functions from an univariate spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of Complete Spatial Randomness (see Details).
kfun(p, upto, by, nsim=0, prec=0.01, alpha=0.01)
kfun(p, upto, by, nsim=0, prec=0.01, alpha=0.01)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of complete spatial randomness (CSR) (see Details).
By default |
prec |
if |
alpha |
if |
Function kfun
computes Ripley's function of second-order neighbourhood analysis and the associated functions
,
and
.
For a homogeneous isotropic point process of intensity , Ripley (1977) showed that
the second-order property could be characterized by a function
, so that the expected
number of neighbours within a distance
of an arbitrary point of the pattern is:
.
is a intensity standardization of
, which has an expectation of
under the null hypothesis of CSR:
.
is an area standardization of
, which has an expectation of
under the null hypothesis of CSR:
, where
is the area of the disc of radius
.
is a linearized version of
(Besag 1977), which has an expectation of 0 under the null hypothesis of CSR:
. L(r) becomes positive when the pattern tends to clustering and negative when it tends to regularity.
is the derivative of
or pair density function (Stoyan et al. 1987), so that the expected
number of neighbours at a distance
of an arbitrary point of the pattern (i.e. within an annuli between two successive circles with radii
and
) is:
.
The program introduces an edge effect correction term according to the method proposed by Ripley (1977)
and extended to circular and complex sampling windows by Goreaud & P?Pelissier (1999).
Theoretical values under the null hypothesis of CSR as well as
local Monte Carlo confidence limits and p-values of departure from CSR (Besag & Diggle 1977) are estimated at each distance .
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
g |
a data frame containing values of the pair density function |
n |
a data frame containing values of the local neighbour density function |
k |
a data frame containing values of Ripley's function |
l |
a data frame containing values of the modified Ripley's function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected for a Poisson pattern. |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
Function kfun
ignores the marks of multivariate and marked point patterns, which are analysed as univariate patterns.
There are printing and plotting methods for "fads"
objects.
Besag J.E. 1977. Discussion on Dr Ripley's paper. Journal of the Royal Statistical Society B, 39:193-195.
Besag J.E. & Diggle P.J. 1977. Simple Monte Carlo tests spatial patterns. Applied Statistics, 26:327-333.
Goreaud F. & P?Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.
Stoyan D., Kendall W.S. & Mecke J. 1987. Stochastic geometry and its applications. Wiley, New-York.
plot.fads
,
spp
,
kval
,
k12fun
,
kijfun
,
ki.fun
,
kmfun
.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) kswr <- kfun(swr,25,1,500) plot(kswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) kswc <- kfun(swc, 25, 1, 500) plot(kswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) kswrt <- kfun(swrt, 25, 1, 500) plot(kswrt)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) kswr <- kfun(swr,25,1,500) plot(kswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) kswc <- kfun(swc, 25, 1, 500) plot(kswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) kswrt <- kfun(swrt, 25, 1, 500) plot(kswrt)
Computes estimates of the mark correlation Km-function and associated neighbourhood functions from a marked spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of no correlation between marks (see Details).
kmfun(p, upto, by, nsim=0, alpha=0.01)
kmfun(p, upto, by, nsim=0, alpha=0.01)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of no correlation between marks (see Details).
By default |
alpha |
if |
Function kmfun
computes the mark correlation function and the associated function
.
It is defined from a general definition of spatial autocorrelation (Goreaud 2000) as:
where is a quantitative random variable attached to each point of the pattern.
Km(r) has a very similar interpretation than more classical correlation functions, such as Moran's I: it takes values between -1 and 1, with an expectation of 0 under the null hypothesis of no spatial correlation between the values of X, becomes positive when values of at distance r are positively correlated and negative when values of
at distance r are negatively correlated.
is the derivative of
or pair mark correlation function, which gives the correlation of marks within an annuli between two successive circles with radii
and
).
The program introduces an edge effect correction term according to the method proposed by Ripley (1977) and extended to circular and complex sampling windows by Goreaud & P?Pelissier (1999).
Local Monte Carlo confidence limits and p-values of departure from the null hypothesis of no correlation are estimated at each distance , after reallocating at random the values of X over all points of the pattern, the location of trees being kept unchanged.
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
gm |
a data frame containing values of the pair mark correlation function |
km |
a data frame containing values of the mark correlation function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected for the null hypothesis of no correlation between marks. |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
Applications of this function can be found in Oddou-Muratorio et al. (2004) and Madelaine et al. (submitted).
Goreaud, F. 2000. Apports de l'analyse de la structure spatiale en foret tempere a l'etude et la modelisation des peuplements complexes. These de doctorat, ENGREF, Nancy, France.
Goreaud F. & P?Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Madelaine, C., Pelissier, R., Vincent, G., Molino, J.-F., Sabatier, D., Prevost, M.-F. & de Namur, C. 2007. Mortality and recruitment in a lowland tropical rainforest of French Guiana: effects of soil type and species guild. Journal of Tropical Ecology, 23:277-287.
Oddou-Muratorio, S., Demesure-Musch, B., Pelissier, R. & Gouyon, P.-H. 2004. Impacts of gene flow and logging history on the local genetic structure of a scattered tree species, Sorbus torminalis L. Molecular Ecology, 13:3689-3702.
Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.
plot.fads
,
spp
,
kfun
,
k12fun
,
kijfun
,
ki.fun
.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$dbh) kmswrm <- kmfun(swrm, 25, 2, 500) plot(kmswrm) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$dbh) kmswc <- kmfun(swc, 25, 2, 500) plot(kmswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$dbh) kmswrt <- kmfun(swrt, 25, 2, 500) plot(kmswrt)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$dbh) kmswrm <- kmfun(swrm, 25, 2, 500) plot(kmswrm) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45), marks=BP$dbh) kmswc <- kmfun(swc, 25, 2, 500) plot(kmswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$dbh) kmswrt <- kmfun(swrt, 25, 2, 500) plot(kmswrt)
(Formerly ki.fun
) Computes a set of K12-functions between all possible marks and the other marks in
a multivariate spatial point pattern defined in a simple (rectangular or circular)
or complex sampling window (see Details).
kp.fun(p, upto, by)
kp.fun(p, upto, by)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
Function kp.fun
is simply a wrapper to k12fun
, which computes K12(r) between each mark of the pattern
and all other marks grouped together (the
points).
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced distances ( |
labp |
a vector containing the levels |
gp. |
a data frame containing values of the pair density function |
np. |
a data frame containing values of the local neighbour density function |
kp. |
a data frame containing values of the |
lp. |
a data frame containing values of the modified |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the null hypothesis of population independence (see |
There are printing and plotting methods for "fads"
objects.
plot.fads
,
spp
,
kfun
,
k12fun
,
kpqfun
.
data(BPoirier) BP <- BPoirier ## Not run: multivariate spatial point pattern in a rectangle sampling window swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) kp.swrm <- kp.fun(swrm, 25, 1) plot(kp.swrm) ## Not run: multivariate spatial point pattern in a circle with radius 50 centred on (55,45) swcm <- spp(BP$trees, win=c(55,45,45), marks=BP$species) kp.swcm <- kp.fun(swcm, 25, 1) plot(kp.swcm) ## Not run: multivariate spatial point pattern in a complex sampling window swrtm <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) kp.swrtm <- kp.fun(swrtm, 25, 1) plot(kp.swrtm)
data(BPoirier) BP <- BPoirier ## Not run: multivariate spatial point pattern in a rectangle sampling window swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) kp.swrm <- kp.fun(swrm, 25, 1) plot(kp.swrm) ## Not run: multivariate spatial point pattern in a circle with radius 50 centred on (55,45) swcm <- spp(BP$trees, win=c(55,45,45), marks=BP$species) kp.swcm <- kp.fun(swcm, 25, 1) plot(kp.swcm) ## Not run: multivariate spatial point pattern in a complex sampling window swrtm <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) kp.swrtm <- kp.fun(swrtm, 25, 1) plot(kp.swrtm)
(Formerly kijfun
) Computes a set of K- and K12-functions for all possible pairs of marks in a multivariate spatial
point pattern defined in a simple (rectangular or circular)
or complex sampling window (see Details).
kpqfun(p, upto, by)
kpqfun(p, upto, by)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
Function kpqfun
is simply a wrapper to kfun
and k12fun
, which computes either K(r)
for points of mark when
or K12(r) between the marks
and
otherwise.
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced distances ( |
labpq |
a vector containing the |
gpq |
a data frame containing values of the pair density functions |
npq |
a data frame containing values of the local neighbour density functions |
kpq |
a data frame containing values of the |
lpq |
a data frame containing values of the modified |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the null hypotheses of spatial randomness (see |
There are printing and plotting methods for "fads"
objects.
plot.fads
,
spp
,
kfun
,
k12fun
,
kp.fun
.
data(BPoirier) BP <- BPoirier ## Not run: multivariate spatial point pattern in a rectangle sampling window swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) kpqswrm <- kpqfun(swrm, 25, 1) plot(kpqswrm) ## Not run: multivariate spatial point pattern in a circle with radius 50 centred on (55,45) swcm <- spp(BP$trees, win=c(55,45,45), marks=BP$species) kpqswcm <- kpqfun(swcm, 25, 1) plot(kpqswcm) ## Not run: multivariate spatial point pattern in a complex sampling window swrtm <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) kpqswrtm <- kpqfun(swrtm, 25, 1) plot(kpqswrtm)
data(BPoirier) BP <- BPoirier ## Not run: multivariate spatial point pattern in a rectangle sampling window swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) kpqswrm <- kpqfun(swrm, 25, 1) plot(kpqswrm) ## Not run: multivariate spatial point pattern in a circle with radius 50 centred on (55,45) swcm <- spp(BP$trees, win=c(55,45,45), marks=BP$species) kpqswcm <- kpqfun(swcm, 25, 1) plot(kpqswcm) ## Not run: multivariate spatial point pattern in a complex sampling window swrtm <- spp(BP$trees, win=BP$rect, tri=BP$tri2, marks=BP$species) kpqswrtm <- kpqfun(swrtm, 25, 1) plot(kpqswrtm)
Computes distance-dependent estimates of Rao's quadratic entropy from a multivariate spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of either a random labelling or a species equivalence (see Details).
krfun(p, upto, by, nsim=0, dis = NULL, H0 = c("rl", "se"), alpha = 0.01)
krfun(p, upto, by, nsim=0, dis = NULL, H0 = c("rl", "se"), alpha = 0.01)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of a random allocation of species labels (see Details).
By default |
dis |
(optional) a |
H0 |
one of c("rl","se") to select either the null hypothesis of random labelling (H0 = "rl") or species equivalence (H0 = "se") (see Details). By default, the null hypothesis is random labelling. |
alpha |
if |
Function krfun
computes distance-dependent functions of Rao (1982) quadratic entropy (see divc
in package ade4
).
For a multivariate point pattern consisting of species with intensity
p, such functions can be estimated from the bivariate
-functions between each pair of different species
and
.
Function
krfun
is thus a simple wrapper function of k12fun
and kfun
, standardized by Rao diversity coefficient (Pelissier & Goreaud 2014):
.
.
where is the distance between species
and
defined by matrix
dis
, typically a taxonomic, phylogenetic or functional distance, and is the unbiased version of Rao diversity coefficient (see Shimatani 2001). When
dis = NULL
, species are considered each other equidistant and krfun
returns the same results than ksfun
.
The program introduces an edge effect correction term according to the method proposed by Ripley (1977)
and extended to circular and complex sampling windows by Goreaud & Pelissier (1999).
Theoretical values under the null hypothesis of either random labelling or species equivalence as well as local Monte Carlo confidence limits and p-values of departure from the null hypothesis (Besag & Diggle 1977) are estimated at each distance .
The random labelling hypothesis (H0 = "rl") is tested by reallocating species labels at random among all points of the pattern, keeping the point locations unchanged, so that expectations of and
are 1 for all
.
The species equivalence hypothesis (H0 = "se") is tested by randomizing the between-species distances, keeping the point locations and distribution of species labels unchanged. The theoretical expectations of
and
are thus
and
, respectively (see
ksfun
).
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
gr |
a data frame containing values of the function |
kr |
a data frame containing values of the function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the selected null hypothesis. |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
There are printing and plotting methods for "fads"
objects.
Rao, C.R. 1982. Diversity and dissimilarity coefficient: a unified approach. Theoretical Population Biology, 21:24-43.
Shimatani, K. 2001. On the measurement of species diversity incorporating species differences. Oikos, 93, 135-147.
Goreaud F. & Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.
Pelissier, R. & Goreaud, F. 2014. ads package for R: A fast unbiased implementation of the k-function family for studying spatial point patterns in irregular-shaped sampling windows. Journal of Statistical Software, in press.
plot.fads
,
spp
,
ksfun
,
kdfun
,
divc
.
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(175, 175, 250, 250), marks = P15$species) ## Not run: testing the random labeling hypothesis krwmr.rl <- krfun(swmr, dis = P15$spdist, H0 = "rl", 25, 2, 50) ## Not run: running more simulations is slow krwmr.rl <- krfun(swmr, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwmr.rl) ## Not run: testing the species equivalence hypothesis krwmr.se <- krfun(swmr, dis = P15$spdist, H0 = "se", 25, 2, 50) ## Not run: running more simulations is slow krwmr.se <- krfun(swmr, dis = P15$spdist, H0 = "se", 25, 2, 500) plot(krwmr.se) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125,125,50), marks = P15$species) krwmc <- krfun(swmc, dis = P15$spdist, H0 = "rl", 25, 2, 100) ## Not run: running more simulations is slow krwmc <- krfun(swmc, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125,125,250,250), tri = P15$tri, marks = P15$species) krwrt <- krfun(swrt, dis = P15$spdist, H0 = "rl", 25, 2) ## Not run: running simulations is slow krwrt <- krfun(swrt, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwrt)
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(175, 175, 250, 250), marks = P15$species) ## Not run: testing the random labeling hypothesis krwmr.rl <- krfun(swmr, dis = P15$spdist, H0 = "rl", 25, 2, 50) ## Not run: running more simulations is slow krwmr.rl <- krfun(swmr, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwmr.rl) ## Not run: testing the species equivalence hypothesis krwmr.se <- krfun(swmr, dis = P15$spdist, H0 = "se", 25, 2, 50) ## Not run: running more simulations is slow krwmr.se <- krfun(swmr, dis = P15$spdist, H0 = "se", 25, 2, 500) plot(krwmr.se) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125,125,50), marks = P15$species) krwmc <- krfun(swmc, dis = P15$spdist, H0 = "rl", 25, 2, 100) ## Not run: running more simulations is slow krwmc <- krfun(swmc, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125,125,250,250), tri = P15$tri, marks = P15$species) krwrt <- krfun(swrt, dis = P15$spdist, H0 = "rl", 25, 2) ## Not run: running simulations is slow krwrt <- krfun(swrt, dis = P15$spdist, H0 = "rl", 25, 2, 500) plot(krwrt)
Computes estimates of Shimatani alpha and beta functions of Simpson diversity from a multivariate spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of a random allocation of species labels (see Details).
ksfun(p, upto, by, nsim=0, alpha=0.01)
ksfun(p, upto, by, nsim=0, alpha=0.01)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
nsim |
number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of a random allocation of species labels (see Details).
By default |
alpha |
if |
Function ksfun
computes Shimatani and
functions of Simpson diversity, called here
and
, respectively.
For a multivariate point pattern consisting of species with intensity
p, Shimatani (2001) showed that
a distance-dependent measure of Simpson (1949) diversity can be estimated from Ripley (1977)
-function computed for each species separately and for all the points grouped together (see also Eckel et al. 2008).
Function
ksfun
is thus a simple wrapper function of kfun
, standardized by Simpson diversity coefficient:
which is a standardized estimator of
in Shimatani (2001).
corresponding to a standardized version of
in Shimatani (2001).
and
(resp.
and
) are univariate K-functions computed for species
and for all species together;
is the unbiased version of Simpson diversity,
with
the number of individuals of species
in the sample and
.
The program introduces an edge effect correction term according to the method proposed by Ripley (1977)
and extended to circular and complex sampling windows by Goreaud & P?Pelissier (1999).
The theoretical values of and
under the null hypothesis of random labelling is 1 for all
.
Local Monte Carlo confidence limits and p-values of departure from this hypothesis are estimated at each distance
by reallocating at random the species labels among points of the pattern, keeping the point locations unchanged.
A list of class "fads"
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
gs |
a data frame containing values of the function |
ks |
a data frame containing values of the function |
Each component except r
is a data frame with the following variables:
obs |
a vector of estimated values for the observed point pattern. |
theo |
a vector of theoretical values expected under the null hypothesis of random labelling, i.e. 1 for all |
sup |
(optional) if |
inf |
(optional) if |
pval |
(optional) if |
There are printing and plotting methods for "fads"
objects.
Shimatani K. 2001. Multivariate point processes and spatial variation in species diversity. Forest Ecology and Management, 142:215-229.
Eckel, S., Fleisher, F., Grabarnik, P. and Schmidt V. 2008. An investigation of the spatial correlations for relative purchasing power in Baden-Wurttemberg. AstA - Advances in Statistical Analysis, 92:135-152.
Simpson, E.H. 1949. Measurement of diversity. Nature, 688:163.
Goreaud F. & P?Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.
plot.fads
,
spp
,
kfun
,
kpqfun
,
kp.fun
,
krfun
.
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(125, 125, 250, 250), marks = P15$species) kswmr <- ksfun(swmr, 50, 5, 500) plot(kswmr) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125, 125, 50), marks = P15$species) kswmc <- ksfun(swmc, 50, 5, 500) plot(kswmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125, 125, 250, 250), tri=P15$tri, marks=P15$species) kswrt <- ksfun(swrt, 50, 5, 500) plot(kswrt)
data(Paracou15) P15<-Paracou15 ## Not run: spatial point pattern in a rectangle sampling window of size 125 x 125 swmr <- spp(P15$trees, win = c(125, 125, 250, 250), marks = P15$species) kswmr <- ksfun(swmr, 50, 5, 500) plot(kswmr) ## Not run: spatial point pattern in a circle with radius 50 centred on (125,125) swmc <- spp(P15$trees, win = c(125, 125, 50), marks = P15$species) kswmc <- ksfun(swmc, 50, 5, 500) plot(kswmc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(P15$trees, win = c(125, 125, 250, 250), tri=P15$tri, marks=P15$species) kswrt <- ksfun(swrt, 50, 5, 500) plot(kswrt)
Computes local second-order neighbour density estimates for an univariate spatial point pattern, i.e. the number of neighbours per unit area
within sample circles of regularly increasing radii , centred at each point of the pattern (see Details).
kval(p, upto, by)
kval(p, upto, by)
p |
a |
upto |
maximum radius of the sample circles (see Details). |
by |
interval length between successive sample circles radii (see Details). |
Function kval
returns individual values of K(r) and associated functions (see kfun
)
estimated for each point of the pattern. For a given distance r, these values can be mapped within the sampling window
(Getis & Franklin 1987, P?Pelissier & Goreaud 2001).
A list of class c("vads","kval")
with essentially the following components:
r |
a vector of regularly spaced out distances ( |
xy |
a data frame with 2 components giving |
gval |
a matrix of size |
nval |
a matrix of size |
kval |
a matrix of size |
lval |
a matrix of size |
Function kval
ignores the marks of multivariate and marked point patterns (they are all considered to be univariate patterns).
There are printing, summary and plotting methods for "vads"
objects.
Getis, A. and Franklin, J. 1987. Second-order neighborhood analysis of mapped point patterns. Ecology, 68:473-477.
P?Pelissier, R. and Goreaud, F. 2001. A practical approach to the study of spatial structure in simple cases of heterogeneous vegetation. Journal of Vegetation Science, 12:99-108.
plot.vads
,
kfun
,
dval
,
k12val
.
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) kvswr <- kval(swr, 25, 1) summary(kvswr) plot(kvswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) kvswc <- kval(swc, 25, 1) summary(kvswc) plot(kvswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) kvswrt <- kval(swrt, 25, 1) summary(kvswrt) plot(kvswrt)
data(BPoirier) BP <- BPoirier ## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) kvswr <- kval(swr, 25, 1) summary(kvswr) plot(kvswr) ## Not run: spatial point pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,45)) kvswc <- kval(swc, 25, 1) summary(kvswc) plot(kvswc) ## Not run: spatial point pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1) kvswrt <- kval(swrt, 25, 1) summary(kvswrt) plot(kvswrt)
Simulates replicates of an observed univariate point pattern by stochastic optimization of its L-function properties.
mimetic(x,upto=NULL,by=NULL,prec=NULL,nsimax=3000,conv=50)
mimetic(x,upto=NULL,by=NULL,prec=NULL,nsimax=3000,conv=50)
x |
either a |
upto |
(optional) maximum radius of the sample circles when |
by |
(optional) interval length between successive sample circles radii when |
prec |
precision of point coordinates generated during simulations when |
nsimax |
maximum number of simulations allowed. By default the process stops after |
conv |
maximum number of simulations without optimization gain (convergence criterion). |
Function mimetic
uses a stepwise depletion-replacement algorithm to generate a point pattern whose L-function is optimized with regards to an observed one, following the mimetic point process principle (Goreaud et al. 2004).
Four points are randomly deleted at each step of the process and replaced by new points that minimize the following cost function:||||)^2. The simulation stops as soon as the cost function doesn't decrease
after
conv
simulations or after a maximum of nsimax
simulations. The process apply to rectangular, circular or complex sampling windows (see spp
). There exist a plot
method that displays diagnostic
plots, i.e. the observed and simulated L-function, the simulated point pattern and the successive values of the cost function.
A list of class "mimetic"
with essentially the following components:
call |
the function call. |
fads |
an object of class |
..r |
a vector of regularly spaced out distances corresponding to seq(by,upto,by). |
..l |
a dataframe with 2 components: |
.. ..obs |
a vector of values of the L-function estimated for the initial observed pattern |
.. ..sim |
a vector of values of the L-function estimated for the simulated pattern |
spp |
a object of class |
theo |
a vector of theoretical values, i.e. Simpson |
cost |
a vector of the successive values of the cost function. |
There are printing and plotting methods for "mimetic"
objects.
Goreaud F., Loussier, B., Ngo Bieng, M.-A. & Allain R. 2004. Simulating realistic spatial structure for forest stands: a mimetic point process. In Proceedings of Interdisciplinary Spatial Statistics Workshop, 2-3 December, 2004. Paris, France.
data(BPoirier) BP<-BPoirier ## Not run: performing point pattern analysis in a rectangle sampling window swr <- spp(BP$trees, win=BP$rect) plot(swr) ## Not run: performing the mimetic point process from "spp" object mimswr <- mimetic(swr, 20, 2) plot(mimswr) ## Not run: performing the mimetic point process from "fads" object mimkswr <- mimetic(kfun(swr, 20, 2)) plot(mimkswr)
data(BPoirier) BP<-BPoirier ## Not run: performing point pattern analysis in a rectangle sampling window swr <- spp(BP$trees, win=BP$rect) plot(swr) ## Not run: performing the mimetic point process from "spp" object mimswr <- mimetic(swr, 20, 2) plot(mimswr) ## Not run: performing the mimetic point process from "fads" object mimkswr <- mimetic(kfun(swr, 20, 2)) plot(mimkswr)
Spatial pattern of 4128 trees of 332 different species in a 250 m X 250 m control plot in Paracou experimental station, French Guiana.
data(Paracou15)
data(Paracou15)
A list with 5 components:$rect
is a vector of coordinates of the origin and the opposite corner of a 250 by 250 m rectangular plot.
$trees
is a list of tree coordinates .
$species
is a factor with 332 levels corresponding to species names of the trees.$spdist
is an object of class "dist"
giving between-species distances based on functional traits (see Paine et al. 2011).
Gourlet-Fleury, S., Ferry, B., Molino, J.-F., Petronelli, P. & Schmitt, L. 2004. Experimental plots: key features. Pp. 3-60 In Gourlet-Fleury, S., Guehl, J.-M. & Laroussinie, O. (Eds.), Ecology and Management of a Neotropical rainforest - Lessons drawn from Paracou, a long-term experimental research site in French Guiana. Elsevier SAS, France.
Paine, C. E. T., Baraloto, C., Chave, J. & Herault, B. 2011. Functional traits of individual trees reveal ecological constraints on community assembly in tropical rain forests. Oikos, 120: 720-727.
data(Paracou15) P15.spp <- spp(Paracou15$trees, mark = Paracou15$species, window = Paracou15$rect) plot(P15.spp, chars = rep("o", 332), cols = rainbow(332), legend = FALSE, maxsize = 0.5)
data(Paracou15) P15.spp <- spp(Paracou15$trees, mark = Paracou15$species, window = Paracou15$rect) plot(P15.spp, chars = rep("o", 332), cols = rainbow(332), legend = FALSE, maxsize = 0.5)
Plot second-order neighbourhood function estimates returned by functions kfun, k12fun, kmfun
, kijfun or ki.fun
.
## S3 method for class 'fads' plot(x, opt, cols, lty, main, sub, legend, csize, ...)
## S3 method for class 'fads' plot(x, opt, cols, lty, main, sub, legend, csize, ...)
x |
an object of class |
opt |
one of |
cols |
(optional) colours used for plotting functions. |
lty |
(optional) line types used for plotting functions. |
main |
by default, the value of argument x, otherwise a text to be displayed as a title of the plot. |
sub |
by default, the name of the function displayed, otherwise a text to be displayed as function subtitle. |
legend |
If |
csize |
scaling factor for font size so that actual font size is |
... |
extra arguments that will be passed to the plotting functions |
Function plot.fads
displays second-order neighbourhood function estimates as a function of interpoint distance, with expected values
as well as confidence interval limits when computed. Argument x
can be any fads
object returned by functions kfun,
k12fun, kmfun, kijfun or ki.fun
.
none.
kfun
,
k12fun
,
kmfun
,
kijfun
,
ki.fun
.
data(BPoirier) BP <- BPoirier ## Not run: Ripley's function swr <- spp(BP$trees, win=BP$rect) k.swr <- kfun(swr, 25, 1, 500) plot(k.swr) ## Not run: Intertype function swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) k12.swrm <- k12fun(swrm, 25, 1, 500, marks=c("beech","oak")) plot(k12.swrm, opt="L", cols=1) ## Not run: Mark correlation function swrm <- spp(BP$trees, win=BP$rect, marks=BP$dbh) km.swrm <- kmfun(swrm, 25, 1, 500) plot(km.swrm, main="Example 1", sub=NULL, legend=FALSE)
data(BPoirier) BP <- BPoirier ## Not run: Ripley's function swr <- spp(BP$trees, win=BP$rect) k.swr <- kfun(swr, 25, 1, 500) plot(k.swr) ## Not run: Intertype function swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) k12.swrm <- k12fun(swrm, 25, 1, 500, marks=c("beech","oak")) plot(k12.swrm, opt="L", cols=1) ## Not run: Mark correlation function swrm <- spp(BP$trees, win=BP$rect, marks=BP$dbh) km.swrm <- kmfun(swrm, 25, 1, 500) plot(km.swrm, main="Example 1", sub=NULL, legend=FALSE)
Plot a Spatial Point Pattern object returned by function spp
.
## S3 method for class 'spp' plot(x, main, out=FALSE, use.marks=TRUE, cols, chars, cols.out, chars.out, maxsize, scale=TRUE, add=FALSE, legend=TRUE, csize=1, ...)
## S3 method for class 'spp' plot(x, main, out=FALSE, use.marks=TRUE, cols, chars, cols.out, chars.out, maxsize, scale=TRUE, add=FALSE, legend=TRUE, csize=1, ...)
x |
an object of class |
main |
by default, the value of argument |
out |
by default |
use.marks |
by default |
cols |
(optional) the colour(s) used to plot points located inside the sampling window (see Details). |
chars |
(optional) plotting character(s) used to plot points located inside the sampling window (see Details). |
cols.out |
(optional) if |
chars.out |
(optional) if |
maxsize |
(optional) maximum size of plotting symbols. By default |
csize |
scaling factor for font size so that actual font size is |
scale |
If |
legend |
If |
add |
by default |
... |
extra arguments that will be passed to the plotting functions |
The sampling window x$window
is plotted first, through a call to function plot.swin
.
Then the points themselves are plotted, in a fashion that depends on the type of spatial point pattern (see spp
).
univariate pattern:
if x$type = c("univariate")
, i.e. the point pattern does not have marks, or if use.marks = FALSE
, then the locations of all
points is plotted using a single plot character.
multivariate pattern:
if x$type = c("multivariate")
, i.e. the marks are levels of a factor, then each level is represented by a different plot character.
marked pattern:
if x$type = c("marked")
, i.e. the marks are real numbers, then points are represented by circles (argument chars = "circles"
, the default) or squares
(argument chars = "squares"
) proportional to their marks' value (positive values are filled, while negative values are unfilled).
Arguments cols
and cols.out
(if out = TRUE
) determine the colour(s) used to display the points located inside and outside the sampling window, respectively.
Colours may be specified as codes or colour names (see par("col")
). For univariate and marked point patterns, cols
and cols.out
are single character strings, while
for multivariate point patterns they are character vectors of same length as levels(x$marks)
and levels(x$marksout)
, respectively.
Arguments chars
and chars.out
(if out = TRUE
) determine the symbol(s) used to display the points located inside and outside the sampling window, respectively.
Symbols may be specified as codes or character strings (see par("pch")
). For univariate point patterns, chars
and chars.out
are single character strings, while
for multivariate point patterns they are character vectors of same length as levels(x$marks)
and levels(x$marksout)
, respectively. For marked point patterns,
chars
and chars.out
can only take the value "circles"
or "squares"
.
none.
data(BPoirier) BP<-BPoirier ## Not run: a univariate point pattern in a rectangle sampling window plot(spp(BP$trees, win=BP$rect)) ## Not run: a univariate point pattern in a circular sampling window plot(spp(BP$trees, win=c(55,45,45)), out=TRUE, scale=TRUE) ## Not run: a univariate point pattern in a complex sampling window ## Not run: (points outside the sampling window displayed in red colour) plot(spp(BP$trees, win=BP$rect, tri=BP$tri1), out=TRUE) ## Not run: a multivariate point pattern in a rectangle sampling window plot(spp(BP$trees, win=BP$rect, marks=BP$species)) ## Not run: a multivariate point pattern in a circular sampling window ## Not run: (points inside/outside the sampling window displayed in blue colour/as red crosses) plot(spp(BP$trees, win=c(55,45,45), marks=BP$species), out=TRUE, cols=c("blue","blue","blue"), chars.out=c("+","+","+"), cols.out=c("red","red","red")) ## Not run: a marked point pattern in a rectangle sampling window with circles in green colour plot(spp(BP$trees, win=BP$rect, marks=BP$dbh), cols="green") ## Not run: a marked point pattern in a circular sampling window ## Not run: (squares in red colour inside and circles in blue colour outside) plot(spp(BP$trees, win=c(55,45,45), marks=BP$dbh), out=TRUE, chars="squares", cols="red", cols.out="blue")
data(BPoirier) BP<-BPoirier ## Not run: a univariate point pattern in a rectangle sampling window plot(spp(BP$trees, win=BP$rect)) ## Not run: a univariate point pattern in a circular sampling window plot(spp(BP$trees, win=c(55,45,45)), out=TRUE, scale=TRUE) ## Not run: a univariate point pattern in a complex sampling window ## Not run: (points outside the sampling window displayed in red colour) plot(spp(BP$trees, win=BP$rect, tri=BP$tri1), out=TRUE) ## Not run: a multivariate point pattern in a rectangle sampling window plot(spp(BP$trees, win=BP$rect, marks=BP$species)) ## Not run: a multivariate point pattern in a circular sampling window ## Not run: (points inside/outside the sampling window displayed in blue colour/as red crosses) plot(spp(BP$trees, win=c(55,45,45), marks=BP$species), out=TRUE, cols=c("blue","blue","blue"), chars.out=c("+","+","+"), cols.out=c("red","red","red")) ## Not run: a marked point pattern in a rectangle sampling window with circles in green colour plot(spp(BP$trees, win=BP$rect, marks=BP$dbh), cols="green") ## Not run: a marked point pattern in a circular sampling window ## Not run: (squares in red colour inside and circles in blue colour outside) plot(spp(BP$trees, win=c(55,45,45), marks=BP$dbh), out=TRUE, chars="squares", cols="red", cols.out="blue")
Plot local density estimates returned by functions dval,
kval or k12val
.
## S3 method for class 'vads' plot(x, main, opt, select, chars, cols, maxsize, char0, col0, legend, csize, ...)
## S3 method for class 'vads' plot(x, main, opt, select, chars, cols, maxsize, char0, col0, legend, csize, ...)
x |
an object of class |
main |
by default, the value of argument x, otherwise a text to be displayed as a title of the plot. |
opt |
(optional) a character string to change the type of values to be plotted (see Details). |
select |
(optional) a vector of selected distances in |
chars |
one of |
cols |
(optional) the colour used for the plotting symbols. Black colour is the default. |
maxsize |
(optional) maximum size of the circles/squares plotted. By default, maxsize is automatically adjusted to plot size. |
char0 |
(optional) the plotting symbol used to represent null values. By default, null values are not plotted. |
col0 |
(optional) the colour used for the null values plotting symbol. By default, the same as argument |
legend |
If |
csize |
scaling factor for font size so that actual font size is |
... |
extra arguments that will be passed to the plotting functions |
Function plot.vads
displays a map of first-order local density or second-order local neighbour density values as symbols with areas proportional
to the values estimated at the plotted points.
Positive values are represented by coloured symbols, while negative values are represented by open symbols. The plotted function values depend upon the
type of 'vads'
object:
if class(x)=c("vads","dval")
, the plotted values are first-order local densities and argument opt="dval"
by default, but
is potentially one of c("dval","cval")
returned by dval
.
if class(x)=c("vads","kval")
or class(x)=c("vads","k12val")
, the plotted values are univariate or bivariate second-order
local neighbour densities. Argument opt="lval"
by default, but is potentially one of c("lval","kval","nval","gval")
returned by kval
and k12val
.
none.
data(BPoirier) BP <- BPoirier ## Not run: local density in a rectangle sampling window dswr <- dval(spp(BP$trees, win=BP$rect), 25, 1, 11, 9) plot(dswr) ## Not run: display only distance r from 5 to 10 with null symbols as red crosses plot(dswr, select=c(5:10), char0=3, col0="red") ## Not run: local L(r) values in a circular sampling window lvswc <- kval(spp(BP$trees, win=c(55,45,45)), 25, 0.5) plot(lvswc) ## Not run: display square symbols in blue for selected values of r and remove title plot(lvswc, chars="squares", cols="blue", select=c(5,7.5,10,12.5,15), main=NULL) ## Not run: local K12(r) values (1="beech", 2="oak") in a complex sampling window k12swrt <- k12val(spp(BP$trees, win=BP$rect, tri=BP$tri1, marks=BP$species), 25, 1) plot(k12swrt, opt="kval")
data(BPoirier) BP <- BPoirier ## Not run: local density in a rectangle sampling window dswr <- dval(spp(BP$trees, win=BP$rect), 25, 1, 11, 9) plot(dswr) ## Not run: display only distance r from 5 to 10 with null symbols as red crosses plot(dswr, select=c(5:10), char0=3, col0="red") ## Not run: local L(r) values in a circular sampling window lvswc <- kval(spp(BP$trees, win=c(55,45,45)), 25, 0.5) plot(lvswc) ## Not run: display square symbols in blue for selected values of r and remove title plot(lvswc, chars="squares", cols="blue", select=c(5,7.5,10,12.5,15), main=NULL) ## Not run: local K12(r) values (1="beech", 2="oak") in a complex sampling window k12swrt <- k12val(spp(BP$trees, win=BP$rect, tri=BP$tri1, marks=BP$species), 25, 1) plot(k12swrt, opt="kval")
Function spp
creates an object of class "spp"
, which represents a
spatial point pattern observed in a finite sampling window (or study region).
The ads
library supports univariate, multivariate and marked point patterns
observed in simple (rectangular or circular) or complex sampling windows.
spp(x, y=NULL, window, triangles, marks, int2fac=TRUE) ppp2spp(p)
spp(x, y=NULL, window, triangles, marks, int2fac=TRUE) ppp2spp(p)
x , y
|
if |
window |
a |
triangles |
(optional) a list of triangles removed from a simple initial window to define a
complex sampling window (see |
marks |
(optional) a vector of mark values, which may be factor levels or numerical values (see Details). |
int2fac |
if TRUE, integer marks are automatically coerced into factor levels. |
p |
a |
A spatial point pattern is assumed to have been observed within a specific
sampling window (a finite study region) defined by the window
argument. If window
is a simple "swin"
object,
it may be coerced into a complex type by adding a triangles
argument (see swin
). A spatial point pattern may be of 3 different types.
univariate pattern:
by default when argument marks
is not given.
multivariate pattern:
marks
is a factor, which levels are interpreted as categorical marks (e.g. colours, species, etc.) attached to points of the pattern.
Integer marks may be automatically coerced into factor levels when argument int2fac = TRUE
.
marked pattern:
marks
is a vector of real numbers attached to points of the pattern. Integer values may also be considered as numerical values
if argument int2fac = FALSE
.
An object of class "spp"
describing a spatial point pattern observed in a given sampling window.
$type |
a character string indicating if the spatial point pattern is |
$window |
an |
$n |
an integer value giving the number of points of the pattern located inside the sampling window (points on the boundary are considered to be inside). |
$x |
a vector of |
$y |
a vector of |
$nout |
(optional) an integer value giving the number of points of the pattern located outside the sampling window. |
$xout |
(optional) a vector of |
$yout |
(optional) a vector of |
$marks |
(optional) a vector of the marks attached to points located inside the sampling window. |
$marksout |
(optional) a vector of the marks attached to points located outside the sampling window. |
There are printing, summary and plotting methods for "spp"
objects.
Function ppp2spp
converts an ppp.object
from package spatstat.geom
into an "spp"
object.
Goreaud, F. and P?Pelissier, R. 1999. On explicit formula of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
data(BPoirier) BP <- BPoirier ## Not run: univariate pattern in a rectangle of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) ## Not run: an alternative using atomic vectors of point coordinates swr <- spp(BP$trees, win=BP$rect) summary(swr) plot(swr) ## Not run: univariate pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,50)) summary(swc) plot(swc) plot(swc, out=TRUE) # plot points outside the circle ## Not run: multivariate pattern in a rectangle of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) summary(swrm) plot(swrm) plot(swrm, chars=c("b","h","o")) # replace symbols by letters ## Not run: marked pattern in a rectangle of size [0,110] x [0,90] swrn <- spp(BP$trees, win=BP$rect, marks=BP$dbh) summary(swrn) plot(swrn) ## Not run: multivariate pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1, marks=BP$species) summary(swrt) plot(swrt) plot(swrt, out=TRUE) # plot points outside the sampling window ## Not run: converting a ppp object from spatstat.geom data(demopat) demo.spp<-ppp2spp(demopat) plot(demo.spp)
data(BPoirier) BP <- BPoirier ## Not run: univariate pattern in a rectangle of size [0,110] x [0,90] swr <- spp(BP$trees, win=BP$rect) ## Not run: an alternative using atomic vectors of point coordinates swr <- spp(BP$trees, win=BP$rect) summary(swr) plot(swr) ## Not run: univariate pattern in a circle with radius 50 centred on (55,45) swc <- spp(BP$trees, win=c(55,45,50)) summary(swc) plot(swc) plot(swc, out=TRUE) # plot points outside the circle ## Not run: multivariate pattern in a rectangle of size [0,110] x [0,90] swrm <- spp(BP$trees, win=BP$rect, marks=BP$species) summary(swrm) plot(swrm) plot(swrm, chars=c("b","h","o")) # replace symbols by letters ## Not run: marked pattern in a rectangle of size [0,110] x [0,90] swrn <- spp(BP$trees, win=BP$rect, marks=BP$dbh) summary(swrn) plot(swrn) ## Not run: multivariate pattern in a complex sampling window swrt <- spp(BP$trees, win=BP$rect, tri=BP$tri1, marks=BP$species) summary(swrt) plot(swrt) plot(swrt, out=TRUE) # plot points outside the sampling window ## Not run: converting a ppp object from spatstat.geom data(demopat) demo.spp<-ppp2spp(demopat) plot(demo.spp)
Function swin
creates an object of class "swin"
, which represents
the sampling window (or study region) in which a spatial point pattern was
observed. The ads
library supports simple (rectangular or circular) and complex
sampling windows.
swin(window, triangles) owin2swin(w)
swin(window, triangles) owin2swin(w)
window |
a vector defining the limits of a simple sampling window: |
triangles |
(optional) a list of triangles removed from a simple initial window to define a complex sampling window (see Details). |
'
w |
a |
A sampling window may be of simple or complex type. A simple sampling window may be a rectangle or a circle. A complex sampling window is defined by removing triangular surfaces from a simple (rectangular or circular) initial sampling window.
rectangular window:
window=c(ximn,ymin,xmax,ymax)
a vector of length 4 giving the coordinates and
of the origin and the opposite corner of a rectangle.
circular window:
window=c(x0,y0,r0)
a vector of length 3 giving the coordinates
of the centre and the radius
of a circle.
complex window:
triangles
is a list of 6 variables giving the vertices coordinates of the triangles to remove from a simple (rectangular or circular) initial window. The triangles may be removed
near the boundary of a rectangular window in order to design a polygonal sampling window, or within a rectangle
or a circle, to delineating holes in the initial sampling window (see Examples). The triangles do not overlap each other, nor overlap boundary
of the initial sampling window. Any polygon (possibly with holes) can be decomposed into contiguous triangles using
triangulate
.
An object of class "swin"
describing the sampling window. It may be of four different types
with different arguments:
$type |
a vector of two character strings defining the type of sampling window among |
$xmin , $ymin , $xmax , $ymax
|
(optional) coordinates of the origin and the opposite corner for a rectangular sampling window (see details). |
$x0 , $y0 , $r0
|
(optional) coordinates of the centre and radius for a circular sampling window (see details). |
$triangles |
(optional) vertices coordinates of triangles for a complex sampling window (see details). |
There are printing, summary and plotting methods for "swin"
objects.
Function owin2swin
converts an owin.object
from package spatstat.geom
into an "swin"
object.
Goreaud, F. and P?Pelissier, R. 1999. On explicit formula of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
## Not run: rectangle of size [0,110] x [0,90] wr <- swin(c(0,0,110,90)) summary(wr) plot(wr) ## Not run: circle with radius 50 centred on (55,45) wc <- swin(c(55,45,50)) summary(wc) plot(wc) ## Not run: polygon (diamond shape) t1 <- c(0,0,55,0,0,45) t2 <- c(55,0,110,0,110,45) t3 <- c(0,45,0,90,55,90) t4 <- c(55,90,110,90,110,45) wp <- swin(wr, rbind(t1,t2,t3,t4)) summary(wp) plot(wp) ## Not run: rectangle with a hole h1 <- c(25,45,55,75,85,45) h2 <- c(25,45,55,15,85,45) wrh <- swin(wr, rbind(h1,h2)) summary(wrh) plot(wrh) ## Not run: circle with a hole wch <- swin(wc, rbind(h1,h2)) summary(wch) plot(wch) ## Not run: converting an owin object from spatstat.geom data(demopat) demo.swin<-owin2swin(demopat$window) plot(demo.swin)
## Not run: rectangle of size [0,110] x [0,90] wr <- swin(c(0,0,110,90)) summary(wr) plot(wr) ## Not run: circle with radius 50 centred on (55,45) wc <- swin(c(55,45,50)) summary(wc) plot(wc) ## Not run: polygon (diamond shape) t1 <- c(0,0,55,0,0,45) t2 <- c(55,0,110,0,110,45) t3 <- c(0,45,0,90,55,90) t4 <- c(55,90,110,90,110,45) wp <- swin(wr, rbind(t1,t2,t3,t4)) summary(wp) plot(wp) ## Not run: rectangle with a hole h1 <- c(25,45,55,75,85,45) h2 <- c(25,45,55,15,85,45) wrh <- swin(wr, rbind(h1,h2)) summary(wrh) plot(wrh) ## Not run: circle with a hole wch <- swin(wc, rbind(h1,h2)) summary(wch) plot(wch) ## Not run: converting an owin object from spatstat.geom data(demopat) demo.swin<-owin2swin(demopat$window) plot(demo.swin)
Function triangulate
decomposes a simple polygon (optionally having holes) into contiguous triangles.
triangulate(outer.poly, holes)
triangulate(outer.poly, holes)
outer.poly |
a list with two component vectors |
holes |
(optional) a list (or a list of list) with two component vectors |
In argument outer.poly
, the vertices must be listed following boundary of the polygon without any repetition (i.e. do not repeat the first vertex).
Argument holes
may be a list of vertices coordinates of a single hole (i.e. with and
component vectors) or a list of list for multiple holes,
where each
holes[[i]]
is a list with and
component vectors. Holes' vertices must all be inside the
outer.poly
boundary (vertices on the boundary
are considered outside). Multiple holes do not overlap each others.
A list of 6 variables, suitable for using in swin
and spp
, and giving the vertices coordinates of the triangles that
pave the polygon. For a polygon with t holes totaling
vertices (outer contour + holes), the number of triangles produced
is
, with
in this version of the program.
Goreaud, F. and P?Pelissier, R. 1999. On explicit formula of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.
Narkhede, A. & Manocha, D. 1995. Fast polygon triangulation based on Seidel's algorithm. Pp 394-397 In A.W. Paeth (Ed.)
Graphics Gems V. Academic Press. http://www.cs.unc.edu/~dm/CODE/GEM/chapter.html.
data(BPoirier) BP <- BPoirier plot(BP$poly1$x, BP$poly1$y) ## Not run: a single polygon triangulation tri1 <- triangulate(BP$poly1) plot(swin(BP$rect, tri1)) ## Not run: a single polygon with a hole tri2 <- triangulate(c(-10,-10,120,100), BP$poly1) plot(swin(c(-10,-10,120,100), tri2))
data(BPoirier) BP <- BPoirier plot(BP$poly1$x, BP$poly1$y) ## Not run: a single polygon triangulation tri1 <- triangulate(BP$poly1) plot(swin(BP$rect, tri1)) ## Not run: a single polygon with a hole tri2 <- triangulate(c(-10,-10,120,100), BP$poly1) plot(swin(c(-10,-10,120,100), tri2))