Learn R Programming

pcds (version 0.1.8)

rel.vert.mid.int: The index of the vertex region in a middle interval that contains a given point

Description

Returns the index of the vertex whose region contains point p in the interval int\(=(a,b)=\)(vertex 1,vertex 2) with (parameterized) center \(M_c\) associated with the centrality parameter \(c \in (0,1)\); vertices of interval are labeled as 1 and 2 according to their order in the interval int. If the point, p, is not inside int, then the function yields NA as output. The corresponding vertex region is the interval \((a,b)\) as \((a,M_c)\) and \((M_c,b)\) where \(M_c=a+c(b-a)\).

See also (ceyhan:metrika-2012,ceyhan:revstat-2016;textualpcds).

Usage

rel.vert.mid.int(p, int, c = 0.5)

Value

A list with two elements

rv

Index of the vertex in the interval int whose region contains point, p.

int

The vertices of the interval as a vector where position of the vertex corresponds to the vertex index as int=(rv=1,rv=2).

Arguments

p

A 1D point. The vertex region p resides is to be found.

int

A vector of two real numbers representing an interval.

c

A positive real number in \((0,1)\) parameterizing the center inside int\(=(a,b)\) with the default c=.5. For the interval, int\(=(a,b)\), the parameterized center is \(M_c=a+c(b-a)\).

Author

Elvan Ceyhan

References

See Also

rel.vert.end.int

Examples

Run this code
# \donttest{
c<-.4
a<-0; b<-10; int = c(a,b)

Mc<-centerMc(int,c)

rel.vert.mid.int(6,int,c)

n<-20  #try also n<-40
xr<-range(a,b,Mc)
xf<-(int[2]-int[1])*.5
Xp<-runif(n,a,b)

Rv<-vector()
for (i in 1:n)
  Rv<-c(Rv,rel.vert.mid.int(Xp[i],int,c)$rv)
Rv

jit<-.1
yjit<-runif(n,-jit,jit)

Xlim<-range(a,b,Xp)
xd<-Xlim[2]-Xlim[1]

plot(cbind(Mc,0),main="vertex region indices for the points", xlab=" ",
ylab=" ", xlim=Xlim+xd*c(-.05,.05),ylim=3*range(yjit),pch=".",cex=3)
abline(h=0)
points(Xp,yjit)
abline(v=c(a,b,Mc),lty = 2,col=c(1,1,2))
text(Xp,yjit,labels=factor(Rv))
text(cbind(c(a,b,Mc),.02),c("rv=1","rv=2","Mc"))
# }

Run the code above in your browser using DataLab