View source: R/NNCTFunctions.R
rassocG | R Documentation |
An object of class "SpatPatterns"
.
Generates n_2
2D points associated with the given set of points (i.e., reference points) X_1
in the
type G fashion with the parameter sigma which is a positive real number representing the variance of the
Gaussian marginals.
The generated points are intended to be from a different class, say class 2 (or X_2
points) than the reference
(i.e., X_1
points, say class 1 points, denoted as X1
as an argument of the function), say class 1 points).
To generate n_2
(denoted as n2
as an argument of the function)X_2
points, n_2
of X_1
points are randomly selected (possibly with replacement) and
for a selected X1
point, say x_{1ref}
,
a new point from the class 2, say x_{2new}
, is generated from a bivariate normal distribution centered at x_{1ref}
where the covariance matrix of the bivariate normal is a diagonal matrix with sigma in the diagonals.
That is, x_{2new} = x_{1ref}+V
where V \sim BVN((0,0),\sigma I_2)
with I_2
being the 2 \times 2
identity matrix.
Note that, the level of association increases as sigma
decreases, and the association vanishes when sigma
goes to infinity.
For type G association, it is recommended to take \sigma \le 0.10
times length of the shorter
edge of a rectangular study region, or take r_0 = 1/(k \sqrt{\hat \rho})
with the appropriate choice of k
to get an association pattern more robust to differences in relative abundances
(i.e., the choice of k
implies \sigma \le 0.10
times length of the shorter edge to have alternative patterns more
robust to differences in sample sizes).
Here \hat \rho
is the
estimated intensity of points in the study region (i.e., # of points divided by the area of the region).
Type G association is closely related to Types C and U association,
see the functions rassocC
and rassocU
and
the other association types.
In the type C association pattern
the new point from the class 2, x_{2new}
, is generated (uniform in the polar coordinates) within a circle
centered at x_{1ref}
with radius equal to r_0
,
in type U association pattern x_{2new}
is generated similarly except it is uniform in the circle.
In type I association, first a Uniform(0,1)
number, U
, is generated.
If U \le p
, x_{2new}
is generated (uniform in the polar coordinates) within a
circle with radius equal to the distance to the closest X_1
point,
else it is generated uniformly within the smallest bounding box containing X_1
points.
See \insertCiteceyhan:serra-2014;textualnnspat for more detail.
rassocG(X1, n2, sigma)
X1 |
A set of 2D points representing the reference points, also referred as class 1 points. The generated points are associated in a type G sense with these points. |
n2 |
A positive integer representing the number of class 2 points to be generated. |
sigma |
A positive real number representing the variance of the Gaussian marginals, where
the bivariate normal distribution has covariance |
A list
with the elements
pat.type |
= |
type |
The type of the point pattern |
parameters |
The variance of the Gaussian marginals controlling the level of association, where
the bivariate normal distribution has covariance |
gen.points |
The output set of generated points (i.e., class 2 points) associated with reference (i.e.
|
ref.points |
The input set of reference points |
desc.pat |
Description of the point pattern |
mtitle |
The |
num.points |
The |
xlimit , ylimit |
The possible ranges of the |
Elvan Ceyhan
rassocI
, rassocG
, rassocC
, and rassoc
n1<-20; n2<-1000; #try also n1<-10; n2<-1000;
stdev<-.05 #try also .075 and .15
#with default bounding box (i.e., unit square)
X1<-cbind(runif(n1),runif(n1)) #try also X1<-1+cbind(runif(n1),runif(n1))
Xdat<-rassocG(X1,n2,stdev)
Xdat
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#sigma adjusted with the expected NN distance
x<-range(X1[,1]); y<-range(X1[,2])
ar<-(y[2]-y[1])*(x[2]-x[1]) #area of the smallest rectangular window containing X1 points
rho<-n1/ar
stdev<-1/(4*sqrt(rho)) #r0=1/(2rho) where \code{rho} is the intensity of X1 points
Xdat<-rassocG(X1,n2,stdev)
Xdat
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.