rseg: Generation of Points under Segregation of Two Classes

rsegR Documentation

Generation of Points under Segregation of Two Classes

Description

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.

Usage

rseg(n1, n2, r1, r2, X1.init = NULL, X2.init = NULL)

Arguments

n1, n2

Positive integers representing the number of class 1 and class 2 (i.e., X_1 and X_2) points to be generated under the segregation pattern.

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=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. The initial points are marked with crosses in the plot of the points.

Value

A list with the elements

pat.type

"2c" for the 2-class pattern of segregation of the two classes

type

The type of the point pattern

parameters

Radial (i.e., circular) within class radii of segregation, r1 and r2, controlling the level of segregation

lab

The class labels of the generated points, it is 1 class 1 or X_1 points and 2 for class 2 or X_2 points

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 NULL for this function.

desc.pat

Description of the point pattern

mtitle

The "main" title for the plot of the point pattern

num.points

The vector of two numbers, which are the number of generated class 1 and class 2 points.

xlimit, ylimit

The possible ranges of the x- and y-coordinates of the generated and the initial points

Author(s)

Elvan Ceyhan

See Also

rassoc

Examples

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) 


nnspat documentation built on May 29, 2024, 10:03 a.m.