rseg | R Documentation |
An object of class "SpatPatterns"
.
Generates n_i
2D points from class j
with parameters r_j
for j=1,2
.
The generated points are from two different classes which are segregated from each other.
The pattern generation starts with the initial points X1.init
and X2.init
(with default=NULL
for both).
If both X1.init=NULL
and X2.init=NULL
, both X1.init
and X2.init
are generated uniformly in the unit square.
If only X1.init=NULL
, X1.init
is the sum of a point uniformly generated in the unit square and X2.init
and
if only X2.init=NULL
, X2.init
is the sum of a point uniformly generated in the unit square and X1.init
.
After the initial points from each class are available, n_j
points from class j
are generated
as Xj[i,]<-Xj[(i-1),]+ru*c(cos(tu),sin(tu))
where ru<-runif(1,0,rj)
and tu<-runif(1,0,2*pi)
for i=2,\ldots,n_j
with Xj[1,]=Xj.init
for j=1,2
.
That is, at each step the new point in class j
is generated within a circle with radius equal to r_j
(uniform in the polar coordinates).
Note that, the level of segregation is stronger if the initial points are further apart, and the level
of segregation increases as the radius values gets smaller.
rseg(n1, n2, r1, r2, X1.init = NULL, X2.init = NULL)
n1 , n2 |
Positive integers representing the number of class 1 and class 2 (i.e., |
r1 , r2 |
Positive real numbers representing the radius of attraction within class, i.e., radius of the circle center and generated points are from the same class. |
X1.init , X2.init |
2D points representing the initial points for the segregated classes, default= |
A list
with the elements
pat.type |
|
type |
The type of the point pattern |
parameters |
Radial (i.e., circular) within class radii of segregation, |
lab |
The class labels of the generated points, it is 1 class 1 or |
init.cases |
The initial points for class 1 and class 2, one initial point for each class. |
gen.points |
The output set of generated points (i.e., class 1 and class 2 points) segregated from each other. |
ref.points |
The input set of reference points, it is |
desc.pat |
Description of the point pattern |
mtitle |
The |
num.points |
The |
xlimit , ylimit |
The possible ranges of the |
Elvan Ceyhan
rassoc
n1<-20; #try also n1<-10; n1<-100;
n2<-20; #try also n1<-40; n2<-50
r1<-.3; r2<-.2
#data generation
Xdat<-rseg(n1,n2,r1,r2) #labeled data
Xdat
table(Xdat$lab)
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#with one initial point
X1init<-c(3,2)
Xdat<-rseg(n1,n2,r1,r2,X1.init=X1init)
Xdat
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#with two initial points
X1init<-c(3,2)
X2init<-c(4,2)
Xdat<-rseg(n1,n2,r1,r2,X1init,X2init)
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.