Returns the index of the vertex whose region contains point p
in
the interval int
int
. If the point, p
, is not inside int
, then the function yields NA
as output.
The corresponding vertex region is the interval
See also (ceyhan:metrika-2012,ceyhan:revstat-2016;textualpcds).
rv.mid.int(p, int, c = 0.5)
A list
with two elements
Index of the vertex in the interval int
whose region contains point, p
.
The vertices of the interval as a vector
where position of the vertex corresponds to
the vertex index as int=(rv=1,rv=2)
.
A 1D point. The vertex region p
resides is to be found.
A vector
of two real numbers representing an interval.
A positive real number in int
c=.5
.
For the interval, int
Elvan Ceyhan
rv.end.int
if (FALSE) {
c<-.4
a<-0; b<-10; int = c(a,b)
Mc<-centMc(int,c)
rv.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,rv.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