Learn R Programming

nnspat (version 0.1.2)

rassocI: Generation of Points Associated in the Type I Sense with a Given Set of Points

Description

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 I fashion with circular (or radial) between class attraction parameter p, which is a probability value between 0 and 1. 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). 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 \(Uniform(0,1)\) number, \(U\), is generated. If \(U \le p\), a new point from the class 2, say \(x_{2new}\), is generated within a circle with radius equal to the distance to the closest \(X_1\) point (uniform in the polar coordinates), else the new point is generated uniformly within the smallest bounding box containing \(X_1\) points. That is, if \(U \le p\), \(x_{2new} = x_{1ref}+r_u c(\cos(t_u),\sin(t_u))\) where \(r_u \sim U(0,rad)\) and \(t_u \sim U(0, 2\pi)\) with \(rad=\min(d(x_{1ref},X_1\setminus \{x_{1ref}\}))\), else \(x_{2new} \sim rect(X_1)\) where \(rect(X_1)\) is the smallest bounding box containing \(X_1\) points. Note that, the level of association increases as p increases, and the association vanishes when p approaches to 0.

Type I association is closely related to Type C association in ceyhan:serra-2014;textualnnspat, see the function rassocC and also 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 G association, \(x_{2new}\) is generated from the bivariate normal distribution centered at \(x_{1ref}\) with covariance \(\sigma I_2\) where \(I_2\) is \(2 \times 2\) identity matrix.

Usage

rassocI(X1, n2, p)

Value

A list with the elements

pat.type

equals "ref.gen" for the bivariate pattern of association of class 2 (i.e., \(X_2\)) points with the reference points (i.e., \(X_1\)), indicates reference points are required to be entered as an argument in the function

type

The type of the point pattern

parameters

Radial (i.e., circular) between class attraction parameter controlling the level of association

gen.points

The output set of generated points (i.e., class 2 points) associated with reference (i.e. \(X_1\) points)

ref.points

The input set of reference points \(X_1\), i.e., points with which generated class 2 points are associated.

desc.pat

Description of the point pattern

lab

The class labels of the generated points, it is NULL for this function, since only class 2 points are generated in this 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 2 points and the number of reference (i.e., \(X_1\)) points.

xlimit,ylimit

The possible ranges of the \(x\)- and \(y\)-coordinates of the generated and the reference points

Arguments

X1

A set of 2D points representing the reference points, also referred as class 1 points. The generated points are associated in a type I sense (in a circular/radial fashion) with these points.

n2

A positive integer representing the number of class 2 (i.e., \(X_2\)) points to be generated.

p

A real number between 0 and 1 representing the attraction probability of class 2 points associated with a randomly selected class 1 point (see the description below).

Author

Elvan Ceyhan

References

See Also

rassocC, rassocG, rassocU, and rassoc

Examples

Run this code
n1<-20; n2<-1000;  #try also n1<-10; n2<-1000;

p<- .75 #try also .25, .5, .9, runif(1)
#with default bounding box (i.e., unit square)
X1<-cbind(runif(n1),runif(n1))  #try also X1<-1+cbind(runif(n1),runif(n1))

Xdat<-rassocI(X1,n2,p)
Xdat
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)

Run the code above in your browser using DataLab