rself.ref | R Documentation |
An object of class "SpatPatterns"
.
Generates n_1
2D points from class 1 and n_2
(denoted as n2
as an argument)
2D points from class 2 in such a way that
self-reflexive pairs are more frequent than expected under CSR independence.
If distribution="uniform"
, the points from class 1, say X_i
are generated as follows:
X_i \stackrel{iid}{\sim} Uniform(S_1)
for S_1=(c1r[1],c1r[2])^2
for i=1,2,\ldots,n_{1h}
where n_{1h}=\lfloor n_1/2 \rfloor
,
and for k=n_{1h},+1,\ldots,n_1
, X_k=X_{k-n_{1h}}+r (\cos(T_k), \sin(T_k))
where r \sim Uniform(0,r_0)
and T_k
are iid \sim Uniform(0,2 \pi)
.
Similarly, the points from class 2, say Y_j
are generated as follows:
Y_j \stackrel{iid}{\sim} Uniform(S_2)
for S_2=(c2r[1],c2r[2])^2
for j=1,2,\ldots,n_{2h}
where n_{2h}=\lfloor n_2/2\rfloor)
,
and for l=n_{2h},+1,\ldots,n_2
, Y_l=Y_{l-n_{2h}}+r (\cos(T_l), \sin(T_l))
where r \sim Uniform(0,r_0)
and
T_l \stackrel{iid}{\sim} Uniform(0,2 \pi)
.
This version is the case IV in the article (\insertCiteceyhan:NNCorrespond2018;textualnnspat).
If distribution="bvnormal"
, the points from class 1,
say X_i
are generated as follows:
X_i \stackrel{iid}{\sim} BVN(CM(S_1),I_{2x})
where CM(S_1)
is the center of mass of S_1
and I_{2x}
is a 2 \times 2
matrix with diagonals
equal to s_1^2
with s_1=(c1r[2]-c1r[1])/3
and off-diagonals are 0 for i=1,2,\ldots,n_{1h}
where n_{1h}=\lfloor{n_1/2\rfloor}
,
and for k=n_{1h}+1,\ldots,n_1
, X_k = Z_k+r (\cos(T_k), \sin(T_k))
where Z_k \sim BVN(X_{k-n_{1h}}, I_2(r_0))
with I_2(r_0)
being the 2 \times 2
matrix
with diagonals r_0/3
and 0 off-diagonals, r \sim Uniform(0,r_0)
and
T_k
are iid \sim Uniform(0,2 \pi)
.
Similarly, the points from class 2, say Y_j
are generated as follows:
Y_j \stackrel{iid}{\sim} BVN(CM(S_2),I_{2y})
where CM(S_1)
is the center of mass of S_1
and
I_{2y}
is a 2 \times 2
matrix with diagonals
equal to s_2^2
with s_2=(c2r[2]-c2r[1])/3
and
off-diagonals are 0 for j=1,2,\ldots,n_{2h}
where n_{2h}=\lfloor n_2/2\rfloor)
,
and for l=n_{2h},+1,\ldots,n_2
, Y_l = W_k+r (\cos(T_l), \sin(T_l))
where W_l \sim BVN(Y_{l-n_{2h}}, I_2(r_0))
with I_2(r_0)
being the 2 \times 2
matrix
with diagonals r_0/3
and 0 off-diagonals, r \sim Uniform(0,r_0)
and
T_l \stackrel{iid}{\sim} Uniform(0,2 \pi)
.
Notice that the classes will be segregated
if the supports S_1
and S_2
are separated, with more separation
implying stronger segregation. Furthermore, r_0
(denoted as r0
as an argument) determines
the level of self-reflexivity or self correspondence,
i.e., smaller r_0
implies a higher level of self correspondence
and vice versa for higher r_0
.
See also (\insertCiteceyhan:NNCorrespond2018;textualnnspat) and the references therein.
rself.ref(n1, n2, c1r, c2r, r0, distribution = c("uniform", "bvnormal"))
n1 , n2 |
Positive integers representing the numbers of points to be generated from the two classes |
c1r , c2r |
Ranges of the squares which constitute the supports of the two classes |
r0 |
The radius of attraction which determines the level of self-reflexivity (or self correspondence) in both the uniform and bvnormal distributions for the two classes |
distribution |
The argument determining the distribution of each class. Takes on values |
A list
with the elements
pat.type |
|
type |
The type of the spatial pattern |
parameters |
The radius of attraction |
lab |
The class labels of the generated points, it is 1 class 1 or X1 points and
2 for class 2 or |
init.cases |
The initial points for class 1 and class 2, one initial point for each class, marked with a cross in the plot. |
gen.points |
The output set of generated points from the self-correspondence pattern. |
ref.points |
The input set of reference points, it is |
desc.pat |
Description of the species correspondence pattern |
mtitle |
The |
num.points |
The number of generated points. |
xlimit , ylimit |
The possible ranges of the |
Elvan Ceyhan
Zself.ref
and Xsq.spec.cor
n1<-50; #try also n1<-50; n1<-1000;
n2<-50; #try also n2<-50; n2<-1000;
c1r<-c(0,1) #try also c(0,5/6), C(0,3/4), c(0,2/3)
c2r<-c(0,1) #try also c(1/6,1), c(1/4,1), c(1/3,1)
r0<-1/9 #try also 1/7, 1/8
#data generation
Xdat<-rself.ref(n1,n2,c1r,c2r,r0)
Xdat
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#data generation (bvnormal)
Xdat<-rself.ref(n1,n2,c1r,c2r,r0,distr="bvnormal")
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.