View source: R/NNCTFunctions.R
QRval | R Documentation |
Returns the Q
and R
values
where Q
is the number of points shared as a NN
by other points i.e., number of points
that are NN of other points (which occurs when two or
more points share a NN, for data in any dimension) and R
is
the number of reflexive pairs
where A and B are reflexive iff they are NN to each other.
These quantities are used, e.g., in computing the variances and covariances of the entries of the nearest neighbor contingency tables used for Dixon's tests and other NNCT tests.
QRval(njr)
njr |
A |
A list
with two elements
Q |
the |
R |
the |
Elvan Ceyhan
Qval
, Qvec
, sharedNN
,
Rval
, and Ninv
#3D data points
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
ninv<-Ninv(ipd)
QRval(ninv)
W<-Wmat(ipd)
Qvec(W)$q
#1D data points
n<-15
X<-as.matrix(runif(n))# need to be entered as a matrix with one column
#(i.e., a column vector), hence X<-runif(n) would not work
ipd<-ipd.mat(X)
ninv<-Ninv(ipd)
QRval(ninv)
W<-Wmat(ipd)
Qvec(W)$q
#with possible ties in the data
Y<-matrix(round(runif(30)*10),ncol=3)
ny<-nrow(Y)
ipd<-ipd.mat(Y)
ninv<-Ninv(ipd)
QRval(ninv)
W<-Wmat(ipd)
Qvec(W)$q
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.